Exemple #1
0
        private string GetXml(T_SQD sqd)
        {
            string xml = "";

            try
            {
                var bbxx = GetBbxx(sqd.F_SQXH);

                xml = "<?xml version=" + (char)34 + "1.0" + (char)34 + " encoding=" + (char)34 + "gbk" + (char)34 +
                      "?>";
                xml = xml + "<LOGENE>";
                xml = xml + "<row ";
                xml = xml + "病人编号=" + (char)34 + sqd.F_BRBH + (char)34 + " ";
                xml = xml + "就诊ID=" + (char)34 + sqd.F_YZID + (char)34 + " ";
                xml = xml + "申请序号=" + (char)34 + sqd.F_SQXH + (char)34 + " ";
                xml = xml + "门诊号=" + (char)34 + sqd.F_MZH + (char)34 + " ";
                xml = xml + "住院号=" + (char)34 + sqd.F_ZYH + (char)34 + " ";
                xml = xml + "姓名=" + (char)34 + sqd.F_XM + (char)34 + " ";
                xml = xml + "性别=" + (char)34 + sqd.F_XB + (char)34 + " ";
                xml = xml + "年龄=" + (char)34 + sqd.F_NL + (char)34 + " ";
                xml = xml + "婚姻=" + (char)34 + sqd.F_HY + (char)34 + " ";
                xml = xml + "地址=" + (char)34 + sqd.F_DZ + (char)34 + " ";
                xml = xml + "电话=" + (char)34 + sqd.F_DH + (char)34 + " ";
                xml = xml + "病区=" + (char)34 + sqd.F_BQ + (char)34 + " ";
                xml = xml + "床号=" + (char)34 + sqd.F_CH + (char)34 + " ";
                xml = xml + "身份证号=" + (char)34 + sqd.F_SFZH + (char)34 + " ";
                xml = xml + "民族= " + (char)34 + sqd.F_MZ + (char)34 + " ";
                xml = xml + "职业=" + (char)34 + sqd.F_ZY + (char)34 + " ";
                xml = xml + "送检科室=" + (char)34 + sqd.F_SQKS + (char)34 + " ";
                xml = xml + "送检医生=" + (char)34 + sqd.F_SQYS + (char)34 + " ";
                xml = xml + "收费=" + (char)34 + sqd.F_SFZH + (char)34 + " ";

                xml = xml + "标本名称=" + (char)34 + bbxx.Bbmc + (char)34 + " ";
                xml = xml + "送检医院=" + (char)34 + "" + (char)34 + " ";
                xml = xml + "医嘱项目=" + (char)34 + sqd.F_YZXM + (char)34 + " ";
                xml = xml + "备用1=" + (char)34 + "" + (char)34 + " ";
                xml = xml + "备用2=" + (char)34 + "" + (char)34 + " ";
                xml = xml + "费别=" + (char)34 + "" + (char)34 + " ";
                xml = xml + "病人类别=" + (char)34 + sqd.F_BRLB + (char)34 + " ";
                xml = xml + "/>";
                xml = xml + "<临床病史><![CDATA[" + "" + "]]></临床病史>";
                xml = xml + "<临床诊断><![CDATA[" + sqd.F_LCZD + "]]></临床诊断>";
                xml = xml + bbxx.Xml;
                xml = xml + "</LOGENE>";
            }
            catch (Exception e)
            {
                //log.解析返回的xml失败
                log.WriteMyLog("解析接口返回的xml时出错:" + e.Message);
                return("0");
            }
            return(xml);
        }
Exemple #2
0
 protected virtual void OnItemSelected(T_SQD obj)
 {
     SelectedSqd = obj;
     ItemSelected?.Invoke(obj);
     Close();
 }
Exemple #3
0
        private void dataGridView1_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            T_SQD sqd = (T_SQD)dataGridView1.Rows[e.RowIndex].DataBoundItem;

            OnItemSelected(sqd);
        }
Exemple #4
0
        private static void SaveRequestMessage(string requestXml)
        {
            HL7v2Reader reader = new HL7v2Reader(requestXml);

            //患者信息
            var pid = reader["PID"][0];
            //挂号信息
            var pv1 = reader["PV1"][0];
            //申请单信息
            var orc     = reader["ORC"][0];
            var dg1List = reader["DG1"];
            //医嘱信息列表
            var obrList = reader["OBR"];

            _mshCode = reader["MSH"][0][10][0];

            T_SQD sqd = new T_SQD();

            sqd.F_msgxml = reader.HL7String;
            sqd.F_SQRQ   = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            sqd.F_BRBH   = pid[2][0];  //患者id
            sqd.F_JZH    = pv1[19][0]; //就诊ID
            sqd.F_SQXH   = orc[2][0];  //申请单ID
            var pType = pv1[2][0];     //E:急诊 I: 住院 O:门诊 T:体检

            switch (pType)
            {
            case "I":     //住院
                sqd.F_ZYH  = pv1[19][0];
                sqd.F_BRLB = "住院";
                break;

            case "E":
                sqd.F_MZH  = pv1[19][0];
                sqd.F_BRLB = "急诊";
                break;

            case "O":
                sqd.F_MZH  = pv1[19][0];
                sqd.F_BRLB = "门诊";
                break;

            case "T":
                sqd.F_MZH  = pv1[19][0];
                sqd.F_BRLB = "体检";
                break;

            default:
                sqd.F_MZH  = pv1[19][0];
                sqd.F_BRLB = "其他";
                break;
            }
            sqd.F_XM   = pid[5][1]; //姓名
            sqd.F_XBBM = pid[8][0]; //性别 F: Female M:Male O: Others 其余见HL7 定义
            switch (sqd.F_XBBM)
            {
            case "F":
                sqd.F_XB = "女";
                break;

            case "M":
                sqd.F_XB = "男";
                break;

            default:
                sqd.F_XB = "其它";
                break;
            }
            var nlString = pid[7][0];               //年龄 根据出生日期计算 yyyyMMddhhmmss,取年的整数

            sqd.F_CSRQ = pid[7][0].Substring(0, 8); //出生日期
            try
            {
                sqd.F_NL =
                    (DateTime.Now.Year - DateTime.ParseExact(nlString, "yyyyMMddHHmmss", CultureInfo.CurrentCulture).Year)
                    .ToString();
            }
            catch (Exception)
            {
            }
            var hy = pid[16][0]; //婚姻 M^己婚或 S^未婚或 O^其他

            switch (hy)
            {
            case "M":
                hy = "已婚";
                break;

            case "S":
                hy = "未婚";
                break;

            default:
                hy = "其他";
                break;
            }
            sqd.F_HY = hy;

            sqd.F_DZ     = pid[11][0]; //地址
            sqd.F_DH     = pid[13][6]; //电话
            sqd.F_BQ     = pv1[3][0];  //病区
            sqd.F_CH     = pv1[3][2];  //床号
            sqd.F_SFZH   = pid[19][0]; //身份证号
            sqd.F_SQYSBM = orc[17][0]; //开单医生编码
            sqd.F_SQKS   = orc[17][1]; //开单科室
            sqd.F_SQYS   = orc[12][2]; //开单医生
            sqd.F_SFZH   = orc[20][0]; //总费用
            if (dg1List.Any())
            {
                try
                {
                    sqd.F_LCZD = dg1List[0][4][0];
                }
                catch (Exception)
                {
                }
            }



            var dbContext = ContextPool.GetContext();

            foreach (Segment obr in obrList)
            {
                var sqdClone = sqd.Clone();
                sqdClone.F_YZID = obr[4][0];
                sqdClone.F_YZXM = obr[4][1];
                dbContext.T_SQD.Add(sqdClone);
            }
            dbContext.SaveChanges();
        }