hl7-pam-parser by dedalus-erp-pas/foundation-skills
npx skills add https://github.com/dedalus-erp-pas/foundation-skills --skill hl7-pam-parser此技能用于解析和解释 HL7 v2.5 IHE PAM(患者管理)消息——这是用于患者管理事件的标准医疗保健互操作性格式。该解析器能识别消息类型、提取段和字段、根据 IHE PAM 2.10 规范验证结构,并提供易于理解的解释。
何时使用此技能:
HL7 消息使用特定的分隔符:
字段分隔符: | (竖线)
组分分隔符: ^ (脱字符)
重复分隔符: ~ (波浪号)
转义字符: \ (反斜杠)
子组分分隔符: & (与符号)
基本结构 :
MSH|^~\&|SendingApp|SendingFacility|ReceivingApp|ReceivingFacility|Timestamp||MessageType|MessageControlId|ProcessingId|VersionId
EVN|EventTypeCode|RecordedDateTime|...
PID|SetId||PatientId||PatientName||BirthDate|Sex|...
PV1|SetId|PatientClass|AssignedPatientLocation|...
段终止符 :每个段以回车符 (\r) 或换行符 (\n) 结束
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
目的 :患者入院或登记
必需段 :
示例 :
MSH|^~\&|HEXAFLUX|CHU_PARIS|TARGET|DEST|20260122140000||ADT^A01^ADT_A01|MSG001|P|2.5
EVN|A01|20260122140000|||USER001
PID|1||PAT12345^^^CHU_PARIS^PI||DUPONT^JEAN^^M.||19750315|M|||15 RUE DE LA PAIX^^PARIS^^75001^FRA||(33)612345678
PV1|1|I|CHU_PARIS^CARDIO^LIT_001^CHU_PARIS||||PR_MARTIN^MARTIN^SOPHIE|||CARDIO||||||||||VIS20260122001|||||||||||||||||||||||||20260122140000
解释 :
目的 :患者在科室、病房或服务之间转移
必需段 :
示例 :
MSH|^~\&|HEXAFLUX|CHU_PARIS|TARGET|DEST|20260123090000||ADT^A02^ADT_A02|MSG002|P|2.5
EVN|A02|20260123090000|||USER002
PID|1||PAT12345^^^CHU_PARIS^PI||DUPONT^JEAN^^M.||19750315|M
PV1|1|I|CHU_PARIS^NEURO^LIT_102^CHU_PARIS||||PR_DURAND^DURAND^PAUL|||NEURO||||||||||VIS20260122001
PV2||||||||||||||||||||||CHU_PARIS^CARDIO^LIT_001^CHU_PARIS
解释 :
目的 :患者出院
必需段 :
示例 :
MSH|^~\&|HEXAFLUX|CHU_PARIS|TARGET|DEST|20260125180000||ADT^A03^ADT_A03|MSG003|P|2.5
EVN|A03|20260125180000|||USER003
PID|1||PAT12345^^^CHU_PARIS^PI||DUPONT^JEAN^^M.||19750315|M
PV1|1|I|CHU_PARIS^CARDIO^LIT_001^CHU_PARIS||||PR_MARTIN^MARTIN^SOPHIE|||CARDIO||||||||||VIS20260122001|||||||||||||||||||||||||||20260125180000|||||HOME
解释 :
目的 :预入院或门诊登记
必需段 :
目的 :预入院通知
目的 :将门诊就诊转为住院入院
目的 :将住院入院转为门诊就诊
目的 :更新患者人口统计信息
示例 :
MSH|^~\&|HEXAFLUX|CHU_PARIS|TARGET|DEST|20260122150000||ADT^A08^ADT_A08|MSG004|P|2.5
EVN|A08|20260122150000|||USER001
PID|1||PAT12345^^^CHU_PARIS^PI||DUPONT^JEAN^^M.||19750315|M|||15 RUE DE LA PAIX^^PARIS^^75001^FRA||(33)612345678|||||||1234567890123||FRA
PV1|1|O||||||||||||||||||||VIS20260122001
解释 :
目的 :取消之前的入院
目的 :取消之前的转院
目的 :取消之前的出院
目的 :消息元数据和路由信息
字段结构 :
MSH|^~\&|SendingApp|SendingFacility|ReceivingApp|ReceivingFacility|Timestamp||MessageType^EventCode^MessageStructure|MessageControlId|ProcessingId|VersionId
关键字段 :
目的 :事件特定信息
字段结构 :
EVN|EventTypeCode|RecordedDateTime|EventDateTime|EventReasonCode|OperatorId
关键字段 :
目的 :患者人口统计信息
字段结构 (30+ 字段):
PID|SetId||PatientId^^^AssigningAuthority^IdType~AltId||LastName^FirstName^MiddleName^Suffix^Prefix||BirthDate|Sex|PatientAlias|Race|PatientAddress||PhoneHome|PhoneBusiness|PrimaryLanguage|MaritalStatus|Religion|PatientAccountNumber|SSN|DriverLicense|MotherIdentifier|EthnicGroup|BirthPlace|MultipleBirth|BirthOrder|Citizenship|VeteranStatus|Nationality|DeathDateTime|DeathIndicator
关键字段 :
目的 :就诊/遭遇信息
字段结构 (52 字段):
PV1|SetId|PatientClass|AssignedLocation^Room^Bed^Facility|AdmissionType|PreadmitNumber|PriorLocation|AttendingDoctor^LastName^FirstName|ReferringDoctor|ConsultingDoctor|HospitalService|TemporaryLocation|PreadmitTestIndicator|ReadmissionIndicator|AdmitSource|AmbulatoryStatus|VIPIndicator|AdmittingDoctor|PatientType|VisitNumber|FinancialClass
关键字段 :
目的 :扩展的就诊信息
关键字段 :
当被要求解析 HL7 IHE PAM 消息时:
按段终止符分割 :segments = message.split('\r') 或 split('\n')
解析 MSH 段 (始终是第一个):
^~\&|^~\&识别消息类型 :检查 MSH-9
解析每个段 :
| 分割^ 解析组分~ 解析重复项& 解析子组分提取关键字段 :
验证结构 :
生成解释 :
解析消息时,提供:
### HL7 IHE PAM 消息分析
**原始消息**:
[original HL7 message with visible delimiters]
**消息标识**:
- 消息类型:ADT^A01
- 事件代码:A01 (入院/就诊通知)
- 消息控制 ID:[MSH-10]
- 时间戳:[formatted MSH-7]
- 版本:2.5
**MSH - 消息头**:
- 发送应用程序:[MSH-3]
- 发送机构:[MSH-4]
- 接收应用程序:[MSH-5]
- 接收机构:[MSH-6]
- 处理 ID:[MSH-11] (生产/测试)
**EVN - 事件类型**:
- 事件代码:[EVN-1]
- 记录日期时间:[formatted EVN-2]
- 事件发生时间:[formatted EVN-3]
- 操作员:[EVN-5]
**PID - 患者标识**:
- 患者 ID:[PID-3]
- 患者姓名:[formatted PID-5]
- 出生日期:[formatted PID-7]
- 性别:[PID-8]
- 地址:[formatted PID-11]
- 电话:[PID-13]
- [其他相关字段]
**PV1 - 患者就诊**:
- 患者类别:[PV1-2] ([description])
- 分配位置:[formatted PV1-3]
- 主治医生:[formatted PV1-7]
- 医院服务:[PV1-10]
- 就诊号:[PV1-19]
- 入院日期时间:[formatted PV1-44]
- [根据消息类型的其他相关字段]
**PV2 - 附加就诊信息** (如果存在):
- 先前位置:[PV2-1]
- [其他相关字段]
**业务背景**:
[解释此消息代表什么、工作流事件和临床意义]
**IHE PAM 合规性**:
- 必需段:[✓ 或 ✗ 对于 MSH, EVN, PID, PV1]
- 必填字段:[列出必填字段验证结果]
- 字段格式:[✓ 或 ✗ 对于日期、代码等]
| 代码 | 事件名称 | 目的 |
|---|---|---|
| A01 | 入院/就诊通知 | 患者入院 |
| A02 | 患者转院 | 在科室/病房之间转移 |
| A03 | 患者出院 | 患者出院 |
| A04 | 患者登记 | 预入院或门诊登记 |
| A05 | 患者预入院 | 计划入院通知 |
| A06 | 门诊转住院 | 状态变更 |
| A07 | 住院转门诊 | 状态变更 |
| A08 | 更新患者信息 | 人口统计信息更新 |
| A09 | 患者离开 - 追踪 | 患者暂时离开机构 |
| A10 | 患者到达 - 追踪 | 患者返回机构 |
| A11 | 取消入院 | 取消之前的入院 |
| A12 | 取消转院 | 取消之前的转院 |
| A13 | 取消出院 | 取消之前的出院 |
| A21 | 患者请假 | 临时请假 |
| A22 | 患者销假返回 | 请假返回 |
| A28 | 添加人员信息 | 向数据库添加新人员 |
| A31 | 更新人员信息 | 更新人员人口统计信息 |
| 代码 | 描述 |
|---|---|
| I | 住院患者 |
| O | 门诊患者 |
| E | 急诊 |
| P | 预入院 |
| R | 复诊患者 |
| B | 产科 |
| C | 商业账户 |
| N | 不适用 |
| U | 未知 |
| 代码 | 描述 |
|---|---|
| HOME | 回家或自我护理 |
| SNF | 专业护理机构 |
| RH | 康复机构 |
| EXP | 已故 |
| HOS | 临终关怀 |
| AADVICE | 违背医嘱离院 |
| OTH | 其他 |
|^~\& (编码字符)| 分隔IHE PAM 规范 :
HL7 v2.5 标准 :
相关工具 :
| 字段分隔符
^ 组分分隔符
~ 重复分隔符
\ 转义字符
& 子组分分隔符
MSH-9 : 消息类型 (ADT^A01^ADT_A01)
MSH-10 : 消息控制 ID
EVN-1 : 事件类型代码 (A01, A02 等)
EVN-2 : 记录日期时间
PID-3 : 患者 ID
PID-5 : 患者姓名
PID-7 : 出生日期
PID-8 : 性别
PV1-2 : 患者类别 (I/O/E)
PV1-3 : 分配位置
PV1-19 : 就诊号
PV1-44 : 入院日期时间
PV1-45 : 出院日期时间
每周安装次数
74
代码库
GitHub 星标
2
首次出现
2026年1月22日
安全审计
安装于
gemini-cli63
github-copilot63
codex62
opencode62
cursor61
claude-code56
This skill parses and explains HL7 v2.5 IHE PAM (Patient Administration Management) messages - the standard healthcare interoperability format for patient administration events. The parser identifies message types, extracts segments and fields, validates structure according to IHE PAM 2.10 specifications, and provides human-readable explanations.
When to use this skill:
HL7 messages use specific delimiters:
Field delimiter: | (pipe)
Component delimiter: ^ (caret)
Repetition delimiter: ~ (tilde)
Escape character: \ (backslash)
Subcomponent delimiter: & (ampersand)
Basic Structure :
MSH|^~\&|SendingApp|SendingFacility|ReceivingApp|ReceivingFacility|Timestamp||MessageType|MessageControlId|ProcessingId|VersionId
EVN|EventTypeCode|RecordedDateTime|...
PID|SetId||PatientId||PatientName||BirthDate|Sex|...
PV1|SetId|PatientClass|AssignedPatientLocation|...
Segment Terminators : Each segment ends with carriage return (\r) or newline (\n)
Purpose : Patient admission to inpatient care or registration
Required Segments :
Example :
MSH|^~\&|HEXAFLUX|CHU_PARIS|TARGET|DEST|20260122140000||ADT^A01^ADT_A01|MSG001|P|2.5
EVN|A01|20260122140000|||USER001
PID|1||PAT12345^^^CHU_PARIS^PI||DUPONT^JEAN^^M.||19750315|M|||15 RUE DE LA PAIX^^PARIS^^75001^FRA||(33)612345678
PV1|1|I|CHU_PARIS^CARDIO^LIT_001^CHU_PARIS||||PR_MARTIN^MARTIN^SOPHIE|||CARDIO||||||||||VIS20260122001|||||||||||||||||||||||||20260122140000
Explanation :
Purpose : Patient transfer between units, rooms, or services
Required Segments :
Example :
MSH|^~\&|HEXAFLUX|CHU_PARIS|TARGET|DEST|20260123090000||ADT^A02^ADT_A02|MSG002|P|2.5
EVN|A02|20260123090000|||USER002
PID|1||PAT12345^^^CHU_PARIS^PI||DUPONT^JEAN^^M.||19750315|M
PV1|1|I|CHU_PARIS^NEURO^LIT_102^CHU_PARIS||||PR_DURAND^DURAND^PAUL|||NEURO||||||||||VIS20260122001
PV2||||||||||||||||||||||CHU_PARIS^CARDIO^LIT_001^CHU_PARIS
Explanation :
Purpose : Patient discharge from hospital
Required Segments :
Example :
MSH|^~\&|HEXAFLUX|CHU_PARIS|TARGET|DEST|20260125180000||ADT^A03^ADT_A03|MSG003|P|2.5
EVN|A03|20260125180000|||USER003
PID|1||PAT12345^^^CHU_PARIS^PI||DUPONT^JEAN^^M.||19750315|M
PV1|1|I|CHU_PARIS^CARDIO^LIT_001^CHU_PARIS||||PR_MARTIN^MARTIN^SOPHIE|||CARDIO||||||||||VIS20260122001|||||||||||||||||||||||||||20260125180000|||||HOME
Explanation :
Purpose : Pre-admission or outpatient registration
Required Segments :
Purpose : Pre-admission notification
Purpose : Convert outpatient visit to inpatient admission
Purpose : Convert inpatient admission to outpatient visit
Purpose : Update patient demographics
Example :
MSH|^~\&|HEXAFLUX|CHU_PARIS|TARGET|DEST|20260122150000||ADT^A08^ADT_A08|MSG004|P|2.5
EVN|A08|20260122150000|||USER001
PID|1||PAT12345^^^CHU_PARIS^PI||DUPONT^JEAN^^M.||19750315|M|||15 RUE DE LA PAIX^^PARIS^^75001^FRA||(33)612345678|||||||1234567890123||FRA
PV1|1|O||||||||||||||||||||VIS20260122001
Explanation :
Purpose : Cancel a previous admission
Purpose : Cancel a previous transfer
Purpose : Cancel a previous discharge
Purpose : Message metadata and routing information
Field Structure :
MSH|^~\&|SendingApp|SendingFacility|ReceivingApp|ReceivingFacility|Timestamp||MessageType^EventCode^MessageStructure|MessageControlId|ProcessingId|VersionId
Key Fields :
Purpose : Event-specific information
Field Structure :
EVN|EventTypeCode|RecordedDateTime|EventDateTime|EventReasonCode|OperatorId
Key Fields :
Purpose : Patient demographic information
Field Structure (30+ fields):
PID|SetId||PatientId^^^AssigningAuthority^IdType~AltId||LastName^FirstName^MiddleName^Suffix^Prefix||BirthDate|Sex|PatientAlias|Race|PatientAddress||PhoneHome|PhoneBusiness|PrimaryLanguage|MaritalStatus|Religion|PatientAccountNumber|SSN|DriverLicense|MotherIdentifier|EthnicGroup|BirthPlace|MultipleBirth|BirthOrder|Citizenship|VeteranStatus|Nationality|DeathDateTime|DeathIndicator
Key Fields :
Purpose : Visit/encounter information
Field Structure (52 fields):
PV1|SetId|PatientClass|AssignedLocation^Room^Bed^Facility|AdmissionType|PreadmitNumber|PriorLocation|AttendingDoctor^LastName^FirstName|ReferringDoctor|ConsultingDoctor|HospitalService|TemporaryLocation|PreadmitTestIndicator|ReadmissionIndicator|AdmitSource|AmbulatoryStatus|VIPIndicator|AdmittingDoctor|PatientType|VisitNumber|FinancialClass
Key Fields :
Purpose : Extended visit information
Key Fields :
When asked to parse an HL7 IHE PAM message:
Split by segment terminator : segments = message.split('\r') or split('\n')
Parse MSH segment (always first):
^~\&|^~\&Identify message type : Check MSH-9
When parsing a message, provide:
### HL7 IHE PAM Message Analysis
**Raw Message**:
[original HL7 message with visible delimiters]
**Message Identification**:
- Message Type: ADT^A01
- Event Code: A01 (Admit/Visit Notification)
- Message Control ID: [MSH-10]
- Timestamp: [formatted MSH-7]
- Version: 2.5
**MSH - Message Header**:
- Sending Application: [MSH-3]
- Sending Facility: [MSH-4]
- Receiving Application: [MSH-5]
- Receiving Facility: [MSH-6]
- Processing ID: [MSH-11] (Production/Test)
**EVN - Event Type**:
- Event Code: [EVN-1]
- Recorded DateTime: [formatted EVN-2]
- Event Occurred: [formatted EVN-3]
- Operator: [EVN-5]
**PID - Patient Identification**:
- Patient ID: [PID-3]
- Patient Name: [formatted PID-5]
- Date of Birth: [formatted PID-7]
- Sex: [PID-8]
- Address: [formatted PID-11]
- Phone: [PID-13]
- [other relevant fields]
**PV1 - Patient Visit**:
- Patient Class: [PV1-2] ([description])
- Assigned Location: [formatted PV1-3]
- Attending Doctor: [formatted PV1-7]
- Hospital Service: [PV1-10]
- Visit Number: [PV1-19]
- Admit DateTime: [formatted PV1-44]
- [other relevant fields based on message type]
**PV2 - Additional Visit Info** (if present):
- Prior Location: [PV2-1]
- [other relevant fields]
**Business Context**:
[Explain what this message represents, the workflow event, and clinical significance]
**IHE PAM Compliance**:
- Required segments: [✓ or ✗ for MSH, EVN, PID, PV1]
- Required fields: [list of mandatory field validation results]
- Field formats: [✓ or ✗ for dates, codes, etc.]
| Code | Event Name | Purpose |
|---|---|---|
| A01 | Admit/Visit Notification | Patient admission to inpatient care |
| A02 | Transfer a Patient | Transfer between units/rooms |
| A03 | Discharge a Patient | Patient discharge from hospital |
| A04 | Register a Patient | Pre-admission or outpatient registration |
| A05 | Pre-admit a Patient | Notification of planned admission |
| A06 | Change Outpatient to Inpatient | Status change |
| A07 | Change Inpatient to Outpatient | Status change |
| A08 | Update Patient Information | Demographics update |
| A09 | Patient Departing - Tracking | Patient left facility temporarily |
| Code | Description |
|---|---|
| I | Inpatient |
| O | Outpatient |
| E | Emergency |
| P | Preadmit |
| R | Recurring patient |
| B | Obstetrics |
| C | Commercial Account |
| N | Not Applicable |
| U | Unknown |
| Code | Description |
|---|---|
| HOME | Home or self care |
| SNF | Skilled nursing facility |
| RH | Rehabilitation facility |
| EXP | Expired (deceased) |
| HOS | Hospice |
| AADVICE | Left against medical advice |
| OTH | Other |
|^~\& (encoding characters)|IHE PAM Specification :
HL7 v2.5 Standard :
Related Tools :
| Field delimiter
^ Component delimiter
~ Repetition delimiter
\ Escape character
& Subcomponent delimiter
MSH-9 : Message Type (ADT^A01^ADT_A01)
MSH-10 : Message Control ID
EVN-1 : Event Type Code (A01, A02, etc.)
EVN-2 : Recorded DateTime
PID-3 : Patient ID
PID-5 : Patient Name
PID-7 : Birth Date
PID-8 : Sex
PV1-2 : Patient Class (I/O/E)
PV1-3 : Assigned Location
PV1-19 : Visit Number
PV1-44 : Admit DateTime
PV1-45 : Discharge DateTime
Weekly Installs
74
Repository
GitHub Stars
2
First Seen
Jan 22, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
gemini-cli63
github-copilot63
codex62
opencode62
cursor61
claude-code56
飞书视频会议CLI工具:lark-vc技能详解,高效搜索与管理会议记录与纪要
36,800 周安装
Parse each segment :
|^~&Extract key fields :
Validate structure :
Generate explanation :
| A10 | Patient Arriving - Tracking | Patient returned to facility |
| A11 | Cancel Admit | Cancel previous admission |
| A12 | Cancel Transfer | Cancel previous transfer |
| A13 | Cancel Discharge | Cancel previous discharge |
| A21 | Patient Goes on Leave of Absence | Temporary leave |
| A22 | Patient Returns from Leave of Absence | Return from leave |
| A28 | Add Person Information | Add new person to database |
| A31 | Update Person Information | Update person demographics |