PHPackages                             hongshanhealth/irmi-core - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. hongshanhealth/irmi-core

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

hongshanhealth/irmi-core
========================

红杉健康医保智能审核核心类库，Intelligent review of medical insurance

v1.0.7(1mo ago)21302MulanPSL-2.0PHPPHP &gt;=8.0

Since Jan 2Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/aLoNeIT/hongshan_irmi-core)[ Packagist](https://packagist.org/packages/hongshanhealth/irmi-core)[ RSS](/packages/hongshanhealth-irmi-core/feed)WikiDiscussions develop Synced 3w ago

READMEChangelogDependencies (5)Versions (29)Used By (0)

hongshan\_irmi-core
===================

[](#hongshan_irmi-core)

红杉健康医保智能审核核心类库，Intelligent review of medical insurance

测试用例执行方法
--------

[](#测试用例执行方法)

- 当前支持参数，`-p`为指定的测试目录，`-n`为指定的文件名`（无需后缀，默认json后缀）`
- 执行全部测试：`composer irmi`
- 执行指定目录下所有文件：`composer irmi -- -p alone`
- 执行指定目录下指定文件：`composer irmi -- -p alone -n case1`

智能审核规则结构，IRMIRule
-----------------

[](#智能审核规则结构irmirule)

- 规则结构参数介绍

    参数名是否必选类型可选值说明code是string规则编码name是string规则名称group是string规则分组item\_code是string项目编码item\_class否int1项目标记类型：1-明细，item\_code为项目自身编码；2-分类，item\_code为项目分类编码item\_name是string项目名称category是int1-患者医疗项目；2-电子病历；3-患者档案信息；4-医院信息规则类别type是int规则类型，对应计算器类型取值sub\_type是int规则子类型，对应计算器内子类型取值options否object规则具体的配置项#### options参数说明

    [](#options参数说明)

    - visit\_type：就诊类型，1-门诊，2-住院；
    - time\_range：时间范围，第一个为开始时间（大于等于），第二个为结束时间（小于），如果为null，则不限制时间，示例`[1535731200,null]`
    - unit\_type：数量单位，如果为`num`，代表数量，取num属性的值，如果为`cash`，取cash属性的值
    - item\_type：医保项目类型，数组，只要在集合中存在，就参与检测计算
        - 01：床位费
        - 02：诊查费
        - 03：检查费
        - 04：化验费
        - 05：治疗费
        - 06：手术费
        - 07：护理费
        - 08：卫生材料费
        - 09：西药费
        - 10：中药饮片费
        - 11：中成药费
        - 12：一般诊疗费
        - 13：挂号费
        - 14：其他费
        - 1401：特殊材料费
        - 15：氧费
        - 16：血制品
        - 17：人工晶体
        - 18：医事服务费
        - 19：药品
        - 20：基本药物
        - 21：服务及设施
        - 22：医疗减免项目
        - 99：按病种收费
    - item\_unit: 允许的项目单位集合，数组，每个元素是项目单位编码，如\['个','mg'\]
    - num：如果直接为数字，则代表本身含义，如果是一个对象，其属性定义如下
        - type：含义为，1-原始数字，2-病历中的某个属性，3-另一个项目的数量，4-群组中项目的个数，5-群组中项目的计费总数；
        - value: 具体数值
        - property: 如果type为2，则有该属性，属性值为病例中的属性名
        - coefficient：计算系数，如果type为2，且设置了该系数，则会将指定属性的值乘以该系数
        - item\_code：如果type为3，则有该属性，属性值为另一个项目的编码
        - time\_type：如果type为3，择优该属性，用于标记取另一个项目数据的时间范围时间类型，1-按日，2-全部
    - detect\_type：检测方式，1-按日，2-全部；
    - combine\_items：合并计数的项目，数组，每个元素是项目编码，用于将指定编码的数据一同累计数量；
    - exclude\_items：排除项目配置
        - time\_type：时间类型，1-按日，2-全部，3-时间区间，4-同一处方，10-同一小时
        - time\_offset：时间范围，第一个为开始时间偏移值（大于等于），第二个为结束时间偏移值（小于等于），如果为null，则不限制时间，负数代表时间往前，正数代表时间向后，数值为秒，示例`[-3600,3600]`
        - collection\_type：集合类型，具体类型编码(drug、procedure、diagnosis)，为null则代表是原始项目编码
        - collection：排除项目明细集合，是一个对象，每个key都是排除的项目编码，如果为null则代表没有更具体配置
            - combine\_items：需要联合其他的项目才不触发
    - include\_items：包含项目配置，只要有一个项目包含就可以
        - time\_type：时间类型，1-按日，2-全部，3-时间区间，4-同一处方，10-同一小时
        - time\_offset：时间范围，第一个为开始时间偏移值（大于等于），第二个为结束时间偏移值（小于等于），如果为null，则不限制时间，负数代表时间往前，正数代表时间向后，数值为秒，示例`[-3600,3600]`
        - collection\_type：集合类型，具体类型编码(drug、procedure、diagnosis)，为null则代表是原始项目编码
        - collection：包含项目明细集合，是一个对象，每个key都是包含的项目编码，如果为null则代表没有更具体配置
    - discount\_target：打折目标，1-其他项目打折，2-自己打折；
    - ratio：折扣比例，自身折扣比例，如果存在num配置，说明要超过指定数量部分才打折；
    - discount\_items：打折的其他项目，key是目标项目编码，value是对象
        - ratio：折扣比例
    - period：周期配置项
        - type：周期类型，1-次、2-日、3-周、4-月、5-年
        - num：周期数量，如1次、5日、十周；若type类型为1，则num被忽略
        - sub\_num：周期内的子数量，比如周期是日，子数量是2
    - age\_range：年龄范围，数组，第一个为开始年龄（大于），第二个为结束年龄（小于），如果为null，则不限制年龄，示例`[18,null]`
    - property：属性配置，该节点下是一个json数组，里面每个元素用于描述对于病例信息的规则验证，包含内容如下
        - name：属性名称
        - value：属性值
        - operator：属性操作符，为&gt;、&lt;、=、&gt;=、&lt;=、!=、in、not in、regex
        - condition：前置条件，数组，每个元素是一个对象，包含name、operator、value属性
    - treatment\_days：治疗天数
    - `(暂未实现)`date\_interval：日期间隔配置
        - num：间隔数量，如5日、三月
        - type：间隔时间类型，1-日，2-月，3-年
- 智能审核规则计算器

    - insurance：医保相关
        - type=1，DuplicateCharge，重复收费
            - sub\_type=1，重复收费
                - time\_range
                - include\_items、exclude\_items
        - type=2，OverStandardCharge，超标准收费
            - sub\_type=1，当前项目计费量超过指定量
                - time\_range
                - include\_branch、exclude\_branch
                - unit\_type、num、
                - detect\_type
                - combine\_items
            - sub\_type=2，检测多项目同时存在的折扣费用
                - time\_range
                - detect\_type
                - discount\_items、discount\_target、ratio
        - type=3，OverInsuranceCharge，超医保费用
            - sub\_type=1，超医保费用
                - time\_range
                - visit\_type
                - age\_range
                - total\_days
                - period
                - include\_items、exclude\_items
            - sub\_type=2,医保支付范围检测
                - item\_type
                - num
        - type=4，UnReasonableTreatment，不合理诊疗
            - sub\_type=1，检测医保项目同时收费或未同时收费
                - time\_range
                - include\_items、exclude\_items
            - sub\_type=2，属性不符合要求
                - time\_range
                - include\_branch、exclude\_branch
                - property
        - type=5，SplitCharge，分解收费
            - sub\_type=1，检测多个项目同时存在
                - include\_items：指定需要检测的项目集合
                - required\_count：同时存在的最少项目数量
        - type=99, Custom，自定义检测处理器
            - sub\_type=1，单位检测处理器
                - item\_unit
    - emr：病历相关
        - type=1，MedicalRecord，病历属性不合规
            - sub\_type=1，手术与诊断不不符
                - property
            - sub\_type=2，病历属性不合规
                - property
- 规则示例数据,IRMIRuleSet集合json格式

    ```
    {
        "code": "01",
        "name": "规则集",
        "rules": [
            {
                "code": "01-01",
                "name": "重复收费",
                "item_code": "120300001b",
                "item_name": "持续吸氧",
                "type": 1,
                "options": {
                    "exclude_items": {
                        "002": {
                            "time_type": 1
                        },
                        "003/呼吸机辅助呼吸": {
                            "num": 1,
                            "time_type": 1
                        }
                    },
                    "time_range": [
                        969356516,
                        null
                    ],
                    "pathology_check": [
                        "004",
                        "005"
                    ]
                }
            },
            {
                "code": "400CLASSDAYS",
                "name": "Classification unreasonable treatment days",
                "item_class": 2,
                "item_code": "CLASS-ANTIBIOTIC",
                "item_name": "Antibiotic classification",
                "category": 1,
                "type": 4,
                "sub_type": 1,
                "options": {
                    "unit_type": "days",
                    "num": 7
                }
            },
            {
                "code": "02-01",
                "name": "超标准收费[指定项目数量超过住院天数]",
                "item_code": "110200005",
                "item_name": "住院诊查费",
                "type": 2,
                "sub_type": 1,
                "options": {
                    "exclude_branch": [
                        "05",
                        "05.01",
                        "05.02",
                        "05.03",
                        "05.04",
                        "05.05",
                        "05.06",
                        "06",
                        "06.01",
                        "06.02",
                        "06.03",
                        "06.04",
                        "06.05",
                        "06.06"
                    ],
                    "coefficient": 1,
                    "time_range": [
                        null,
                        1609430400
                    ]
                }
            },
            {
                "code": "02-02",
                "name": "超标准收费[指定项目当日收费超过X（元、数量）]",
                "item_code": "330100008",
                "item_name": "术后镇痛",
                "type": 2,
                "sub_type": 2,
                "options": {
                    "unit": "price",
                    "num": 5,
                    "time_range": [
                        1535731200,
                        null
                    ]
                }
            },
            {
                "code": "02-03",
                "name": "超标准收费[与指定项目当日收费超过X（元、数量）]",
                "item_code": "330100008",
                "item_name": "术后镇痛",
                "type": 2,
                "sub_type": 3,
                "options": {
                    "unit": "price",
                    "num": 5,
                    "time_range": [
                        1535731200,
                        null
                    ]
                }
            }
        ]
    }

    ```

病历结构，MedicalRecord
------------------

[](#病历结构medicalrecord)

- 病历结构参数介绍

    参数名是否必选类型可选值说明code是string病历编码sex是integer1-男；2-女性别age是integer年龄age\_day否integer不足一岁时的年龄天数weight否integer体重，单位gbirth\_weight否integer出生体重，单位gin\_branch是string入院/门诊科室编码out\_branch\[是\]string出院科室编码，住院时必填in\_days否integer住院天数visit\_type是integer1-门诊；2-住院就诊类型in\_date\[是\]integer入院/门诊日期out\_date\[是\]integer出院日期diagnosis否string\[\]诊断集合procedure否string\[\]手术集合insurance\_type否string\[\]保险集合hospital\_code否integer医院编码hospital\_type否string医院类型，如综合、精神、牙科，等待查询标准编码hospital\_level否integer医院级别hospital\_business\_type否integer1-公立；2-民营医院经营类型medical\_insurance\_set是object医保项目集合，kv结构，key是日期，value是该日期下的项目数组
    - medical\_insurance\_set参数中每个项目结构说明
        - key：时间戳，每天0点，代表日期
        - value：该日期下所有项目数据，kv结构如下
            - key：项目编码
            - value：该项目每次开单的数据，数组，每个元素结构如下
                - code：项目编码
                - classification：医保项目分类编码，用于匹配 item\_class=2 的规则
                - name：项目名称
                - group\_code：项目组号
                - type：医保项目类型
                - time：项目发生时间
                - num：项目数量
                - price：项目标准价格
                - cash：项目实收价格
                - total\_cash：项目总实收价格
                - days：项目天数
- 病历示例数据,MedicalRecort的json格式

    ```
    {
        "code": "0000001",
        "sex": 1,
        "age": 20,
        "age_day": null,
        "weight": null,
        "birth_weight": null,
        "in_branch": "01",
        "out_branch": "02",
        "in_days": 2,
        "visit_type": 2,
        "in_date": 1722470400,
        "out_date": 1722592800,
        "hospital_code": "79314258",
        "hospital_type": "精神病",
        "hospital_level": "医院级别",
        "hospital_business_type": 1,
        "medical_insurance_set": {
            "1722441600": {
                "120300002b": [
                    {
                        "code": "120300002b",
                        "name": "XX费用",
                        "time": 1722474000,
                        "num": 2,
                        "price": 19.00,
                        "cash": 19.00,
                        "total_cash": 38.00
                    }
                ]
            },
            "1722528000": {
                "120300002b": [
                    {
                        "code": "120300002b",
                        "name": "XX费用",
                        "time": 1722564000,
                        "num": 1,
                        "price": 19.00,
                        "cash": 19.00,
                        "total_cash": 19.00
                    }
                ]
            }
        }
    }

    ```

临时数据结构
------

[](#临时数据结构)

- 键名为`medical_insurance_item_with_code`的临时数据格式 ```
    {
        "120300002b": [{
            "date": 1726243200,
            "time": 1726275600,
            "num": 2,
            "price": 19.00,
            "cash": 19.00,
            "total_cash": 38.00
        }]
    }

    ```

### 错误信息数据格式

[](#错误信息数据格式)

```
{
	"state": 200,
	"msg": "错误具体内容",
	"data": [{
		"rule": {
			"code": "01-02",
			"name": "重复收费",
			"item_code": "对应项目编码",
			"item_name": "对应项目名称"
		},
		"item": {
			"name": "对比的项目名称",
			"code": "对比的项目编码"
		}
	}]
}

```

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance92

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 58.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~20 days

Total

26

Last Release

38d ago

Major Versions

v0.9.9 → v1.02026-03-09

### Community

Maintainers

![](https://www.gravatar.com/avatar/49f3be5f2b377a93a73a066a86122487be8181bef9c36c2fc9fbe3cb3c04b388?d=identicon)[aLoNeIT](/maintainers/aLoNeIT)

---

Top Contributors

[![Loong12](https://avatars.githubusercontent.com/u/21171652?v=4)](https://github.com/Loong12 "Loong12 (10 commits)")[![github-cn-sky](https://avatars.githubusercontent.com/u/17494823?v=4)](https://github.com/github-cn-sky "github-cn-sky (7 commits)")

### Embed Badge

![Health badge](/badges/hongshanhealth-irmi-core/health.svg)

```
[![Health](https://phpackages.com/badges/hongshanhealth-irmi-core/health.svg)](https://phpackages.com/packages/hongshanhealth-irmi-core)
```

###  Alternatives

[symfony/lock

Creates and manages locks, a mechanism to provide exclusive access to a shared resource

514135.1M626](/packages/symfony-lock)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.6k38.2k](/packages/matomo-matomo)[phpro/soap-client

A general purpose SoapClient library

8895.9M52](/packages/phpro-soap-client)[ecotone/ecotone

Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Durable Workflows (Sagas, Orchestrators), Projections, and Outbox messaging via PHP attributes.

562565.8k42](/packages/ecotone-ecotone)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

749284.3k37](/packages/civicrm-civicrm-core)[illuminate/broadcasting

The Illuminate Broadcasting package.

7126.9M203](/packages/illuminate-broadcasting)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
