Esempio n. 1
0
        public DataTable GetPaiban(paibanModel pb, string tableName)
        {
            string SQL_PAIBAN = "select * from " + tableName + " where patid='" + pb.PATID + "'";
            string INSERT     = string.Format(SQL_PAIBAN);

            return(GetDataTable(INSERT));
        }
Esempio n. 2
0
        public int InsertPaiban(paibanModel pb, string tableName)
        {
            string SQL_PAIBAN = "insert into " + tableName + " (PatientNo,applyid,Cardno, PatZhuYuanID,IsZhuYuan, Patname,Patage,Patsex,patWeight,patHeight,patdpm,Pattmd,Oname,Odate,ApplyDate,os,OsNo,OA1,OA2,OA3,OA1No,OA2No,OA3No,Amethod,Patbedno,patid,asae,operaddress,ostate,oroom,ap1,ap2,ap3,sn1,sn2,on1,on2)"
                                + "values('" + pb.PatientNo + "','" + pb.applyID + "','" + pb.cardNO + "','" + pb.zhuyuanNO + "','" + pb.IsZhuYuan + "','" + pb.patName + "','" + pb.patage + "','" + pb.patsex + "','" + pb.Weight + "','" + pb.Height + "','" + pb.patdpm + "','" + pb.SQZD + "','" + pb.Oname + "','" + pb.Odate + "','" + pb.ApplyDate + "',"
                                + "'" + pb.OS + "','" + pb.OsNo + "','" + pb.OA1 + "','" + pb.OA2 + "','" + pb.OA3 + "','" + pb.OA1No + "','" + pb.OA2No + "','" + pb.OA3No + "','" + pb.MZFA + "','" + pb.BedNo + "','" + pb.PATID + "','" + pb.ASAE + "','" + pb.operAddress + "','0','','','','','','','','')";
            string INSERT = string.Format(SQL_PAIBAN);

            SaveLog(INSERT);
            return(ExecuteNonQuery(INSERT));
        }
Esempio n. 3
0
        public int UpdatePaibanAll(paibanModel pb, string tableName)
        {
            string SQL_PAIBAN = "Update " + tableName + " set   PatientNo='" + pb.PatientNo + "',applyid='" + pb.applyID + "',Cardno='" + pb.cardNO + "', PatZhuYuanID='" + pb.zhuyuanNO + "',"
                                + "IsZhuYuan='" + pb.IsZhuYuan + "', Patname='" + pb.patName + "',Patage='" + pb.patage + "',Patsex='" + pb.patsex + "',patWeight='" + pb.Weight + "',"
                                + "patHeight='" + pb.Height + "',patdpm='" + pb.patdpm + "',Pattmd='" + pb.SQZD + "',Oname='" + pb.Oname + "',os='" + pb.OS + "',Odate='" + pb.Odate + "',ApplyDate='" + pb.ApplyDate + "',"
                                + "OsNo='" + pb.OsNo + "',OA1='" + pb.OA1 + "',OA2='" + pb.OA2 + "',OA3='" + pb.OA3 + "',OA1No='" + pb.OA1No + "',OA2No='" + pb.OA2No + "',OA3No='" + pb.OA3No + "',"
                                + "Amethod='" + pb.MZFA + "',Patbedno='" + pb.BedNo + "',asae='" + pb.ASAE + "',operaddress='" + pb.operAddress + "' where patid='" + pb.PATID + "'";
            string INSERT = string.Format(SQL_PAIBAN);

            SaveLog(INSERT);
            return(ExecuteNonQuery(INSERT));
        }
Esempio n. 4
0
        public static paibanModel toDataBae(string sHL7)
        {
            //把HL7分成段

            string Old = sHL7;

            if (Old.Contains("ARQ|"))
            {
                Old = Old.Replace("ARQ|", "\nARQ|");
            }
            if (Old.Contains("PID|"))
            {
                Old = Old.Replace("PID|", "\nPID|");
            }
            if (Old.Contains("PV1|"))
            {
                Old = Old.Replace("PV1|", "\nPV1|");
            }
            if (Old.Contains("AIS|"))
            {
                Old = Old.Replace("AIS|", "\nAIS|");
            }
            if (Old.Contains("OBX|1|"))
            {
                Old = Old.Replace("OBX|1|", "\nOBX|1|");
            }
            if (Old.Contains("OBX|2|"))
            {
                Old = Old.Replace("OBX|2|", "\nOBX|2|");
            }
            if (Old.Contains("AIP|"))
            {
                Old = Old.Replace("AIP|", "\nAIP|");
            }
            if (Old.Contains("DG1|"))
            {
                Old = Old.Replace("DG1|", "\nDG1|");
            }
            if (Old.Contains("RGS|"))
            {
                Old = Old.Replace("RGS|", "\nRGS|");
            }

            string[]    sHL7Lines = Old.Split('\n');
            paibanModel pb        = new paibanModel();

            #region HIS平台提供信息解析
            for (int i = 0; i < sHL7Lines.Length; i++)
            {
                // 判断是否空行
                if (sHL7Lines[i].Contains("ARQ|"))
                {
                    string[] sList = sHL7Lines[i].Split('|');
                    pb.PATID = sList[1].Replace("^", "");
                    string[] dateList = sList[11].Split('^');
                    DateTime dtOdate  = DateTime.ParseExact(dateList[0].Replace("^", "").Trim().Substring(0, 8), "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);
                    pb.Odate = dtOdate;
                    DateTime dtApplyDate = DateTime.ParseExact(dateList[1].Replace("^", ""), "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture);
                    pb.ApplyDate = dtApplyDate;
                    string[] nameList = sList[5].Split('^');
                    if (nameList.Length > 1)
                    {
                        pb.MZFA = nameList[1];
                    }
                }
                if (sHL7Lines[i].Contains("PID|"))
                {
                    pb.PidInfo = sHL7Lines[i];
                    string[] sList = sHL7Lines[i].Split('|');
                    pb.PatientNo = sList[2].Split('^')[0];
                    string[] idList = sList[3].Split('~');
                    pb.applyID   = idList[0].Split('^')[0];
                    pb.zhuyuanNO = idList[1].Split('^')[0];
                    pb.cardNO    = idList[2].Split('^')[0];

                    string[] nameList = sList[5].Split('^');
                    pb.patName = nameList[1];

                    string   str  = sList[7].Trim().Substring(0, 8);
                    DateTime now  = DateTime.Today;
                    DateTime bday = DateTime.ParseExact(str, "yyyyMMdd", null);
                    int      age  = now.Year - bday.Year;
                    pb.patage = age.ToString();
                    string[] sexList = sList[8].Split('^');
                    pb.patsex = sexList[0];
                    if (pb.patsex == "M")
                    {
                        pb.patsex = "男";
                    }
                    else
                    {
                        pb.patsex = "女";
                    }
                    //pb.patMinZu = sList[22].Split('^')[1];
                }

                if (sHL7Lines[i].Contains("OBX|1|"))
                {
                    string[] sList = sHL7Lines[i].Split('|');
                    pb.Weight = sList[5];
                }

                if (sHL7Lines[i].Contains("OBX|2|"))
                {
                    string[] sList = sHL7Lines[i].Split('|');
                    pb.Height = sList[5];
                }
                if (sHL7Lines[i].Contains("PV1|"))
                {
                    pb.Pv1Info = sHL7Lines[i];
                    string[] sList = sHL7Lines[i].Split('|');
                    if (sList[2] == "I")
                    {
                        pb.IsZhuYuan = "1";
                    }
                    else if (sList[2] == "O")
                    {
                        pb.IsZhuYuan = "0";
                    }
                    else
                    {
                        pb.IsZhuYuan = "0";
                        pb.ASAE      = "1";
                    }

                    string[] bedList = sList[3].Split('^');
                    pb.BedNo = bedList[4];
                    string[] dpmList = bedList[3].Split('&');

                    pb.patdpm = dpmList[1];
                    if (bedList[0].Trim().Length > 6)
                    {
                        pb.operAddress = bedList[0].Trim().Substring(0, 6);
                    }
                    else
                    {
                        pb.operAddress = bedList[0].Trim();
                    }
                    pb.applyID = sList[19];
                }
                if (sHL7Lines[i].Contains("DG1|"))
                {
                    string[] sList = sHL7Lines[i].Split('|');
                    pb.SQZD = sList[4];
                }
                if (sHL7Lines[i].Contains("AIS|"))
                {
                    string[] sList    = sHL7Lines[i].Split('|');
                    string[] nameList = sList[3].Split('^');
                    pb.OperNo = nameList[0];
                    pb.Oname  = nameList[1];
                }

                if (sHL7Lines[i].Contains("AIP|1|"))
                {
                    string[] sList  = sHL7Lines[i].Split('|');
                    string[] osList = sList[3].Split('^');
                    try
                    {
                        pb.OsNo = osList[0];
                        pb.OS   = osList[2];
                    }
                    catch (Exception)
                    {
                        pb.OsNo = string.Empty;
                        pb.OS   = string.Empty;
                    }
                }
                if (sHL7Lines[i].Contains("AIP|7|"))
                {
                    string[] sList  = sHL7Lines[i].Split('|');
                    string[] osList = sList[3].Split('^');
                    try
                    {
                        pb.OA1No = osList[0];
                        pb.OA1   = osList[2];
                    }
                    catch (Exception)
                    {
                        pb.OA1No = string.Empty;
                        pb.OA1   = string.Empty;
                    }
                }
                if (sHL7Lines[i].Contains("AIP|8|"))
                {
                    string[] sList  = sHL7Lines[i].Split('|');
                    string[] osList = sList[3].Split('^');
                    try
                    {
                        pb.OA2No = osList[0];
                        pb.OA2   = osList[2];
                    }
                    catch (Exception)
                    {
                        pb.OA2No = string.Empty;
                        pb.OA2   = string.Empty;
                    }
                }

                if (sHL7Lines[i].Contains("AIP|9|"))
                {
                    string[] sList  = sHL7Lines[i].Split('|');
                    string[] osList = sList[3].Split('^');
                    try
                    {
                        pb.OA3No = osList[0];
                        pb.OA3   = osList[2];
                    }
                    catch (Exception)
                    {
                        pb.OA3No = string.Empty;
                        pb.OA3   = string.Empty;
                    }
                }
            }
            #endregion



            return(pb);
        }