Esempio n. 1
0
 /// <summary>
 /// 保存病人资料
 /// </summary>
 /// <param name="pat"></param>
 /// <returns></returns>
 public int SavePatInfo(ref EntityPatientInfo pat)
 {
     using (BizDictionary biz = new BizDictionary())
     {
         return(biz.SavePatInfo(ref pat));
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Delete
        /// </summary>
        internal void Delete()
        {
            EntityPatientInfo patOrig = Viewer.txtCardNo.Tag as EntityPatientInfo;

            if (patOrig == null || string.IsNullOrEmpty(patOrig.pid))
            {
                Clear();
                return;
            }
            if (DialogBox.Msg("确定是否删除?", MessageBoxIcon.Question) == DialogResult.Yes)
            {
                ProxyDictionary proxy = new ProxyDictionary();
                int             ret   = proxy.Service.DelPatInfo(patOrig.pid);
                proxy = null;
                if (ret > 0)
                {
                    Clear();
                    Viewer.ValueChanged = false;
                    DialogBox.Msg("删除患者信息成功!");
                }
                else
                {
                    DialogBox.Msg("删除患者信息失败。");
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// SetPatValue
        /// </summary>
        #region
        void SetPatValue(EntityPatientInfo pat)
        {
            ClearCntrValue(this.pcConent);
            using (ProxyAdverseEvent proxy = new ProxyAdverseEvent())
                this.gvSampleBindingSource.DataSource = proxy.Service.GetPathogeny(-1);

            if (this.txtIpNo.Visible == true)
            {
                this.txtIpNo.Visible    = false;
                this.txtInpatid.Visible = true;
            }
            else
            {
                this.txtIpNo.Visible    = true;
                this.txtInpatid.Visible = false;
            }

            if (this.txtInpatid.Visible == false)
            {
                this.txtInpatid.Visible = true;
                this.txtIpNo.Visible    = true;
            }


            this.txtName.Tag     = pat;
            this.txtInpatid.Text = pat.ipNo;
            this.txtIpNo.Text    = pat.ipNo;
            this.txtName.Text    = pat.name;
            this.txtSex.Text     = pat.sexCH;
            this.cboPatDept.Text = pat.deptName;
            this.cboPatDept.Properties.Items.Clear();
            this.txtBedNo.Text         = pat.bedNo;
            this.txtAge.Text           = pat.age;
            this.txtDoctor.Text        = pat.doctName;
            this.dteInDate.Text        = pat.inDate.ToString();
            this.mmtDiagnose.Text      = pat.email;
            this.txtOperationName.Text = pat.upFlag;
            this.dteOperationDate.Text = pat.zip.ToString();

            if (pat.tremType == "0")
            {
                this.chk01.Checked = true;
            }
            else if (pat.tremType == "I")
            {
                this.chk02.Checked = true;
            }
            else if (pat.tremType == "II")
            {
                this.chk03.Checked = true;
            }
            else if (pat.tremType == "III")
            {
                this.chk04.Checked = true;
            }
        }
Esempio n. 4
0
        /// <summary>
        /// SetPatValue
        /// </summary>
        /// <param name="pat"></param>
        void SetPatValue(EntityPatientInfo pat)
        {
            Viewer.txtPatName.Tag      = pat;
            Viewer.txtPatName.Text     = pat.name;
            Viewer.txtSex.Text         = pat.sexCH;
            Viewer.txtBirthday.Text    = string.IsNullOrEmpty(pat.birth) ? "" : Function.Datetime(pat.birth).ToString("yyyy-MM-dd");
            Viewer.txtContactAddr.Text = pat.contAddr;

            #region 全局Patient.赋值

            GlobalPatient.currPatient             = new EntityPatient();
            GlobalPatient.currPatient.PatientName = pat.name;
            GlobalPatient.currPatient.Sex         = pat.sex;
            if (!string.IsNullOrEmpty(pat.birth))
            {
                GlobalPatient.currPatient.Birthday = Function.Datetime(pat.birth);
            }
            GlobalPatient.currPatient.PatientIpNo = pat.ipNo;
            GlobalPatient.currPatient.IpTimes     = pat.ipTimes;
            GlobalPatient.currPatient.Indate      = pat.inDate;
            GlobalPatient.currPatient.BedNo       = pat.bedNo;
            if (pat.inDate != null)
            {
                GlobalPatient.currPatient.RegisterDate = pat.inDate.Value;
            }
            GlobalPatient.currPatient.DeptName = pat.deptName;
            GlobalPatient.currPatient.DoctName = pat.doctName;
            GlobalPatient.currPatient.OutDate  = pat.outDate;
            //GlobalPatient.currPatient.BirthPlace = Viewer.PatVo.birthPlace;
            GlobalPatient.currPatient.HomeAddr = pat.contAddr;
            GlobalPatient.currPatient.HomeTel  = pat.contTel;
            //GlobalPatient.currPatient.ContactName = Viewer.PatVo.contactPerson;
            GlobalPatient.currPatient.IdCard = pat.ID;
            //GlobalPatient.currPatient.patHkadr = Viewer.PatVo.registerAddr;

            GlobalPatient.currPatient.PatientOpNo = pat.cardNo;

            GlobalPatient.currPatient.RegisterID = pat.ID;

            GlobalCase.caseInfo          = new EntityCaseInfo();
            GlobalCase.caseInfo.CaseCode = this.EventDisplayVo.eventId;

            if (this.EventDisplayVo.eventId == "13")
            {
                Viewer.showPanelForm.SetFieldValue("X020", pat.corp);
                Viewer.showPanelForm.SetFieldValue("X024", Viewer.txtCardNo.Text);
            }

            //Viewer.showPanelForm.RefreshPatInfo();

            #endregion
        }
Esempio n. 5
0
        /// <summary>
        /// EditRpt
        /// </summary>
        #region
        void EditRpt()
        {
            EntityPatientInfo pat = new EntityPatientInfo();

            vo = GetRowObject();
            decimal rptId = vo.rptId;

            using (ProxyAdverseEvent proxy = new ProxyAdverseEvent())
            {
                this.gvSampleBindingSource.DataSource = proxy.Service.GetPathogeny(rptId);
            }

            this.txtAge.Text     = vo.patAge;
            this.txtBedNo.Text   = vo.bedNo;
            this.txtInpatid.Text = vo.inpatNo;
            this.txtIpNo.Text    = vo.inpatNo;
            this.cboPatDept.Text = vo.deptName;
            this.cboPatDept.Properties.Items.Clear();
            this.txtName.Text     = vo.patName;
            this.txtSex.Text      = vo.patSex;
            this.dteInDate.Text   = vo.dateIn.ToString();
            this.mmtDiagnose.Text = vo.inDiagnosis;
            if (vo.incisionType == 1)
            {
                this.chk01.Checked = true;
            }
            if (vo.incisionType == 2)
            {
                this.chk02.Checked = true;
            }
            if (vo.incisionType == 3)
            {
                this.chk03.Checked = true;
            }
            if (vo.incisionType == 4)
            {
                this.chk04.Checked = true;
            }

            this.cboInfectionSite01.Text = vo.infectionSite01;
            this.cboInfectionSite01.Properties.Items.Clear();
            this.cboInfectionSite02.Text = vo.infectionSite02;
            this.cboInfectionSite02.Properties.Items.Clear();
            this.dteInfection01.Text = vo.infectionDate01.ToString();
            this.dteInfection02.Text = vo.infectionDate02.ToString();
            this.cboCausation.Text   = vo.infectionReason;
            this.cboCausation.Properties.Items.Clear();
            this.txtDoctor.Text        = vo.doctName;
            this.dteOperationDate.Text = vo.operationDate.ToString();
            this.txtOperationName.Text = vo.operationName;
            this.txtName.Tag           = pat;
        }
Esempio n. 6
0
        /// <summary>
        /// SetPatInfo
        /// </summary>
        /// <param name="pat"></param>
        void SetPatInfo(EntityPatientInfo pat)
        {
            Viewer.txtCardNo.Tag             = pat;
            Viewer.dteFirst.EditValue        = DateTime.Now;
            Viewer.txtOpNo.Text              = pat.clNo;
            Viewer.txtIpNo.Text              = pat.ipNo;
            Viewer.txtCardNo.Text            = pat.cardNo;
            Viewer.txtPatName.Text           = pat.name;
            Viewer.cboSex.Text               = pat.sexCH;
            Viewer.lueFee.Properties.DBValue = pat.feeCode;
            SetLueFee(pat.feeCode);
            Viewer.txtIdNo.Text  = pat.ID;
            Viewer.dteBirth.Text = pat.birth;
            Viewer.cboBlood.Text = string.Empty;
            Viewer.lueMarry.Properties.DBValue = pat.marry;
            SetLueMarry(pat.marry);
            Viewer.txtHomeAddr.Text         = pat.addr;
            Viewer.txtWorkAddr.Text         = pat.corp;
            Viewer.txtContactPerson.Text    = pat.contact;
            Viewer.txtContactPersonTel.Text = pat.cTel;
            Viewer.cboContackRel.Text       = pat.relation;
            Viewer.cboStatus.SelectedIndex  = (string.IsNullOrEmpty(pat.lockFlag) && pat.lockFlag.ToUpper() == "T" ? 0 : 1);
            Viewer.chkAllergic1.Checked     = false;
            Viewer.chkAllergic2.Checked     = true;
            Viewer.chkIsAutoGen1.Checked    = false;
            Viewer.chkIsAutoGen2.Checked    = true;
            Viewer.txtAllergicDrug.Text     = string.Empty;

            Viewer.lueCitizenship.Properties.DBValue = pat.country;
            SetLueCountry(pat.country);
            Viewer.lueNation.Properties.DBValue = pat.nation;
            SetLueNation(pat.nation);
            Viewer.lueOccupation.Properties.DBValue = pat.job;
            SetLueJob(pat.job);
            Viewer.txtBirthplace.Text        = pat.birthArea;
            Viewer.txtEmail.Text             = pat.email;
            Viewer.txtOfficeLocation.Text    = string.Empty;
            Viewer.txtOfficeTel.Text         = string.Empty;
            Viewer.txtContactPersonAddr.Text = pat.contAddr;
            Viewer.txtContactPersonTel.Text  = pat.contTel;
            Viewer.txtContactPersonZip.Text  = string.Empty;
            Viewer.gcCardPlus.DataSource     = null;
            Viewer.ValueChanged = false;
        }
Esempio n. 7
0
        /// <summary>
        /// SelectedCardRow
        /// </summary>
        internal void SelectedCardRow()
        {
            int rowHandle = Viewer.gvCard.FocusedRowHandle;

            if (rowHandle < 0)
            {
                return;
            }
            EntityPatientInfo pat = Viewer.gvCard.GetRow(rowHandle) as EntityPatientInfo;

            if (pat == null)
            {
                Clear();
            }
            else
            {
                SetPatInfo(pat);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// getInfectionusValue
        /// </summary>
        #region
        void GetInfectionusValue(ref EntityInfectionus vo, EntityPatientInfo pat)
        {
            vo.patName     = pat.name;
            vo.inpatNo     = pat.ipNo;
            vo.patSex      = pat.sex;
            vo.patAge      = pat.age;
            vo.deptCode    = pat.deptCode;
            vo.birthDay    = Function.Datetime((Function.Datetime(pat.birth)).ToString("yyyy-MM-dd"));
            vo.doctId      = pat.doctCode;
            vo.dateIn      = Function.Datetime(pat.inDate);
            vo.doctName    = this.txtDoctor.Text;
            vo.inDiagnosis = this.mmtDiagnose.Text;

            if (this.chk01.Checked == true)
            {
                vo.incisionType = 1;
            }
            if (this.chk02.Checked == true)
            {
                vo.incisionType = 2;
            }
            if (this.chk03.Checked == true)
            {
                vo.incisionType = 3;
            }
            if (this.chk04.Checked == true)
            {
                vo.incisionType = 4;
            }

            vo.infectionSite01 = this.cboInfectionSite01.Text;
            vo.infectionSite02 = this.cboInfectionSite02.Text;
            vo.infectionDate01 = this.dteInfection01.Text;
            vo.infectionDate02 = this.dteInfection02.Text;
            vo.infectionReason = this.cboCausation.Text;
            vo.operationName   = this.txtOperationName.Text;
            vo.operationDate   = this.dteOperationDate.Text;
        }
Esempio n. 9
0
        /// <summary>
        /// 获取病人信息
        /// </summary>
        /// <param name="inpatId"></param>
        /// <returns></returns>

        internal List <EntityPatientInfo> GetPatInfo(string inpatId)
        {
            List <EntityPatientInfo> lstPat = new List <EntityPatientInfo>();
            string    Sql = string.Empty;
            SqlHelper svc = null;

            try
            {
                svc = new SqlHelper(EnumBiz.onlineDB);
                IDataParameter[] parm = null;

                Sql = @"select  *
                          from (select t.registerid_chr,
                                       a.patientid_chr             as pid,
                                       a.lastname_vchr             as patname,
                                       a.sex_chr                   as sex,
                                       a.birth_dat                 as birthday,
                                       a.idcard_chr                as idcard,
                                       a.homephone_vchr            as contacttel,
                                       a.contactpersonaddress_vchr as contactaddr,
                                       b.patientcardid_chr         as cardno,
                                       r1.mzdiagnose_vchr          as ryzd,
                                       r1.inpatientid_chr          as ipNo,
                                       r1.inpatientcount_int       as ipTimes,
                                       r1.inareadate_dat           as inDate,
                                       d1.code_vchr                as deptcode,
                                       d1.deptname_vchr            as deptname,
                                       r2.outhospital_dat          as outDate,
                                       d2.code_vchr                as deptcode2,
                                       d2.deptname_vchr            as deptname2,
                                       e.bed_no                    as bedNo,
                                       e1.empno_chr                as doctCode,
                                       e1.lastname_vchr            as doctName,
                                       t.diagnose_vchr             as diagnose
                                  from t_bse_patient a
                                 inner join t_bse_patientcard b
                                    on a.patientid_chr = b.patientid_chr
                                 inner join t_opr_bih_register r1
                                    on a.patientid_chr = r1.patientid_chr
                                  left join t_opr_bih_leave r2
                                    on r1.registerid_chr = r2.registerid_chr
                                  left join t_bse_deptdesc d1
                                    on r1.areaid_chr = d1.deptid_chr
                                  left join t_bse_deptdesc d2
                                    on r2.outdeptid_chr = d2.deptid_chr
                                  left join t_bse_bed e
                                    on r1.bedid_chr = e.bedid_chr
                                  left join t_bse_employee e1
                                    on r1.casedoctor_chr = e1.empid_chr
                                  left join T_Opr_BIH_Register t
                                    on a.inpatientid_chr = t.inpatientid_chr and r1.inpatient_dat = t.inpatient_dat
                                 where r1.inpatientid_chr = ?
                                 order by r1.inpatientcount_int desc) where rownum < 2 ";

                parm          = svc.CreateParm(1);
                parm[0].Value = inpatId;
                DataTable dt = svc.GetDataTable(Sql, parm);

                #region Sql2
                Sql = @"select a.preoperativediagnosis_chr,
                         c.cutlevel,b.operate_date,a.operationname_chr
                         from t_ana_requisition a 
                         inner join ana_collection_eventcontent b
                            on a.anaid_int = b.anaid_int
                         left join anaesthesia_event f
                            on b.event_id = f.event_id
                         left join inhospitalmainrecord_operation c
                         on a.inpatientid_chr = c.inpatientid and a.inpatientdate_dat = c.inpatientdate
                         where a.registerid_chr = ?
                         and b.status = 0
                         and f.event_id = '0054'
                         and rownum < 2
                         order by a.operationdate_dat desc ";

                #endregion

                if (dt != null && dt.Rows.Count > 0)
                {
                    EntityPatientInfo pat = null;
                    DataRow           dr  = dt.Rows[0];

                    pat        = new EntityPatientInfo();
                    pat.nhId   = dr["registerid_chr"].ToString();
                    pat.pid    = dr["pid"].ToString();
                    pat.cardNo = dr["cardno"].ToString();
                    pat.name   = dr["patname"].ToString();
                    pat.sex    = (dr["sex"].ToString().Trim() == "男" ? "1" : "2");
                    if (dr["birthday"] != DBNull.Value)
                    {
                        pat.birth = dr["birthday"].ToString();
                    }
                    pat.ID       = dr["idcard"].ToString();
                    pat.contAddr = dr["contactaddr"].ToString();
                    pat.contTel  = dr["contacttel"].ToString();
                    if (dr["deptcode2"] != DBNull.Value)
                    {
                        pat.deptCode = dr["deptcode2"].ToString();
                        pat.deptName = dr["deptname2"].ToString();
                    }
                    else
                    {
                        pat.deptCode = dr["deptcode"].ToString();
                        pat.deptName = dr["deptname"].ToString();
                    }
                    pat.ipNo    = dr["ipNo"].ToString();
                    pat.ipTimes = Function.Int(dr["ipTimes"]);
                    pat.bedNo   = dr["bedNo"].ToString();
                    if (dr["inDate"] != DBNull.Value)
                    {
                        pat.inDate = Function.Datetime(dr["inDate"]);
                    }
                    if (dr["outDate"] != DBNull.Value)
                    {
                        pat.outDate = Function.Datetime(dr["outDate"]);
                    }
                    pat.doctCode = dr["doctCode"].ToString();
                    pat.doctName = dr["doctName"].ToString();
                    pat.email    = dr["ryzd"].ToString();

                    if (string.IsNullOrEmpty(pat.ID))
                    {
                        pat.ID = pat.pid;
                    }

                    if (pat.nhId != string.Empty)
                    {
                        parm          = svc.CreateParm(1);
                        parm[0].Value = pat.nhId;
                        DataTable dt2 = svc.GetDataTable(Sql, parm);
                        if (dt2 != null && dt2.Rows.Count > 0)
                        {
                            DataRow dr2 = dt2.Rows[0];
                            pat.upFlag = dr2["operationname_chr"].ToString();
                            pat.zip    = dr2["operate_date"].ToString();

                            if (dr2["cutlevel"].ToString().Contains("I") || dr2["cutlevel"].ToString().Contains("一") ||
                                dr2["cutlevel"].ToString().Contains("1"))
                            {
                                pat.tremType = "I";
                            }
                            else if (dr2["cutlevel"].ToString().Contains("II") || dr2["cutlevel"].ToString().Contains("2") ||
                                     dr2["cutlevel"].ToString().Contains("‖") || dr2["cutlevel"].ToString().Contains("11"))
                            {
                                pat.tremType = "II";
                            }
                            else if (dr2["cutlevel"].ToString().Contains("III") || dr2["cutlevel"].ToString().Contains("3"))
                            {
                                pat.tremType = "II";
                            }
                            else if (dr2["cutlevel"].ToString().Contains("III") || dr2["cutlevel"].ToString().Contains("3"))
                            {
                                pat.tremType = "III";
                            }
                            else if (dr2["cutlevel"].ToString().Contains("0"))
                            {
                                pat.tremType = "0";
                            }
                        }
                        else
                        {
                            pat.upFlag   = "";
                            pat.zip      = "";
                            pat.tremType = "";
                        }
                    }

                    lstPat.Add(pat);
                }
            }
            catch (Exception e)
            {
                ExceptionLog.OutPutException(e);
            }
            finally
            {
                svc = null;
            }

            return(lstPat);
        }
Esempio n. 10
0
        /// <summary>
        /// Save
        /// </summary>
        internal void Save()
        {
            if (Viewer.txtPatName.Tag == null)
            {
                DialogBox.Msg("请先调出患者信息。");
                return;
            }
            EntityPatientInfo patVo = Viewer.txtPatName.Tag as EntityPatientInfo;

            try
            {
                uiHelper.BeginLoading(Viewer);
                string         fieldName = string.Empty;
                DateTime       dtmNow    = Utils.ServerTime();
                EntityRptZrbbg vo        = new EntityRptZrbbg();

                vo.xmlData = Viewer.showPanelForm.XmlData();
                if (Viewer.showPanelForm.IsAllowSave == false)
                {
                    DialogBox.Msg("存在必填项目没有处理,请检查。项目:\r\n" + Viewer.showPanelForm.HintInfo);
                    return;
                }
                vo.rptId      = Function.Dec(this.ZrbbgDisplayVo.rptId);
                vo.reportId   = this.ZrbbgDisplayVo.reportId;
                vo.reportDate = this.ZrbbgDisplayVo.reportDate;
                vo.bcDate     = this.ZrbbgDisplayVo.bcDate;
                vo.skDate     = this.ZrbbgDisplayVo.skDate;
                //vo.contactAddr = this.ZrbbgDisplayVo.contactAddr;

                // 报告时间
                if (ZrbbgParmData.Any(t => t.reportId == vo.reportId && t.keyId == "reportDate"))
                {
                    string reportDate = string.Empty;
                    fieldName  = ZrbbgParmData.FirstOrDefault(t => t.reportId == vo.reportId && t.keyId == "reportDate").keyValue;
                    reportDate = Viewer.showPanelForm.GetItemInfo(fieldName);
                    if (string.IsNullOrEmpty(reportDate) && string.IsNullOrEmpty(vo.reportDate))
                    {
                        vo.reportDate = dtmNow.ToString("yyyy-MM-dd HH:mm");
                    }
                    else if (!string.IsNullOrEmpty(reportDate))
                    {
                        vo.reportDate = reportDate;
                    }
                }
                else
                {
                    vo.reportDate = dtmNow.ToString("yyyy-MM-dd HH:mm");
                }

                // 编号
                if (ZrbbgParmData.Any(t => t.reportId == vo.reportId && t.keyId == "registerCode"))
                {
                    fieldName       = ZrbbgParmData.FirstOrDefault(t => t.reportId == vo.reportId && t.keyId == "registerCode").keyValue;
                    vo.registerCode = Viewer.showPanelForm.GetItemInfo(fieldName);
                }
                else
                {
                    vo.registerCode = Function.Datetime(vo.reportDate).ToString("MMdd") + patVo.pid;
                }
                // 报告人
                if (ZrbbgParmData.Any(t => t.reportId == vo.reportId && t.keyId == "reportOperCode"))
                {
                    fieldName         = ZrbbgParmData.FirstOrDefault(t => t.reportId == vo.reportId && t.keyId == "reportOperCode").keyValue;
                    vo.reportOperName = Viewer.showPanelForm.GetItemInfo(fieldName);
                    if (GlobalDic.DataSourceEmployee.Any(t => t.operName == vo.reportOperName))
                    {
                        vo.reportOperCode = GlobalDic.DataSourceEmployee.FirstOrDefault(t => t.operName == vo.reportOperName).operCode;
                    }
                }
                else
                {
                    vo.reportOperCode = GlobalLogin.objLogin.EmpNo;
                    vo.reportOperName = GlobalLogin.objLogin.EmpName;
                }

                // 上报科室
                if (ZrbbgParmData.Any(t => t.reportId == vo.reportId && t.keyId == "reportDept"))
                {
                    fieldName = ZrbbgParmData.FirstOrDefault(t => t.reportId == vo.reportId && t.keyId == "reportDept").keyValue;
                    string reportDeptName = Viewer.showPanelForm.GetItemInfo(fieldName);
                    using (ProxyAdverseEvent proxy = new ProxyAdverseEvent())
                    {
                        vo.reportDeptCode = proxy.Service.GetDeptCode(reportDeptName);
                    }
                }
                else
                {
                    vo.reportDeptCode = patVo.deptCode;
                }

                // 户籍地址
                if (ZrbbgParmData.Any(t => t.reportId == vo.reportId && t.keyId == "fimalyAddr"))
                {
                    EntityRptZrbbgParm parm = ZrbbgParmData.FirstOrDefault(t => t.reportId == vo.reportId && t.keyId == "fimalyAddr");
                    // 计算类
                    if (parm.flag == 3)
                    {
                        string   addr       = string.Empty;
                        string[] fieldNames = parm.keyValue.Split('+');
                        foreach (string fieldSub in fieldNames)
                        {
                            addr += Viewer.showPanelForm.GetItemInfo(fieldSub);
                            if (fieldSub == "ADDR1" && !string.IsNullOrEmpty(addr))
                            {
                                vo.familyAddr += addr + "省";
                            }
                            if (fieldSub == "ADDR2" && !string.IsNullOrEmpty(addr))
                            {
                                vo.familyAddr += addr + "市";
                            }
                            if (fieldSub == "ADDR3" && !string.IsNullOrEmpty(addr))
                            {
                                vo.familyAddr += addr + "县";
                            }
                            if (fieldSub == "ADDR4" && !string.IsNullOrEmpty(addr))
                            {
                                vo.familyAddr += addr + "镇";
                            }
                            if (fieldSub == "ADDR5" && !string.IsNullOrEmpty(addr))
                            {
                                vo.familyAddr += addr + "村";
                            }
                            if (fieldSub == "ADDR6" && !string.IsNullOrEmpty(addr))
                            {
                                vo.familyAddr += addr;
                            }
                            addr = string.Empty;
                        }
                    }
                    else if (parm.flag == 1)
                    {
                        string[] fieldNames = parm.keyValue.Split('+');
                        foreach (string fieldSub in fieldNames)
                        {
                            vo.familyAddr += Viewer.showPanelForm.GetItemInfo(fieldSub);
                        }
                    }
                    else
                    {
                        fieldName     = parm.keyValue;
                        vo.familyAddr = Viewer.showPanelForm.GetItemInfo(fieldName);
                    }
                }

                // 现地址
                if (ZrbbgParmData.Any(t => t.reportId == vo.reportId && t.keyId == "contactAddr"))
                {
                    EntityRptZrbbgParm parm = ZrbbgParmData.FirstOrDefault(t => t.reportId == vo.reportId && t.keyId == "contactAddr");
                    // 计算类
                    if (parm.flag == 3)
                    {
                        string   addr       = string.Empty;
                        string[] fieldNames = parm.keyValue.Split('+');
                        foreach (string fieldSub in fieldNames)
                        {
                            addr += Viewer.showPanelForm.GetItemInfo(fieldSub);
                            if (fieldSub == "ADDR1" && !string.IsNullOrEmpty(addr))
                            {
                                vo.contactAddr += addr + "省";
                            }
                            if (fieldSub == "ADDR2" && !string.IsNullOrEmpty(addr))
                            {
                                vo.contactAddr += addr + "市";
                            }
                            if (fieldSub == "ADDR3" && !string.IsNullOrEmpty(addr))
                            {
                                vo.contactAddr += addr + "县";
                            }
                            if (fieldSub == "ADDR4" && !string.IsNullOrEmpty(addr))
                            {
                                vo.contactAddr += addr + "镇";
                            }
                            if (fieldSub == "ADDR5" && !string.IsNullOrEmpty(addr))
                            {
                                vo.contactAddr += addr + "村";
                            }
                            if (fieldSub == "ADDR6" && !string.IsNullOrEmpty(addr))
                            {
                                vo.contactAddr += addr;
                            }
                            addr = string.Empty;
                        }
                    }
                    else if (parm.flag == 1)
                    {
                        string[] fieldNames = parm.keyValue.Split('+');
                        foreach (string fieldSub in fieldNames)
                        {
                            vo.contactAddr += Viewer.showPanelForm.GetItemInfo(fieldSub);
                        }
                    }
                    else
                    {
                        fieldName      = parm.keyValue;
                        vo.contactAddr = Viewer.showPanelForm.GetItemInfo(fieldName);
                    }
                }

                // 诊断病名
                if (ZrbbgParmData.Any(t => t.reportId == vo.reportId && t.keyId == "diagnoseName"))
                {
                    EntityRptZrbbgParm parm = ZrbbgParmData.FirstOrDefault(t => t.reportId == vo.reportId && t.keyId == "diagnoseName");
                    // 计算类
                    if (parm.flag == 2)
                    {
                        string[] fieldNames = parm.keyValue.Split('+');
                        foreach (string fieldSub in fieldNames)
                        {
                            if (fieldSub.Contains("|"))
                            {
                                string[] str = fieldSub.Split('|');
                                string   flg = Viewer.showPanelForm.GetItemInfo(str[0]);
                                if (flg == "1")
                                {
                                    vo.diagnoseName += str[1] + "、";
                                }
                            }
                            else
                            {
                                vo.diagnoseName += Viewer.showPanelForm.GetItemInfo(fieldSub);
                            }
                        }
                        if (!string.IsNullOrEmpty(vo.diagnoseName))
                        {
                            vo.diagnoseName = vo.diagnoseName.TrimEnd('、');
                        }
                        else
                        {
                            DialogBox.Msg("存在必填项目没有处理,请检查。项目:\r\n" + "诊断病名必须勾选或填写");
                            return;
                        }
                    }
                    else
                    {
                        fieldName       = parm.keyValue;
                        vo.diagnoseName = Viewer.showPanelForm.GetItemInfo(fieldName);
                    }
                }

                // 诊断日期
                if (ZrbbgParmData.Any(t => t.reportId == vo.reportId && t.keyId == "diagnoseDate"))
                {
                    fieldName       = ZrbbgParmData.FirstOrDefault(t => t.reportId == vo.reportId && t.keyId == "diagnoseDate").keyValue;
                    vo.diagnoseDate = Viewer.showPanelForm.GetItemInfo(fieldName);

                    if (vo.diagnoseDate.IndexOf("00:00") > 0)
                    {
                        DialogBox.Msg("诊断日期时间不能为 00:00,请检查。项目:\r\n");
                        return;
                    }
                }

                // 发病日期
                if (ZrbbgParmData.Any(t => t.reportId == vo.reportId && t.keyId == "infectiveDate"))
                {
                    fieldName        = ZrbbgParmData.FirstOrDefault(t => t.reportId == vo.reportId && t.keyId == "infectiveDate").keyValue;
                    vo.infectiveDate = Viewer.showPanelForm.GetItemInfo(fieldName);
                }

                // 收卡日期
                if (ZrbbgParmData.Any(t => t.reportId == vo.reportId && t.keyId == "skDate"))
                {
                    fieldName = ZrbbgParmData.FirstOrDefault(t => t.reportId == vo.reportId && t.keyId == "skDate").keyValue;
                    vo.skDate = Viewer.showPanelForm.GetItemInfo(fieldName);
                }

                // 网报日期
                if (ZrbbgParmData.Any(t => t.reportId == vo.reportId && t.keyId == "bcDate"))
                {
                    string bcDate = string.Empty;
                    fieldName = ZrbbgParmData.FirstOrDefault(t => t.reportId == vo.reportId && t.keyId == "bcDate").keyValue;
                    bcDate    = Viewer.showPanelForm.GetItemInfo(fieldName);
                    if (string.IsNullOrEmpty(bcDate) && string.IsNullOrEmpty(vo.bcDate))
                    {
                        vo.bcDate = dtmNow.ToString("yyyy-MM-dd HH:mm");
                    }
                    else if (!string.IsNullOrEmpty(bcDate))
                    {
                        vo.bcDate = bcDate;
                    }
                }
                else
                {
                    vo.bcDate = dtmNow.ToString("yyyy-MM-dd HH:mm");
                }


                // 收卡日期
                if (ZrbbgParmData.Any(t => t.reportId == vo.reportId && t.keyId == "skDate"))
                {
                    string skDate = string.Empty;
                    fieldName = ZrbbgParmData.FirstOrDefault(t => t.reportId == vo.reportId && t.keyId == "skDate").keyValue;
                    skDate    = Viewer.showPanelForm.GetItemInfo(fieldName);
                    if (string.IsNullOrEmpty(skDate) && string.IsNullOrEmpty(vo.skDate))
                    {
                        vo.skDate = dtmNow.ToString("yyyy-MM-dd HH:mm");
                    }
                    else if (!string.IsNullOrEmpty(skDate))
                    {
                        vo.skDate = skDate;
                    }
                }
                else
                {
                    vo.bcDate = dtmNow.ToString("yyyy-MM-dd HH:mm");
                }

                // 家长姓名
                if (ZrbbgParmData.Any(t => t.reportId == vo.reportId && t.keyId == "parentName"))
                {
                    fieldName     = ZrbbgParmData.FirstOrDefault(t => t.reportId == vo.reportId && t.keyId == "parentName").keyValue;
                    vo.parentName = Viewer.showPanelForm.GetItemInfo(fieldName);
                }

                // 有效证件号
                if (ZrbbgParmData.Any(t => t.reportId == vo.reportId && t.keyId == "idCard"))
                {
                    fieldName = ZrbbgParmData.FirstOrDefault(t => t.reportId == vo.reportId && t.keyId == "idCard").keyValue;
                    vo.idCard = Viewer.showPanelForm.GetItemInfo(fieldName);
                }

                // 备注
                if (ZrbbgParmData.Any(t => t.reportId == vo.reportId && t.keyId == "bz"))
                {
                    fieldName = ZrbbgParmData.FirstOrDefault(t => t.reportId == vo.reportId && t.keyId == "bz").keyValue;
                    vo.BZ     = Viewer.showPanelForm.GetItemInfo(fieldName);
                }

                // 人群分类
                if (ZrbbgParmData.Any(t => t.reportId == vo.reportId && t.keyId == "rqfl"))
                {
                    EntityRptZrbbgParm parm = ZrbbgParmData.FirstOrDefault(t => t.reportId == vo.reportId && t.keyId == "rqfl");
                    // 计算类
                    if (parm.flag == 2)
                    {
                        string[] fieldNames = parm.keyValue.Split('+');
                        foreach (string fieldSub in fieldNames)
                        {
                            string[] str = fieldSub.Split('|');
                            string   flg = Viewer.showPanelForm.GetItemInfo(str[0]);
                            if (flg == "1")
                            {
                                vo.RQFL += str[1] + "、";
                            }
                        }
                        if (!string.IsNullOrEmpty(vo.RQFL))
                        {
                            vo.RQFL = vo.RQFL.TrimEnd('、');
                        }
                    }
                    else
                    {
                        fieldName = parm.keyValue;
                        vo.RQFL   = Viewer.showPanelForm.GetItemInfo(fieldName);
                    }

                    if (string.IsNullOrEmpty(vo.RQFL))
                    {
                        DialogBox.Msg("存在必填项目没有处理,请检查。项目:\r\n" + "人群分类或职业不能为空");
                        return;
                    }
                }

                // 必填项目
                if (ZrbbgParmData.Any(t => t.reportId == vo.reportId && t.keyId == "required"))
                {
                    EntityRptZrbbgParm parm     = ZrbbgParmData.FirstOrDefault(t => t.reportId == vo.reportId && t.keyId == "required");
                    string             required = string.Empty;
                    bool     flg = false;
                    string[] fieldNames;
                    // 计算类
                    if (parm.flag != 0)
                    {
                        fieldNames = parm.keyValue.Split('+');
                        for (int i = 0; i < parm.flag; i++)
                        {
                            required = Viewer.showPanelForm.GetItemInfo(fieldNames[i]);
                            if (required == "1")
                            {
                                flg = true;
                                break;
                            }
                        }

                        if (flg)
                        {
                            string str       = string.Empty;
                            string strRequer = string.Empty;
                            for (int i = Function.Int(parm.flag); i < fieldNames.Length; i++)
                            {
                                string[] strNames = fieldNames[i].Split('|');
                                str = Viewer.showPanelForm.GetItemInfo(strNames[0]);
                                if (string.IsNullOrEmpty(str))
                                {
                                    strRequer += strNames[1] + Environment.NewLine;
                                }
                            }

                            if (!string.IsNullOrEmpty(strRequer))
                            {
                                DialogBox.Msg("存在必填项目没有处理,请检查。项目:\r\n" + strRequer);
                                return;
                            }
                        }
                    }
                }

                //肿瘤诊断依据必填
                if (ZrbbgParmData.Any(t => t.reportId == vo.reportId && t.keyId == "zdyj"))
                {
                    EntityRptZrbbgParm parm     = ZrbbgParmData.FirstOrDefault(t => t.reportId == vo.reportId && t.keyId == "zdyj");
                    string             required = string.Empty;
                    bool     flg = false;
                    string[] fieldNames;
                    if (parm.flag != 0)
                    {
                        fieldNames = parm.keyValue.Split('+');

                        foreach (string fieldSub in fieldNames)
                        {
                            required = Viewer.showPanelForm.GetItemInfo(fieldSub);
                            if (required == "1")
                            {
                                flg = true;
                                break;
                            }
                        }
                    }

                    if (!flg)
                    {
                        DialogBox.Msg("存在必填项目没有处理,诊断依据必选。");
                        return;
                    }
                }


                // 提示
                string lbTips = string.Empty;
                string mdTips = string.Empty;
                if (ZrbbgParmData.Any(t => t.reportId == vo.reportId && t.keyId == "lbTips"))
                {
                    EntityRptZrbbgParm parm       = ZrbbgParmData.FirstOrDefault(t => t.reportId == vo.reportId && t.keyId == "lbTips");
                    string             lbFlg      = string.Empty;
                    string[]           fieldNames = parm.keyValue.Split('+');
                    if (parm.flag == 1)
                    {
                        foreach (string fieldSub in fieldNames)
                        {
                            lbFlg = Viewer.showPanelForm.GetItemInfo(fieldSub);
                            if (lbFlg == "1")
                            {
                                break;
                            }
                        }
                    }
                    else
                    {
                        fieldName = parm.keyValue;
                        lbFlg     = Viewer.showPanelForm.GetItemInfo(fieldName);
                    }

                    if (lbFlg == "1")
                    {
                        lbTips = "请填写\r\n传染病报告卡艾滋病性病附卡。 \r\n";
                    }
                }

                if (ZrbbgParmData.Any(t => t.reportId == vo.reportId && t.keyId == "mdTips"))
                {
                    EntityRptZrbbgParm parm       = ZrbbgParmData.FirstOrDefault(t => t.reportId == vo.reportId && t.keyId == "mdTips");
                    string             mdFlg      = string.Empty;
                    string[]           fieldNames = parm.keyValue.Split('+');
                    if (parm.flag == 1)
                    {
                        foreach (string fieldSub in fieldNames)
                        {
                            mdFlg = Viewer.showPanelForm.GetItemInfo(fieldSub);
                            if (mdFlg == "1")
                            {
                                break;
                            }
                        }
                    }
                    else
                    {
                        fieldName = parm.keyValue;
                        mdFlg     = Viewer.showPanelForm.GetItemInfo(fieldName);
                    }

                    if (mdFlg == "1")
                    {
                        mdTips = "传染病报告卡(梅毒)附卡。 \r\n";
                    }
                }
                if (!string.IsNullOrEmpty(lbTips) || !string.IsNullOrEmpty(mdTips))
                {
                    DialogBox.Msg(lbTips + mdTips);
                }

                //性别
                if (ZrbbgParmData.Any(t => t.reportId == vo.reportId && t.keyId == "sex"))
                {
                    string[]           fieldNames;
                    string             sex  = string.Empty;
                    EntityRptZrbbgParm parm = ZrbbgParmData.FirstOrDefault(t => t.reportId == vo.reportId && t.keyId == "sex");
                    if (parm.flag != 0)
                    {
                        fieldNames = parm.keyValue.Split('+');
                        foreach (string fieldSub in fieldNames)
                        {
                            sex = Viewer.showPanelForm.GetItemInfo(fieldSub);
                            if (sex != "0")
                            {
                                break;
                            }
                        }

                        if (sex == "0")
                        {
                            DialogBox.Msg("存在必填项目没有处理,请检查。项目:\r\n" + "性别");
                            return;
                        }
                    }
                }
                //TRUST/RPR
                if (ZrbbgParmData.Any(t => t.reportId == vo.reportId && t.keyId == "TRUST/RPR"))
                {
                    string[]           fieldNames;
                    string             tFlg = string.Empty;
                    EntityRptZrbbgParm parm = ZrbbgParmData.FirstOrDefault(t => t.reportId == vo.reportId && t.keyId == "TRUST/RPR");
                    if (parm.flag != 0)
                    {
                        fieldNames = parm.keyValue.Split('+');
                        foreach (string fieldSub in fieldNames)
                        {
                            tFlg = Viewer.showPanelForm.GetItemInfo(fieldSub);
                            if (tFlg != "0")
                            {
                                break;
                            }
                        }

                        if (tFlg == "0")
                        {
                            DialogBox.Msg("存在必填项目没有处理,请检查。项目:\r\n" + "TRUST/RPR");
                            return;
                        }
                    }
                }
                //TPPA/TPHA
                if (ZrbbgParmData.Any(t => t.reportId == vo.reportId && t.keyId == "TPPA/TPHA"))
                {
                    string[]           fieldNames;
                    string             tFlg = string.Empty;
                    EntityRptZrbbgParm parm = ZrbbgParmData.FirstOrDefault(t => t.reportId == vo.reportId && t.keyId == "TPPA/TPHA");
                    if (parm.flag != 0)
                    {
                        fieldNames = parm.keyValue.Split('+');
                        foreach (string fieldSub in fieldNames)
                        {
                            tFlg = Viewer.showPanelForm.GetItemInfo(fieldSub);
                            if (tFlg != "0")
                            {
                                break;
                            }
                        }

                        if (tFlg == "0")
                        {
                            DialogBox.Msg("存在必填项目没有处理,请检查。项目:\r\n" + "TPPA/TPHA");
                            return;
                        }
                    }
                }

                //传染来源
                if (ZrbbgParmData.Any(t => t.reportId == vo.reportId && t.keyId == "zrly"))
                {
                    string[]           fieldNames;
                    string             zrly = string.Empty;
                    EntityRptZrbbgParm parm = ZrbbgParmData.FirstOrDefault(t => t.reportId == vo.reportId && t.keyId == "zrly");
                    if (parm.flag != 0)
                    {
                        fieldNames = parm.keyValue.Split('+');
                        foreach (string fieldSub in fieldNames)
                        {
                            zrly = Viewer.showPanelForm.GetItemInfo(fieldSub);
                            if (zrly != "0")
                            {
                                break;
                            }
                        }

                        if (zrly == "0")
                        {
                            DialogBox.Msg("存在必填项目没有处理,请检查。项目:\r\n" + "传染来源");
                            return;
                        }
                    }
                }

                if (!string.IsNullOrEmpty(patVo.ipNo) && patVo.ipTimes > 0)
                {
                    vo.patNo = patVo.ipNo;
                }
                else
                {
                    vo.patNo = patVo.cardNo;
                }
                vo.patName = patVo.name;
                vo.patSex  = patVo.sex;
                if (!string.IsNullOrEmpty(patVo.birth))
                {
                    vo.birthday = Function.Datetime(patVo.birth);
                }
                vo.contactTel = patVo.contTel;
                //vo.deptCode = patVo.deptCode;
                vo.xmlData    = Viewer.showPanelForm.XmlData();
                vo.formId     = this.formId;
                vo.operCode   = GlobalLogin.objLogin.EmpNo;
                vo.recordDate = dtmNow;
                vo.status     = 1;
                vo.patType    = Viewer.rdoFlag.SelectedIndex + 1;
                string reqNo = patVo.clNo;

                using (ProxyAdverseEvent proxy = new ProxyAdverseEvent())
                {
                    decimal rptId = 0;
                    if (proxy.Service.SaveZrbbg(vo, out rptId) > 0)
                    {
                        Viewer.IsSave = true;
                        if (this.ZrbbgDisplayVo.isNew)
                        {
                            this.ZrbbgDisplayVo.rptId = rptId;
                        }
                        Viewer.txtCardNo.Properties.ReadOnly = true;

                        //病毒性肝炎

                        if (ZrbbgParmData.Any(t => t.reportId == vo.reportId && t.keyId == "ygfk"))
                        {
                            string[]           fieldNames;
                            EntityRptZrbbgParm parm = ZrbbgParmData.FirstOrDefault(t => t.reportId == vo.reportId && t.keyId == "ygfk");
                            string             ygfk = string.Empty;
                            if (parm.flag != 0)
                            {
                                fieldNames = parm.keyValue.Split('+');
                                foreach (string fieldSub in fieldNames)
                                {
                                    ygfk = Viewer.showPanelForm.GetItemInfo(fieldSub);
                                    if (ygfk != "0")
                                    {
                                        frmZrbygfk frm = new frmZrbygfk(vo.rptId);
                                        frm.ShowDialog();
                                        break;
                                    }
                                }
                                if (ygfk == "0")
                                {
                                    proxy.Service.RegisterZrbygfk(vo.rptId, null);
                                }
                            }
                        }

                        DialogBox.Msg("数据保存成功!");
                    }
                    else
                    {
                        DialogBox.Msg("数据保存失败。");
                    }
                }
            }
            finally
            {
                uiHelper.CloseLoading(Viewer);
            }
        }
Esempio n. 11
0
        /// <summary>
        /// Save
        /// </summary>
        internal void Save()
        {
            if (Viewer.txtPatName.Tag == null)
            {
                DialogBox.Msg("请先调出患者信息。");
                return;
            }
            EntityPatientInfo patVo = Viewer.txtPatName.Tag as EntityPatientInfo;

            try
            {
                uiHelper.BeginLoading(Viewer);
                string             fieldName = string.Empty;
                DateTime           dtmNow    = Utils.ServerTime();
                EntityRptContagion vo        = new EntityRptContagion();

                vo.xmlData = Viewer.showPanelForm.XmlData();
                if (Viewer.showPanelForm.IsAllowSave == false)
                {
                    DialogBox.Msg("存在必填项目没有处理,请检查。项目:" + Viewer.showPanelForm.HintInfo);
                    return;
                }
                vo.rptId    = Function.Dec(this.ContagionDisplayVo.rptId);
                vo.reportId = this.ContagionDisplayVo.reportId;

                // 报告时间
                if (ContagionParmData.Any(t => t.reportId == vo.reportId && t.keyId == "reportTime"))
                {
                    fieldName     = ContagionParmData.FirstOrDefault(t => t.reportId == vo.reportId && t.keyId == "reportTime").keyValue;
                    vo.reportTime = Viewer.showPanelForm.GetItemInfo(fieldName);
                    if (vo.reportTime.Trim() == string.Empty)
                    {
                        vo.reportTime = dtmNow.ToString("yyyy-MM-dd HH:mm:ss");
                    }
                }
                else
                {
                    vo.reportTime = dtmNow.ToString("yyyy-MM-dd HH:mm:ss");
                }
                // 上报科室
                if (ContagionParmData.Any(t => t.reportId == vo.reportId && t.keyId == "deptCode"))
                {
                    fieldName = ContagionParmData.FirstOrDefault(t => t.reportId == vo.reportId && t.keyId == "deptCode").keyValue;
                    string deptName = Viewer.showPanelForm.GetItemInfo(fieldName);
                }
                else
                {
                    string deptName = GlobalLogin.objLogin.DeptName;
                }
                // 报告人
                if (ContagionParmData.Any(t => t.reportId == vo.reportId && t.keyId == "operCode"))
                {
                    fieldName         = ContagionParmData.FirstOrDefault(t => t.reportId == vo.reportId && t.keyId == "operCode").keyValue;
                    vo.reportOperName = Viewer.showPanelForm.GetItemInfo(fieldName);
                    if (GlobalDic.DataSourceEmployee.Any(t => t.operName == vo.reportOperName))
                    {
                        vo.reportOperCode = GlobalDic.DataSourceEmployee.FirstOrDefault(t => t.operName == vo.reportOperName).operCode;
                    }
                }
                else
                {
                    vo.reportOperCode = GlobalLogin.objLogin.EmpNo;
                    vo.reportOperName = GlobalLogin.objLogin.EmpName;
                }
                // 报告编号
                if (ContagionParmData.Any(t => t.reportId == vo.reportId && t.keyId == "regCode"))
                {
                    EntityRptContagionParm parm = ContagionParmData.FirstOrDefault(t => t.reportId == vo.reportId && t.keyId == "regCode");
                    // 计算类
                    if (parm.flag == 1)
                    {
                        string[] fieldNames = parm.keyValue.Split('+');
                        foreach (string fieldSub in fieldNames)
                        {
                            vo.registerCode += Viewer.showPanelForm.GetItemInfo(fieldSub);
                        }
                    }
                    else
                    {
                        fieldName       = parm.keyValue;
                        vo.registerCode = Viewer.showPanelForm.GetItemInfo(fieldName);
                    }
                }
                if (!string.IsNullOrEmpty(patVo.ipNo) && patVo.ipTimes > 0)
                {
                    vo.patNo = patVo.ipNo;
                }
                else
                {
                    vo.patNo = patVo.cardNo;
                }
                vo.patName = patVo.name;
                vo.patSex  = patVo.sex;
                if (!string.IsNullOrEmpty(patVo.birth))
                {
                    vo.birthday = Function.Datetime(patVo.birth);
                }
                vo.contactTel = patVo.contTel;
                vo.deptCode   = patVo.deptCode;
                vo.xmlData    = Viewer.showPanelForm.XmlData();
                vo.formId     = this.formId;
                vo.operCode   = GlobalLogin.objLogin.EmpNo;
                vo.recordDate = dtmNow;
                vo.status     = 1;
                vo.patType    = Viewer.rdoFlag.SelectedIndex + 1;
                string reqNo = patVo.clNo;

                using (ProxyContagion proxy = new ProxyContagion())
                {
                    decimal rptId = 0;
                    if (proxy.Service.SaveContagion(vo, reqNo, out rptId) > 0)
                    {
                        Viewer.IsSave = true;
                        if (this.ContagionDisplayVo.isNew)
                        {
                            this.ContagionDisplayVo.rptId = rptId.ToString();
                        }
                        Viewer.txtCardNo.Properties.ReadOnly = true;
                        DialogBox.Msg("数据保存成功!");
                    }
                    else
                    {
                        DialogBox.Msg("数据保存失败。");
                    }
                }
            }
            finally
            {
                uiHelper.CloseLoading(Viewer);
            }
        }
Esempio n. 12
0
        /// <summary>
        /// Save
        /// </summary>
        internal void Save(bool isExit)
        {
            #region get
            EntityPatientInfo pat = new EntityPatientInfo();
            pat.cardNo    = Viewer.txtCardNo.Text.Trim();
            pat.name      = Viewer.txtPatName.Text.Trim();
            pat.sex       = Viewer.cboSex.SelectedIndex.ToString();
            pat.feeCode   = Viewer.lueFee.Properties.DBValue;
            pat.ID        = Viewer.txtIdNo.Text.Trim();
            pat.birth     = Viewer.dteBirth.Text;
            pat.marry     = Viewer.lueMarry.Properties.DBValue;
            pat.addr      = Viewer.txtHomeAddr.Text.Trim();
            pat.corp      = Viewer.txtWorkAddr.Text.Trim();
            pat.contact   = Viewer.txtContactPerson.Text.Trim();
            pat.cTel      = Viewer.txtContactPersonTel.Text.Trim();
            pat.relation  = Viewer.cboContackRel.Text.Trim();
            pat.lockFlag  = (Viewer.cboStatus.SelectedIndex == 1 ? "F" : "T");
            pat.country   = Viewer.lueCitizenship.Properties.DBValue;
            pat.nation    = Viewer.lueNation.Properties.DBValue;
            pat.job       = Viewer.lueOccupation.Properties.DBValue;
            pat.birthArea = Viewer.txtBirthplace.Text.Trim();
            pat.email     = Viewer.txtEmail.Text.Trim();
            pat.contAddr  = Viewer.txtContactPersonAddr.Text.Trim();
            pat.contTel   = Viewer.txtContactPersonTel.Text.Trim();
            #endregion

            #region check
            if (string.IsNullOrEmpty(pat.cardNo))
            {
                DialogBox.Msg("请输入诊疗卡号。");
                Viewer.txtCardNo.Focus();
                return;
            }
            if (string.IsNullOrEmpty(pat.name))
            {
                DialogBox.Msg("请输入姓名。");
                Viewer.txtPatName.Focus();
                return;
            }
            if (string.IsNullOrEmpty(Viewer.cboSex.Text))
            {
                DialogBox.Msg("请选择性别。");
                Viewer.cboSex.Focus();
                return;
            }
            if (string.IsNullOrEmpty(pat.feeCode))
            {
                DialogBox.Msg("请选择费别。");
                Viewer.lueFee.Focus();
                return;
            }
            if (string.IsNullOrEmpty(pat.ID))
            {
                DialogBox.Msg("请输入身份证号。");
                Viewer.txtIdNo.Focus();
                return;
            }
            if (string.IsNullOrEmpty(pat.birth))
            {
                DialogBox.Msg("请输入出生日期。");
                Viewer.dteBirth.Focus();
                return;
            }
            #endregion

            #region default
            DateTime dtmNow = Utils.ServerTime();
            if (Viewer.txtCardNo.Tag != null)
            {
                EntityPatientInfo tmp = Viewer.txtCardNo.Tag as EntityPatientInfo;
                pat.pid     = tmp.pid;
                pat.regDate = tmp.regDate;
                pat.regTime = tmp.regTime;
                pat.regOper = tmp.regOper;
            }
            else
            {
                pat.regDate = dtmNow.ToString("yyyy.MM.dd");
                pat.regTime = dtmNow.ToString("yyyy.MM.dd HH:mm:dd");
                pat.regOper = GlobalLogin.objLogin.EmpNo;
            }
            pat.modiDate = dtmNow;
            #endregion

            int ret = 0;
            using (ProxyDictionary proxy = new ProxyDictionary())
            {
                ret = proxy.Service.SavePatInfo(ref pat);
            }
            if (ret > 0)
            {
                Viewer.txtCardNo.Tag = pat;
                Viewer.IsSave        = true;
                Viewer.ValueChanged  = false;
                DialogBox.Msg("保存成功!");
            }
            else
            {
                DialogBox.Msg("保存失败。");
            }
        }
Esempio n. 13
0
        /// <summary>
        /// Save
        /// </summary>
        internal void Save()
        {
            if (Viewer.txtPatName.Tag == null)
            {
                DialogBox.Msg("请先调出患者信息。");
                return;
            }
            EntityPatientInfo patVo = Viewer.txtPatName.Tag as EntityPatientInfo;

            try
            {
                uiHelper.BeginLoading(Viewer);
                string   fieldName           = string.Empty;
                DateTime dtmNow              = Utils.ServerTime();
                EntityOutpatientInterview vo = new EntityOutpatientInterview();
                vo.rptId    = Function.Dec(this.InterviewVo.rptId);
                vo.patName  = patVo.name;
                vo.patSex   = patVo.sex;
                vo.patNo    = patVo.ipNo;
                vo.birthday = patVo.birth;
                vo.idCard   = patVo.ID;
                //vo.contactAddr = patVo.addr;
                //vo.contactTel = patVo.contTel;
                vo.outDeptCode     = patVo.deptCode;
                vo.outHospitalTime = Function.Datetime(patVo.outDate).ToString("yyyy-MM-dd HH:mm");
                if (!string.IsNullOrEmpty(patVo.birth))
                {
                    vo.birthday = patVo.birth;
                }
                vo.contactTel    = patVo.contTel;
                vo.xmlData       = Viewer.showPanelForm.XmlData();
                vo.recordDate    = dtmNow.ToString("yyyy-MM-dd HH:mm:ss");
                vo.interviewTime = this.InterviewVo.interviewTime;
                vo.registerid    = this.InterviewVo.registerid;
                vo.status        = 1;

                // 随访人
                if (InterviewParmData.Any(t => t.keyId == "interviewCode"))
                {
                    fieldName = InterviewParmData.FirstOrDefault(t => t.keyId == "interviewCode").keyValue;
                    fieldName = InterviewParmData.FirstOrDefault(t => t.keyId == "interviewCode").keyValue;
                    string interviewName = Viewer.showPanelForm.GetItemInfo(fieldName);
                    if (GlobalDic.DataSourceEmployee.Any(t => t.operName == interviewName))
                    {
                        vo.interviewCode = GlobalDic.DataSourceEmployee.FirstOrDefault(t => t.operName == interviewName).operCode;
                    }
                    else
                    {
                        vo.interviewCode = GlobalLogin.objLogin.EmpNo;
                    }
                }
                else
                {
                    vo.interviewCode = GlobalLogin.objLogin.EmpNo;
                }

                // 随访时间
                if (InterviewParmData.Any(t => t.keyId == "interviewTime"))
                {
                    string interviewTime = string.Empty;
                    fieldName     = InterviewParmData.FirstOrDefault(t => t.keyId == "interviewTime").keyValue;
                    interviewTime = Viewer.showPanelForm.GetItemInfo(fieldName);
                    if (string.IsNullOrEmpty(interviewTime) && string.IsNullOrEmpty(vo.interviewTime))
                    {
                        vo.interviewTime = dtmNow.ToString("yyyy-MM-dd HH:mm");
                    }
                }
                else
                {
                    vo.interviewTime = dtmNow.ToString("yyyy-MM-dd HH:mm");
                }

                // 现住地址
                if (InterviewParmData.Any(t => t.keyId == "contactAddr"))
                {
                    string contactAddr = string.Empty;
                    fieldName   = InterviewParmData.FirstOrDefault(t => t.keyId == "contactAddr").keyValue;
                    contactAddr = Viewer.showPanelForm.GetItemInfo(fieldName);
                    if (!string.IsNullOrEmpty(contactAddr))
                    {
                        vo.contactAddr = contactAddr;
                    }
                }

                // 联系电话
                if (InterviewParmData.Any(t => t.keyId == "contactTel"))
                {
                    string contactTel = string.Empty;
                    fieldName  = InterviewParmData.FirstOrDefault(t => t.keyId == "contactTel").keyValue;
                    contactTel = Viewer.showPanelForm.GetItemInfo(fieldName);
                    if (!string.IsNullOrEmpty(contactTel))
                    {
                        vo.contactTel = contactTel;
                    }
                }

                using (ProxyAdverseEvent proxy = new ProxyAdverseEvent())
                {
                    if (proxy.Service.SaveInterview(ref vo) > 0)
                    {
                        Viewer.IsSave = true;
                        Viewer.txtCardNo.Properties.ReadOnly = true;
                        this.InterviewVo.rptId = vo.rptId;
                        DialogBox.Msg("数据保存成功!");
                    }
                    else
                    {
                        DialogBox.Msg("数据保存失败。");
                    }
                }
            }
            finally
            {
                uiHelper.CloseLoading(Viewer);
            }
        }
Esempio n. 14
0
        /// <summary>
        /// Save
        /// </summary>
        internal void Save()
        {
            if (Viewer.txtPatName.Tag == null)
            {
                DialogBox.Msg("请先调出患者信息。");
                return;
            }
            string            reqStr = string.Empty;
            EntityPatientInfo patVo  = Viewer.txtPatName.Tag as EntityPatientInfo;

            try
            {
                uiHelper.BeginLoading(Viewer);
                string         fieldName = string.Empty;
                DateTime       dtmNow    = Utils.ServerTime();
                EntityRptEvent vo        = new EntityRptEvent();
                vo.rptId      = Function.Dec(this.EventDisplayVo.rptId);
                vo.eventId    = this.EventDisplayVo.eventId;
                vo.reportTime = this.EventDisplayVo.reportTime;
                // 报告时间
                if (EventParmData.Any(t => t.eventId == vo.eventId && t.keyId == "reportTime"))
                {
                    string reportTime = string.Empty;
                    fieldName  = EventParmData.FirstOrDefault(t => t.eventId == vo.eventId && t.keyId == "reportTime").keyValue;
                    reportTime = Viewer.showPanelForm.GetItemInfo(fieldName);
                    if (string.IsNullOrEmpty(reportTime) && string.IsNullOrEmpty(vo.reportTime))
                    {
                        vo.reportTime = dtmNow.ToString("yyyy-MM-dd HH:mm:ss");
                    }
                    else if (!string.IsNullOrEmpty(reportTime))
                    {
                        vo.reportTime = reportTime;
                    }
                }
                else if (string.IsNullOrEmpty(vo.reportTime))
                {
                    vo.reportTime = dtmNow.ToString("yyyy-MM-dd HH:mm:ss");
                }

                // 报告人
                if (EventParmData.Any(t => t.eventId == vo.eventId && t.keyId == "operCode"))
                {
                    fieldName         = EventParmData.FirstOrDefault(t => t.eventId == vo.eventId && t.keyId == "operCode").keyValue;
                    vo.reportOperName = Viewer.showPanelForm.GetItemInfo(fieldName);
                    if (GlobalDic.DataSourceEmployee.Any(t => t.operName == vo.reportOperName))
                    {
                        vo.reportOperCode = GlobalDic.DataSourceEmployee.FirstOrDefault(t => t.operName == vo.reportOperName).operCode;
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(patVo.ipNo) && patVo.ipTimes > 0 && vo.eventId == "17")
                        {
                            vo.reportOperCode = GlobalLogin.objLogin.EmpNo;
                        }
                        else if (vo.eventId == "17")
                        {
                            vo.reportOperCode = GlobalLogin.objLogin.EmpNo;
                        }
                    }
                }
                else
                {
                    vo.reportOperCode = GlobalLogin.objLogin.EmpNo;
                    vo.reportOperName = GlobalLogin.objLogin.EmpName;
                }
                // 上报科室
                if (EventParmData.Any(t => t.eventId == vo.eventId && t.keyId == "deptCode"))
                {
                    fieldName = EventParmData.FirstOrDefault(t => t.eventId == vo.eventId && t.keyId == "deptCode").keyValue;
                    string reportDeptName = Viewer.showPanelForm.GetItemInfo(fieldName);
                    using (ProxyAdverseEvent proxy = new ProxyAdverseEvent())
                    {
                        vo.reportDeptCode = proxy.Service.GetDeptCode(reportDeptName);
                    }
                }
                else
                {
                    vo.reportDeptCode = patVo.deptCode;
                }
                // 事件编码
                if (EventParmData.Any(t => t.eventId == vo.eventId && t.keyId == "eventCode"))
                {
                    fieldName    = EventParmData.FirstOrDefault(t => t.eventId == vo.eventId && t.keyId == "eventCode").keyValue;
                    vo.eventCode = Viewer.showPanelForm.GetItemInfo(fieldName);
                }
                else if (patVo.pid == "\\")
                {
                    vo.eventCode = Function.Datetime(vo.reportTime).ToString("MMddHHmm") + vo.reportOperCode;
                }
                else
                {
                    vo.eventCode = patVo.pid;
                }

                // 事件名称
                if (EventParmData.Any(t => t.eventId == vo.eventId && t.keyId == "eventName"))
                {
                    fieldName    = EventParmData.FirstOrDefault(t => t.eventId == vo.eventId && t.keyId == "eventName").keyValue;
                    vo.eventName = Viewer.showPanelForm.GetItemInfo(fieldName);
                }
                else
                {
                    vo.eventName = Viewer.Text + "-" + patVo.name;
                }
                if (!string.IsNullOrEmpty(patVo.ipNo) && patVo.ipTimes > 0)
                {
                    vo.patNo = patVo.ipNo;
                }
                else
                {
                    vo.patNo = patVo.cardNo;
                }
                vo.patName = patVo.name;
                vo.patSex  = patVo.sex;
                if (!string.IsNullOrEmpty(patVo.birth))
                {
                    vo.birthday = Function.Datetime(patVo.birth);
                }
                vo.contactTel = patVo.contTel;
                vo.deptCode   = patVo.deptCode;
                vo.xmlData    = Viewer.showPanelForm.XmlData();
                if (Viewer.showPanelForm.IsAllowSave == false)
                {
                    DialogBox.Msg("存在必填项目没有处理,请检查。项目:\r\n" + Viewer.showPanelForm.HintInfo);

                    return;
                }

                if (vo.eventId == "13")
                {
                    int reqBlfyFlg = 0;
                    //不良反应结果
                    if (EventParmData.Any(t => t.eventId == vo.eventId && t.keyId == "BLFYJG"))
                    {
                        string   kyeStr     = EventParmData.FirstOrDefault(t => t.eventId == vo.eventId && t.keyId == "BLFYJG").keyValue;
                        string[] fieldNames = kyeStr.Split('+');
                        foreach (string fieldSub in fieldNames)
                        {
                            string[] str   = fieldSub.Split('|');
                            string   value = Viewer.showPanelForm.GetItemInfo(str[0]);
                            if (value == "1")
                            {
                                reqBlfyFlg = 1;
                                break;
                            }
                        }

                        if (reqBlfyFlg == 0)
                        {
                            reqStr += "不良反应事件结果" + Environment.NewLine;
                        }
                    }

                    //停药后反应
                    int reqTyhfyFlg = 0;
                    if (EventParmData.Any(t => t.eventId == vo.eventId && t.keyId == "TYHFY"))
                    {
                        string   kyeStr     = EventParmData.FirstOrDefault(t => t.eventId == vo.eventId && t.keyId == "TYHFY").keyValue;
                        string[] fieldNames = kyeStr.Split('+');
                        foreach (string fieldSub in fieldNames)
                        {
                            string[] str   = fieldSub.Split('|');
                            string   value = Viewer.showPanelForm.GetItemInfo(str[0]);
                            if (value == "1")
                            {
                                reqTyhfyFlg = 1;
                                break;
                            }
                        }

                        if (reqTyhfyFlg == 0)
                        {
                            reqStr += "停药或减量后,反应/事件是否消失或减轻" + Environment.NewLine;
                        }
                    }

                    //报告人评价
                    int reqBgrpjFlg = 0;
                    if (EventParmData.Any(t => t.eventId == vo.eventId && t.keyId == "BGRPJ"))
                    {
                        string   kyeStr     = EventParmData.FirstOrDefault(t => t.eventId == vo.eventId && t.keyId == "BGRPJ").keyValue;
                        string[] fieldNames = kyeStr.Split('+');
                        foreach (string fieldSub in fieldNames)
                        {
                            string[] str   = fieldSub.Split('|');
                            string   value = Viewer.showPanelForm.GetItemInfo(str[0]);
                            if (value == "1")
                            {
                                reqBgrpjFlg = 1;
                                break;
                            }
                        }

                        if (reqBgrpjFlg == 0)
                        {
                            reqStr += "报告人评价" + Environment.NewLine;
                        }
                    }

                    //报告单位评价
                    int reqBgdwpjFlg = 0;
                    if (EventParmData.Any(t => t.eventId == vo.eventId && t.keyId == "BGDWPJ"))
                    {
                        string   kyeStr     = EventParmData.FirstOrDefault(t => t.eventId == vo.eventId && t.keyId == "BGDWPJ").keyValue;
                        string[] fieldNames = kyeStr.Split('+');
                        foreach (string fieldSub in fieldNames)
                        {
                            string[] str   = fieldSub.Split('|');
                            string   value = Viewer.showPanelForm.GetItemInfo(str[0]);
                            if (value == "1")
                            {
                                reqBgdwpjFlg = 1;
                                break;
                            }
                        }

                        if (reqBgdwpjFlg == 0)
                        {
                            reqStr += "报告单位评价" + Environment.NewLine;
                        }
                    }

                    //报告人信息 职业
                    int reqBgrxxFlg = 0;
                    if (EventParmData.Any(t => t.eventId == vo.eventId && t.keyId == "BGDWPJ"))
                    {
                        string   kyeStr     = EventParmData.FirstOrDefault(t => t.eventId == vo.eventId && t.keyId == "BGDWPJ").keyValue;
                        string[] fieldNames = kyeStr.Split('+');
                        foreach (string fieldSub in fieldNames)
                        {
                            string[] str   = fieldSub.Split('|');
                            string   value = Viewer.showPanelForm.GetItemInfo(str[0]);
                            if (value == "1")
                            {
                                reqBgrxxFlg = 1;
                                break;
                            }
                            else if (!string.IsNullOrEmpty(value) && value != "0")
                            {
                                reqBgrxxFlg = 1;
                                break;
                            }
                        }

                        if (reqBgrxxFlg == 0)
                        {
                            reqStr += "报告人职业" + Environment.NewLine;
                        }
                    }

                    if (!string.IsNullOrEmpty(reqStr))
                    {
                        DialogBox.Msg("存在必填项目没有处理,请检查。项目:\r\n" + reqStr);
                        return;
                    }
                }

                vo.formId     = this.formId;
                vo.operCode   = GlobalLogin.objLogin.EmpNo;
                vo.recordDate = dtmNow;
                vo.status     = 1;
                vo.patType    = Viewer.rdoFlag.SelectedIndex + 1;

                using (ProxyAdverseEvent proxy = new ProxyAdverseEvent())
                {
                    decimal rptId = 0;

                    if (proxy.Service.SaveEvent(vo, out rptId) > 0)
                    {
                        Viewer.IsSave = true;
                        if (this.EventDisplayVo.isNew)
                        {
                            this.EventDisplayVo.rptId = rptId.ToString();
                        }
                        Viewer.txtCardNo.Properties.ReadOnly = true;
                        DialogBox.Msg("数据保存成功!");
                    }
                    else
                    {
                        DialogBox.Msg("数据保存失败。");
                    }
                }
            }
            finally
            {
                uiHelper.CloseLoading(Viewer);
            }
        }
Esempio n. 15
0
        /// <summary>
        /// 保存
        /// </summary>
        #region
        public override void Save()
        {
            EntityPatientInfo patVo = this.txtName.Tag as EntityPatientInfo;

            if (this.txtName.Tag == null)
            {
                DialogBox.Msg("请先调出患者信息。");
                return;
            }

            if (vo != null && vo.rptId > 0 && vo.status == 1)
            {
                DialogBox.Msg("已审核不可修改,请先反审核");
                return;
            }

            this.gvSample.CloseEditor();
            this.gvSample.UpdateCurrentRow();

            if (vo == null)
            {
                vo = new EntityInfectionus();
            }
            DateTime dtmNow = Utils.ServerTime();

            GetInfectionusValue(ref vo, patVo);
            if (vo.rptId <= 0)
            {
                vo.reportTime   = dtmNow.ToString("yyyy-MM-dd HH:mm:ss");
                vo.reporterId   = GlobalLogin.objLogin.EmpNo;
                vo.reporterName = GlobalLogin.objLogin.EmpName;
            }

            vo.recordDate = dtmNow;
            List <EntityPathogeny> data = new List <EntityPathogeny>();

            for (int i = this.gvSample.RowCount - 1; i >= 0; i--)
            {
                if (this.gvSample.GetRowCellValue(i, "sampleName") != null && !string.IsNullOrEmpty(this.gvSample.GetRowCellValue(i, "sampleName").ToString()))
                {
                    EntityPathogeny pathogenyVo = new EntityPathogeny();
                    pathogenyVo.sampleName    = this.gvSample.GetRowCellValue(i, "sampleName").ToString();
                    pathogenyVo.checkDate     = Function.Datetime(this.gvSample.GetRowCellValue(i, "checkDate").ToString()).ToString("yyyy-MM-dd");
                    pathogenyVo.pathogenyName = this.gvSample.GetRowCellValue(i, "pathogenyName").ToString();
                    pathogenyVo.drugName      = this.gvSample.GetRowCellValue(i, "drugName").ToString();

                    data.Add(pathogenyVo);
                }
                else
                {
                    this.gvSample.DeleteRow(i);
                }
            }

            using (ProxyAdverseEvent proxy = new ProxyAdverseEvent())
            {
                if (proxy.Service.SaveInfectionus(vo, data) >= 0)
                {
                    DialogBox.Msg("保存成功");
                    vo = null;
                }
                else
                {
                    DialogBox.Msg("保存失败");
                    vo = null;
                }
            }
            this.txtName.Tag = null;
            this.Query();
        }
Esempio n. 16
0
        /// <summary>
        /// 查找病人
        /// </summary>
        /// <param name="cardNo">1 门诊卡号; 2 住院号</param>
        /// <param name="flag">1 门诊; 2 住院</param>
        /// <returns></returns>
        internal List <EntityPatientInfo> GetPatient(string cardNo, int flag)
        {
            string Sql  = string.Empty;
            string Sql2 = string.Empty;

            List <EntityPatientInfo> lstPat = new List <EntityPatientInfo>();
            SqlHelper svc = null;

            try
            {
                svc = new SqlHelper(EnumBiz.interfaceDB);
                IDataParameter[] parm = null;
                if (flag == 1)
                {
                    Sql = @"select a.PID       as pid,
                                   a.NAME      as patname,
                                   a.SEX       as sex, -- 性别
                                   a.BIRTH     as birthday, -- 出生日期
                                   a.ID        as idcard, -- 身份证号
                                   a.CONT_TEL  as contacttel, -- 联系电话
                                   a.CONT_ADDR as contactaddr, -- 联系地址
                                   a.CARD_NO   as cardno, -- 诊疗卡号
                                   null        as ipNo, -- 住院号
                                   null        as ipTimes, -- 住院次数
                                   null        as inDate, -- 入院时间
                                   b.DEPT_CODE as deptcode, -- 住院科室编码
                                   c.DEPT_NAME as deptname, -- 住院科室名称
                                   null        as outDate, -- 出院时间
                                   null        as deptcode2, -- 出院科室编码
                                   null        as deptname2, -- 出院科室名称
                                   null        as bedNo, -- 床位号
                                   b.DR_CODE   as doctCode, -- 主治医生编码
                                   d.OPER_NAME as doctName -- 主治医生姓名
                              from PATIENTINFO a, CL_REGISTER b, CODE_DEPARTMENT c, CODE_OPERATOR d
                             where a.PID = b.PID
                               and b.DEPT_CODE = c.DEPT_CODE
                               and b.DR_CODE = d.OPER_CODE
                               and a.CARD_NO = ?
                            ";

                    TimeSpan ts = new TimeSpan(30, 0, 0, 0);
                    parm = svc.CreateParm(1);
                    //parm[0].Value = DateTime.Now.Subtract(ts);
                    parm[0].Value = cardNo;
                }
                else if (flag == 2)
                {
                    Sql = @"select a.PID       as pid,
                                   a.NAME      as patname,
                                   a.SEX       as sex, -- 性别
                                   a.BIRTH     as birthday, -- 出生日期
                                   a.ID        as idcard, -- 身份证号
                                   a.CONT_TEL  as contacttel, -- 联系电话
                                   a.CONT_ADDR as contactaddr, -- 联系地址
                                   a.CARD_NO   as cardno, -- 诊疗卡号
                                   b.IP_NO     as ipNo, -- 住院号
                                   b.IP_CNT    as ipTimes, -- 住院次数
                                   b.IP_DATE   as inDate, -- 入院时间
                                   b.IP_DEPT   as deptcode, -- 住院科室编码
                                   c.DEPT_NAME as deptname, -- 住院科室名称
                                   b.OP_DATE   as outDate, -- 出院时间
                                   b.OP_DEPT   as deptcode2, -- 出院科室编码
                                   d.DEPT_NAME as deptname2, -- 出院科室名称
                                   e.BED_CODE  as bedNo, -- 床位号
                                   e.MAN_DR    as doctCode, -- 主治医生编码
                                   f.OPER_NAME as doctName -- 主治医生姓名
                              from PATIENTINFO a
                             inner join IP_REGISTER b
                                on a.PID = b.PID
                              left join CODE_DEPARTMENT c
                                on b.IP_DEPT = c.DEPT_CODE
                              left join CODE_DEPARTMENT d
                                on b.OP_DEPT = d.DEPT_CODE
                              left join IP_PATIENT e
                                on b.REG_NO = e.REG_NO
                               and e.CURR_FLAG = 'T'
                              left join CODE_OPERATOR f
                                on e.MAN_DR = f.OPER_CODE
                             where b.IP_NO = ?
                            ";

                    parm          = svc.CreateParm(1);
                    parm[0].Value = cardNo;
                }

                DataTable dt = svc.GetDataTable(Sql, parm);
                if (dt != null && dt.Rows.Count > 0)
                {
                    EntityPatientInfo pat = null;
                    foreach (DataRow dr in dt.Rows)
                    {
                        pat        = new EntityPatientInfo();
                        pat.pid    = dr["pid"].ToString();
                        pat.cardNo = dr["cardno"].ToString();
                        pat.name   = dr["patname"].ToString();
                        pat.sex    = (dr["sex"].ToString() == "男" ? "1" : "2");
                        if (dr["birthday"] != DBNull.Value)
                        {
                            pat.birth = dr["birthday"].ToString();
                        }
                        pat.ID       = dr["idcard"].ToString();
                        pat.contAddr = dr["contactaddr"].ToString();
                        pat.contTel  = dr["contacttel"].ToString();
                        if (dr["deptcode2"] != DBNull.Value)
                        {
                            pat.deptCode = dr["deptcode2"].ToString();
                            pat.deptName = dr["deptname2"].ToString();
                        }
                        else
                        {
                            pat.deptCode = dr["deptcode"].ToString();
                            pat.deptName = dr["deptname"].ToString();
                        }
                        pat.ipNo    = dr["ipNo"].ToString();
                        pat.ipTimes = Function.Int(dr["ipTimes"]);
                        pat.bedNo   = dr["bedNo"].ToString();
                        if (dr["inDate"] != DBNull.Value)
                        {
                            pat.inDate = Function.Datetime(dr["inDate"]);
                        }
                        if (dr["outDate"] != DBNull.Value)
                        {
                            pat.outDate = Function.Datetime(dr["outDate"]);
                        }
                        pat.doctCode = dr["doctCode"].ToString();
                        pat.doctName = dr["doctName"].ToString();
                        lstPat.Add(pat);
                    }
                }
            }
            catch (Exception e)
            {
                ExceptionLog.OutPutException(e);
            }
            finally
            {
                svc = null;
            }
            return(lstPat);
        }