Exemplo n.º 1
0
        public IntoHospital GetIntoHospital(Request request)
        {
            string sqlBak = $"select top 1 * from(select 病人编号,住院号,姓名,入院日期,医保类型,性别,身份证号,年龄,出生日期,民族,婚否,职业,电话,家庭住址,联系人,联系人地址,联系电话,关系,入院诊断,病情,确诊诊断,出院日期,医师代码,科室,病室,床位 from ZY_病案库 where 住院号<>'0') as BAK where  住院号='{request.InPatientNo}' and 身份证号='{request.IdentCard}' order by 入院日期 desc";

            DataTable dtBak = SqlCommon.ExecuteSqlToDataSet(SqlCommon.GetConnectionStringFromConnectionStrings("HisConnectionString"), sqlBak).Tables[0];

            if (dtBak != null && dtBak.Rows.Count > 0)
            {
                string    sqlPatBaseInf = $"select top 1 * from (select patId,PatName,MainNarrative,InDate,Diagnosis1 from EH_PatBasInf union select patId,PatName,MainNarrative,InDate,Diagnosis1 from EH_PatBasInfOut) as EH_PatBasInf where PatId='{dtBak.Rows[0]["住院号"].ToString()}' order by InDate desc";
                DataTable dtPatBaseInf  = SqlCommon.ExecuteSqlToDataSet(SqlCommon.GetConnectionStringFromConnectionStrings("DzblConnectionString"), sqlPatBaseInf).Tables[0];

                IntoHospital intoHospital = new IntoHospital
                {
                    HospitalId           = ConfigurationManager.AppSettings["HospitalId"],
                    HospitalName         = ConfigurationManager.AppSettings["HospitalName"],
                    PatientName          = dtBak.Rows[0]["姓名"].ToString(),
                    PatientAge           = dtBak.Rows[0]["年龄"].ToString(),
                    IdentCard            = dtBak.Rows[0]["身份证号"].ToString(),
                    GenderValue          = dtBak.Rows[0]["性别"].ToString() == "男" ? "1" : "0",
                    Rcvdate              = Convert.ToDateTime(dtBak.Rows[0]["入院日期"]).ToString("yyyy-MM-dd"),
                    ActionInChief        = dtPatBaseInf != null && dtPatBaseInf.Rows.Count > 0 && dtPatBaseInf.Rows[0]["MainNarrative"].ToString() != "" ? dtPatBaseInf.Rows[0]["MainNarrative"].ToString() : "暂无",
                    AllergicHistory      = "暂无",
                    HisPresentIllness    = "暂无",
                    PastHistory          = "暂无",
                    PersonalHistory      = "暂无",
                    FamilyHistory        = "暂无",
                    RecordDate           = Convert.ToDateTime(dtBak.Rows[0]["入院日期"]).ToString("yyyy-MM-dd"),
                    PhysicalExamination  = "暂无",
                    AssistantExamination = "暂无",
                    PrimaryDiagnosis     = dtBak.Rows[0]["入院诊断"].ToString(),
                    Process              = null,
                    BloodAmylase         = null,
                    UrineRoutines        = null,
                    AmylaseInUrine       = null,
                    BloodRoutine         = null,
                    ColorUltrasound      = null,
                    DischargeDiagnosis   = dtBak.Rows[0]["确诊诊断"].ToString(),
                    Recoder              = dtBak.Rows[0]["医师代码"].ToString(),
                    RecordingTime        = Convert.ToDateTime(dtBak.Rows[0]["入院日期"]).ToString("yyyy-MM-dd hh:mm:ss"),
                    T           = null,
                    P           = null,
                    R           = null,
                    Bp          = null,
                    Other1      = null,
                    Other2      = null,
                    Other3      = null,
                    Other4      = null,
                    Other5      = null,
                    PID         = dtBak.Rows[0]["病人编号"].ToString(),
                    InpatientNo = dtBak.Rows[0]["住院号"].ToString(),
                    DzjkNo      = null
                };

                return(intoHospital);
            }
            else
            {
                return(null);
            }
        }
        public string GetIntoHospitalList(string requestXml)
        {
            string doc;

            try
            {
                Request         request         = RequestHelper.GetRequest(requestXml);
                IntoHospitalBll intoHospitalBll = new IntoHospitalBll();
                IntoHospital    intoHospital    = intoHospitalBll.GetIntoHospital(request);

                if (intoHospital is null)
                {
                    XDocument xDoc = new XDocument
                                     (
                        new XDeclaration("1.0", "utf-8", "yes"),
                        new XElement
                        (
                            "response",
                            new XElement("resultCode", 1),
                            new XElement("resultMsg", "未能查询到患者入院记录!"),
                            new XElement("resultContent")
                        )
                                     );
                    doc = xDoc.ToString();
                }
                else
                {
                    doc = intoHospitalBll.ConvertIntoHospitalToXml(intoHospital);
                }
            }
            catch (Exception)
            {
                XDocument xDoc = new XDocument
                                 (
                    new XDeclaration("1.0", "utf-8", "yes"),
                    new XElement
                    (
                        "response",
                        new XElement("resultCode", 1),
                        new XElement("resultMsg", "系统出现内部错误!"),
                        new XElement("resultContent")
                    )
                                 );
                doc = xDoc.ToString();

                return(doc);
            }
            return(doc);
        }
        public string ConvertIntoHospitalToXml(IntoHospital intoHospital)
        {
            //XmlDocument xmlDoc = new XmlDocument();

            XDocument xDoc = new XDocument
                             (
                new XDeclaration("1.0", "utf-8", "yes"),
                new XElement
                (
                    "response",
                    new XElement("resultCode", 0),
                    new XElement("resultMsg", "获取患者入院记录成功!"),
                    new XElement
                    (
                        "resultContent",
                        new XElement("hospitalId", intoHospital.HospitalId),
                        new XElement("hospitalName", intoHospital.HospitalName),
                        new XElement("patientName", intoHospital.PatientName),
                        new XElement("patientAge", intoHospital.PatientAge),
                        new XElement("identCard", intoHospital.IdentCard),
                        new XElement("genderValue", intoHospital.GenderValue),
                        new XElement("rcvDate", intoHospital.Rcvdate),
                        new XElement("actionInChief", intoHospital.ActionInChief),
                        new XElement("allergicHistory", intoHospital.AllergicHistory),
                        new XElement("hisPresentIllness", intoHospital.HisPresentIllness),
                        new XElement("pastHistory", intoHospital.PastHistory),
                        new XElement("personalHistory", intoHospital.PersonalHistory),
                        new XElement("familyHistory", intoHospital.FamilyHistory),
                        new XElement("recordDate", intoHospital.RecordDate),
                        new XElement("physicalExamination", intoHospital.PhysicalExamination),
                        new XElement("assistantExamination", intoHospital.AssistantExamination),
                        new XElement("primaryDiagnosis", intoHospital.PrimaryDiagnosis),
                        new XElement("process", intoHospital.Process),
                        new XElement("bloodRoutine", intoHospital.BloodRoutine),
                        new XElement("urineRoutines", intoHospital.UrineRoutines),
                        new XElement("amylaseInUrine", intoHospital.AmylaseInUrine),
                        new XElement("bloodAmylase", intoHospital.BloodAmylase),
                        new XElement("colorUltrasound", intoHospital.ColorUltrasound),
                        new XElement("dischargeDiagnosis", intoHospital.DischargeDiagnosis),
                        new XElement("recoder", intoHospital.Recoder),
                        new XElement("recordingTime", intoHospital.RecordingTime),
                        new XElement("t", intoHospital.T),
                        new XElement("p", intoHospital.P),
                        new XElement("r", intoHospital.R),
                        new XElement("bp", intoHospital.Bp),
                        new XElement("other1", intoHospital.Other1),
                        new XElement("other2", intoHospital.Other2),
                        new XElement("other3", intoHospital.Other3),
                        new XElement("other4", intoHospital.Other4),
                        new XElement("other5", intoHospital.Other5),
                        new XElement("pid", intoHospital.PID),
                        new XElement("inPatientNo", intoHospital.InpatientNo),
                        new XElement("dzjkNo", intoHospital.DzjkNo)
                    )
                )
                             );

            //xmlDoc.LoadXml(xDoc.ToString());

            return(xDoc.ToString());
        }