医疗软件技术基础实验报告-HL7信息解析.docxVIP

  • 6
  • 0
  • 约1.72千字
  • 约 4页
  • 2023-09-16 发布于浙江
  • 举报

医疗软件技术基础实验报告-HL7信息解析.docx

19学年—20学年第 2 学期 医疗软件技术基础 实验四 专业名称: 生物医学工程 实验学时: 2 学号: 姓名: 实验题目:HL7信息解析 实验环境: vc6.0   实验目的: 1.掌握HL7信息的基本结构; 2.掌握二叉树结构在解析HL7信息中的应用。 实验内容: 实现一个HL7信息解析解析系统,系统包括以下功能: (1) 读取HL7字符信息信息 (2) 建立二叉树对HL7信息中的各种层次信息进行读取。 (3) 按层次打印HL7信息。 实验要求: (1) 程序要添加适当的注释,程序的书写要采用缩进格式。 (2) 根据实验报告模板详细书写实验报告,在实验报告中给出算法的流程图。 实验程序及注释: #include?hl7.h int?main?() { ??struct?hl7_part_t?*msgs; ??struct?hl7_location_t?*location; ??struct?hl7_location_t?*current; ??char?s[16000]; ??char?*s2,?*s3,?*s4; ??FILE?*stream;//文件流 ??int?i; ??if?(!(current?=?location?=?(struct?hl7_location_t?*)malloc(sizeof(struct?hl7_location_t)))){exit?(1);} ??current-next??=?(struct?hl7_location_t?*)?0;//???????? ??current-count?=?0; ??for(i=0?;?i3?;?i++){ ????if?(!(current-next?=?(struct?hl7_location_t?*)malloc(sizeof(struct?hl7_location_t)))){exit?(1);} ????current????????=?current-next; ????current-next??=?(struct?hl7_location_t?*)?0; ????current-count?=?0; ??} //4?? ??location-count=0; ??location-next-count=1; ??location-next-next-count=5;//该文件结构未0-0-5-0-0,但在该程序中,以上十行没有用到可以删除,下面的操作才是有效的 ????if((stream?=?fopen?(msgs.hl7,?r))?!=?(FILE?*)0)?{//读取HL7源文件 ????fgets(s,?16000,?stream);//得16000字节的数据变换为字符形式 // ?????????msgs?=?str2hl7?(s);//将字符串变为HL7格式 ?????????s2=hl72str(msgs);//将HL7格式再变为字符串格式 ?????printf(%s,s2);//打印hl7中未解析前信息 ?????????hl7print?(msgs);//打印HL7解析后的信息 ??????? ????}?else?{ ?????????exit(1); ????} ??exit?(0); }??/*?end?main?*/ 实验结果: 流程图: 开始 开始 读入HL7源文件 HL7源文件读16000到字符串S1 S1做解析,成msgs 输出S1,即HL7中原始内容 输出解析后的内容 结束 实验小结: 我通过本次的实验,我了解HL7解析的基本结构,hl7采取树状结构,大体分为五层,数据都放在子成分中。消息之间以回车符CR分割,字段之间以|分割,成分用^子成分用。这样子的语法规则给hl7的编码和解析提供了理论依据

文档评论(0)

1亿VIP精品文档

相关文档