public long m_lngUpload(DateTime p_dtmDate, Label p_lblInfor, ListView p_lsvInfor) { long lngRes = -1; m_lsvMain = p_lsvInfor; p_lblInfor.Text = "正在统计需要上传的人数,请稍后..."; ListViewItem lsvItem; #region 统计人数 /////////////////////////////////////////////////////////////////////// lsvItem = new ListViewItem(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); lsvItem.SubItems.Add("正在统计需要上传人数"); m_lsvMain.Items.Insert(0, lsvItem); p_lblInfor.Refresh(); p_lsvInfor.Refresh(); List <string> m_glsInRegID = null; List <string> m_glsOutRegID = null; if (m_glstMiddleter != null || m_glstMiddleter.Count > 0) { clsObjectGenerator.ltServers = this.m_glstMiddleter; } clsCommunityInterface_Svc objSvc = (clsCommunityInterface_Svc)clsObjectGenerator.objCreatorObjectByType(typeof(clsCommunityInterface_Svc)); lngRes = objSvc.m_lngGetPatientCount(p_dtmDate.ToString("yyyy-MM-dd"), out m_glsInRegID, out m_glsOutRegID); objSvc.Dispose(); objSvc = null; if (lngRes < 0) { return(lngRes); } if (m_glsInRegID != null && m_glsInRegID.Count > 0) { p_lblInfor.Text = "入院人数:" + m_glsInRegID.Count; } else { p_lblInfor.Text = "入院人数:0 "; } if (m_glsOutRegID != null && m_glsOutRegID.Count > 0) { p_lblInfor.Text += " 出院人数:" + m_glsOutRegID.Count; } else { p_lblInfor.Text += " 出院人数:0"; } lsvItem = new ListViewItem(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); lsvItem.SubItems.Add(p_lblInfor.Text.ToString()); lsvItem.ForeColor = System.Drawing.Color.DarkRed; m_lsvMain.Items.Insert(0, lsvItem); p_lblInfor.Refresh(); p_lsvInfor.Refresh(); ///////////////////////////////////////////////////////////////////// #endregion int intTotolInfor = 0; #region 入院病人信息 List <clsHospRecordCS_Vo> m_glsInHospInfor = null;; if (m_glsInRegID != null && m_glsInRegID.Count > 0) { intTotolInfor += m_glsInRegID.Count; p_lblInfor.Text = "正在统计入院病人的信息,请稍后....."; lsvItem = new ListViewItem(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); lsvItem.SubItems.Add(p_lblInfor.Text.ToString()); m_lsvMain.Items.Insert(0, lsvItem); p_lblInfor.Refresh(); p_lsvInfor.Refresh(); if (m_glstMiddleter != null || m_glstMiddleter.Count > 0) { clsObjectGenerator.ltServers = this.m_glstMiddleter; } objSvc = (clsCommunityInterface_Svc)clsObjectGenerator.objCreatorObjectByType(typeof(clsCommunityInterface_Svc)); lngRes = objSvc.m_lngGetInpatientInfo(m_glsInRegID, out m_glsInHospInfor); objSvc.Dispose(); objSvc = null; p_lblInfor.Text = "完成统计"; lsvItem = new ListViewItem(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); lsvItem.SubItems.Add("统计入院病人信息完成,共" + m_glsInHospInfor.Count + " 人"); lsvItem.ForeColor = System.Drawing.Color.DarkRed; m_lsvMain.Items.Insert(0, lsvItem); p_lblInfor.Refresh(); p_lsvInfor.Refresh(); } #endregion #region 出院病人信息 List <clsHospBillCS_Vo> m_glsMianHospBill = null; List <clsHospOrderCS_Vo> m_glsMianHospOrder = null; List <clsHospRecordCS_Vo> m_glsMianhospRecord = null; if (m_glsOutRegID != null && m_glsOutRegID.Count > 0) { p_lblInfor.Text = "正在统计出院病人信息,请稍后..."; p_lblInfor.Refresh(); m_glsMianHospBill = new List <clsHospBillCS_Vo>(); //发票信息 m_glsMianHospOrder = new List <clsHospOrderCS_Vo>(); //医嘱信息 m_glsMianhospRecord = new List <clsHospRecordCS_Vo>(); //个人信息 int PatientCount = m_glsOutRegID.Count; for (int i1 = 0; i1 < PatientCount; i1++) { this.m_mthAddListItem(m_glsOutRegID[i1].ToString(), 1); List <clsHospBillCS_Vo> m_glsNewHospBill = null; List <clsHospOrderCS_Vo> m_glsNewHospOrder = null; clsHospRecordCS_Vo m_objRecord = null; if (m_glstMiddleter != null || m_glstMiddleter.Count > 0) { clsObjectGenerator.ltServers = this.m_glstMiddleter; } objSvc = (clsCommunityInterface_Svc)clsObjectGenerator.objCreatorObjectByType(typeof(clsCommunityInterface_Svc)); lngRes = objSvc.m_lngGetOutPatientInfor(m_glsOutRegID[i1], out m_objRecord, out m_glsNewHospBill, out m_glsNewHospOrder); objSvc.Dispose(); objSvc = null; if (m_glsNewHospBill != null && m_glsNewHospBill.Count > 0) { m_glsMianHospBill.AddRange(m_glsNewHospBill); } if (m_glsNewHospOrder != null && m_glsNewHospOrder.Count > 0) { m_glsMianHospOrder.AddRange(m_glsNewHospOrder); } if (m_objRecord != null) { m_glsMianhospRecord.Add(m_objRecord); } System.Threading.Thread.Sleep(500); } intTotolInfor += m_glsMianHospBill.Count + m_glsMianHospOrder.Count + m_glsMianhospRecord.Count; p_lblInfor.Text = "出院病人数据整理完成."; lsvItem = new ListViewItem(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); lsvItem.SubItems.Add("出院病人数据整理完成. 一共" + m_glsMianhospRecord.Count.ToString() + "条数据. "); lsvItem.ForeColor = System.Drawing.Color.DarkRed; m_lsvMain.Items.Insert(0, lsvItem); p_lblInfor.Refresh(); p_lsvInfor.Refresh(); } #endregion lsvItem = new ListViewItem(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); lsvItem.SubItems.Add("住院信息收集完成!"); lsvItem.ForeColor = System.Drawing.Color.DarkBlue; m_lsvMain.Items.Insert(0, lsvItem); #region 整理信息 List <string> m_glsSQL = new List <string>(intTotolInfor); p_lblInfor.Text = "正在整理信息,请稍后....."; p_lblInfor.Refresh(); string strSQL = ""; int intLen = 0; if (m_glsInHospInfor != null) { intLen = m_glsInHospInfor.Count; //去除重复数据 Hashtable objHsTable = new Hashtable(); for (int i = 0; i < intLen; i++) { clsHospRecordCS_Vo obj = m_glsInHospInfor[i]; try { objHsTable.Add(obj.m_strRegisterID, ""); } catch { continue; } //this.m_mthAddListItem(obj.m_strRegisterID, 4); strSQL = @"insert into hosp_hospitalizationrecord (name, sex, kind, ethnicgroup, address, jobtitle,phonenumberhome, contactperson, nationality, maritalstatus,birthday, idnumbers, ssid, inhospno, inhosseqno,clinicid, patientbed, indeptcode, indeptname, maincuredocname,maincuredoccode, indate, diagnosisname1, diagnosiscode1,inhosptime ) values('" + obj.m_strName + "','" + obj.m_strSex + "','" + obj.m_strKind + "','" + obj.m_strEthnicGroup + "','" + obj.m_strAddress + "','" + obj.m_strJobTitle + "','" + obj.m_strPhoneNum + "','" + obj.m_strContactPerson + "','" + obj.m_strNationality + "','" + obj.m_strMaritalStatus + "',to_date('" + obj.m_dtmBirthDay.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-mm-dd hh24:mi:ss'),'" + obj.m_strIDNumber + "','" + obj.m_strSSID + "','" + obj.m_strInHospNO + "','" + obj.m_strRegisterID + "','" + obj.m_strClinicID + "','" + obj.m_strBedNO + "','" + obj.m_strInDeptCode + "','" + obj.m_strInDeptName + "','" + obj.m_strMainDoctorName + "','" + obj.m_strMainDoctorID + "', to_date('" + obj.m_dtmInDate.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-mm-dd hh24:mi:ss'),'" + obj.m_strInDiagnosName + "','" + obj.m_strInDiagnosCode + "','" + obj.m_intInHospCount.ToString() + "')"; m_glsSQL.Add(strSQL); } m_glsInHospInfor = null; lsvItem = new ListViewItem(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); lsvItem.SubItems.Add("入院病人数据整理完成. 一共" + m_glsSQL.Count.ToString() + "条数据. "); lsvItem.ForeColor = System.Drawing.Color.DarkRed; m_lsvMain.Items.Insert(0, lsvItem); p_lsvInfor.Refresh(); //System.Threading.Thread.Sleep(1000); } strSQL = ""; if (m_glsMianhospRecord != null) { intLen = m_glsMianhospRecord.Count; Hashtable objHsTable = new Hashtable(); for (int i = 0; i < intLen; i++) { clsHospRecordCS_Vo obj = m_glsMianhospRecord[i]; try { objHsTable.Add(obj.m_strRegisterID, ""); } catch { continue; } //this.m_mthAddListItem(obj.m_strRegisterID, 2); strSQL = @"insert into hosp_hospitalizationrecord (name, sex, kind, ethnicgroup, address, jobtitle,phonenumberhome, contactperson, nationality, maritalstatus,birthday, idnumbers, ssid, inhospno, inhosseqno,clinicid, patientbed, indeptcode, indeptname, maincuredocname,maincuredoccode, indate, diagnosisname1, diagnosiscode1,inhosptime, diagnosiscode2, status, outdeptcode, outdeptname, leftdate, inhospdays ) values('" + obj.m_strName + "','" + obj.m_strSex + "','" + obj.m_strKind + "','" + obj.m_strEthnicGroup + "','" + obj.m_strAddress + "','" + obj.m_strJobTitle + "','" + obj.m_strPhoneNum + "','" + obj.m_strContactPerson + "','" + obj.m_strNationality + "','" + obj.m_strMaritalStatus + "',to_date('" + obj.m_dtmBirthDay.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-mm-dd hh24:mi:ss'),'" + obj.m_strIDNumber + "','" + obj.m_strSSID + "','" + obj.m_strInHospNO + "','" + obj.m_strRegisterID + "','" + obj.m_strClinicID + "','" + obj.m_strBedNO + "','" + obj.m_strInDeptCode + "','" + obj.m_strInDeptName + "','" + obj.m_strMainDoctorName + "','" + obj.m_strMainDoctorID + "', to_date('" + obj.m_dtmInDate.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-mm-dd hh24:mi:ss'),'" + obj.m_strInDiagnosName + "','" + obj.m_strInDiagnosCode + "','" + obj.m_intInHospCount.ToString() + "','" + obj.m_strOutDiagnosName + "','" + obj.m_strStatus + "','" + obj.m_strOutDeptCode + "','" + obj.m_strOutDeptName + "',to_date('" + obj.m_dtmOutDate.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-mm-dd hh24:mi:ss')" + ",'" + obj.m_intHospDay.ToString() + "')"; m_glsSQL.Add(strSQL); } m_glsMianhospRecord = null; lsvItem = new ListViewItem(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); lsvItem.SubItems.Add("出院病人数据整理完成. 一共" + intLen.ToString() + "条数据. "); lsvItem.ForeColor = System.Drawing.Color.DarkRed; m_lsvMain.Items.Insert(0, lsvItem); p_lsvInfor.Refresh(); //System.Threading.Thread.Sleep(1000); } strSQL = ""; if (m_glsMianHospBill != null) { intLen = m_glsMianHospBill.Count; System.Collections.ArrayList arrTmp = new System.Collections.ArrayList(); Hashtable objHsTable = new Hashtable(); for (int i = 0; i < intLen; i++) { clsHospBillCS_Vo obj = m_glsMianHospBill[i]; try { objHsTable.Add(obj.m_strRegisterID + obj.m_strInvoNo + obj.m_strFareCode + obj.m_strFareName, ""); } catch { continue; } //if (!arrTmp.Contains(obj.m_strInvoNo)) //{ // arrTmp.Add(obj.m_strInvoNo); // this.m_mthAddListItem(obj.m_strInvoNo, 3); //} strSQL = @"insert into Hosp_HospitalizationBill (inhosseqno, billno, faretotal, fareselfpay,accountstartdate, accountenddate, billdate, kind, farecode, farename, sum ) values('" + obj.m_strRegisterID + "','" + obj.m_strInvoNo + "','" + obj.m_dclInvoTotolMoney.ToString() + "','" + obj.m_dclInvoFSPMoney.ToString() + "',to_date('" + obj.m_dtmBeginDate.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-mm-dd hh24:mi:ss'), to_date('" + obj.m_dtmEndDate.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-mm-dd hh24:mi:ss')," + " to_date('" + obj.m_dtmBillDate.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-mm-dd hh24:mi:ss'),'" + obj.m_strKind + "','" + obj.m_strFareCode + "','" + obj.m_strFareName + "','" + obj.m_dclSubMoney + "')"; m_glsSQL.Add(strSQL); } m_glsMianhospRecord = null; lsvItem = new ListViewItem(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); lsvItem.SubItems.Add("病人费用整理完成. 一共" + intLen.ToString() + "条数据. "); lsvItem.ForeColor = System.Drawing.Color.DarkRed; m_lsvMain.Items.Insert(0, lsvItem); p_lsvInfor.Refresh(); } if (m_glsMianHospOrder != null && m_glsMianHospOrder.Count > 0) { //intLen = m_glsMianHospOrder.Count; Hashtable objHsTable = new Hashtable(); //for (int intI = 0; intI < intLen;intI++) foreach (clsHospOrderCS_Vo order in m_glsMianHospOrder) { try { objHsTable.Add(order.m_strRegisterID + order.m_strOrderID + order.m_strChargeItemID + order.m_dtmCreateDate.ToString(), ""); } catch { continue; } strSQL = @"insert into hosp_inhosporder (doctcode,inhosseqno, doctname, depcode, depname, groupno, itemcode, itemname, itemspec, itemprice, itemamout, itemunit, inputdt, startdt, type ) values (" + " '" + order.m_strCreatorID + "'," + " '" + order.m_strRegisterID + "'," + " '" + order.m_strCreateDoctor + "'," + " '" + order.m_strCreateDeptID + "'," + " '" + order.m_strCreateDept + "'," + " '" + order.m_strOrderID + "'," + " '" + order.m_strChargeItemID + "'," + " '" + order.m_strChargeItemName + "'," + " '" + order.m_strSpec + "'," + " '" + order.m_dclPrice + "'," + " '" + order.m_dclAmount + "'," + " '" + order.m_strUnit + "'," + " to_date('" + order.m_dtmCreateDate.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-mm-dd hh24:mi:ss')," + " to_date('" + order.m_dtmStartDT.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-mm-dd hh24:mi:ss')," + " '" + order.m_intOrderStauts.ToString() + "'" + ")"; m_glsSQL.Add(strSQL); } lsvItem = new ListViewItem(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); lsvItem.SubItems.Add("病人医嘱整理完成. 一共" + m_glsMianHospOrder.Count.ToString() + "条数据. "); lsvItem.ForeColor = System.Drawing.Color.DarkRed; m_lsvMain.Items.Insert(0, lsvItem); p_lsvInfor.Refresh(); } //睡一会.... System.Threading.Thread.Sleep(1000); p_lblInfor.Text = "整理完成,正在更新数据库,请稍后....."; lsvItem = new ListViewItem(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); lsvItem.SubItems.Add("整理完成,更新数据."); lsvItem.ForeColor = System.Drawing.Color.DarkRed; m_lsvMain.Items.Insert(0, lsvItem); p_lblInfor.Refresh(); p_lsvInfor.Refresh(); #endregion //更新数据 clsUploadData objUpLoad = new clsUploadData(); lngRes = objUpLoad.m_lngUploadData(m_glsSQL); objUpLoad = null; if (lngRes > 0) { p_lblInfor.Text = "上传完成!"; p_lblInfor.ForeColor = System.Drawing.Color.DarkBlue; lsvItem = new ListViewItem(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); lsvItem.SubItems.Add("更新完成!"); lsvItem.ForeColor = System.Drawing.Color.DarkBlue; m_lsvMain.Items.Insert(0, lsvItem); p_lblInfor.Refresh(); p_lsvInfor.Refresh(); } else { p_lblInfor.Text = "上传失败!"; p_lblInfor.ForeColor = System.Drawing.Color.DarkRed; lsvItem = new ListViewItem(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); lsvItem.SubItems.Add("上传失败!"); lsvItem.ForeColor = System.Drawing.Color.DarkRed; m_lsvMain.Items.Insert(0, lsvItem); p_lblInfor.Refresh(); p_lsvInfor.Refresh(); } return(lngRes); }
public long m_lngGetOutPatientInfor(string m_strRegID, out clsHospRecordCS_Vo p_objHospRecord, out List <clsHospBillCS_Vo> m_glsHospBill, out List <clsHospOrderCS_Vo> m_glsHospOrder) { long lngRes = -1; string strSQL = string.Empty; DataTable dtTmp = null; p_objHospRecord = null; m_glsHospBill = null; m_glsHospOrder = null; try { #region 1. 个人信息 strSQL = @"select b.lastname_vchr, b.sex_chr, b.race_vchr, b.homeaddress_vchr, b.officeaddress_vchr, b.homephone_vchr, b.contactpersonfirstname_vchr, b.nationality_vchr, b.married_chr, b.birth_dat, b.idcard_chr, b.insuranceid_vchr, a.inpatientid_chr, a.inpatientcount_int, a.registerid_chr, f.patientcardid_chr, e.code_chr, a.areaid_chr, d.deptname_vchr, a.casedoctor_chr, g.lastname_vchr as doctorname, a.inareadate_dat, a.icd10diagtext_vchr, a.icd10diagid_vchr, a.status_int, td.deptname_vchr as outdeptname, ta.outareaid_chr, ta.outhospital_dat, ta.diagnose_vchr as outdiagnose, ta.ins_diagnose_vchr, ta.type_int,b.birthplace_vchr,a.inpatient_dat,a.paytypeid_chr from t_opr_bih_register a, t_opr_bih_leave ta, t_opr_bih_registerdetail b, t_bse_deptdesc d, t_bse_bed e, t_bse_patientcard f, t_bse_employee g, t_bse_deptdesc td where a.registerid_chr = b.registerid_chr and a.registerid_chr = ta.registerid_chr and ta.pstatus_int = 1 and ta.status_int = 1 and ta.outareaid_chr = td.deptid_chr and a.patientid_chr = f.patientid_chr and a.casedoctor_chr = g.empid_chr and a.areaid_chr = d.deptid_chr and a.bedid_chr = e.bedid_chr and a.status_int != 0 and a.registerid_chr = ?"; clsHRPTableService objHRPSvc = new clsHRPTableService(); IDataParameter[] param = null; objHRPSvc.CreateDatabaseParameter(1, out param); param[0].Value = m_strRegID; dtTmp = new DataTable(); lngRes = objHRPSvc.lngGetDataTableWithParameters(strSQL, ref dtTmp, param); objHRPSvc.Dispose(); objHRPSvc = null; param = null; if (lngRes < 0 || dtTmp.Rows.Count < 1) { return(lngRes); } ///////////////////////////////////////////////////// DataRow dr = dtTmp.Rows[0]; p_objHospRecord = new clsHospRecordCS_Vo(); p_objHospRecord.m_strName = dr["lastname_vchr"].ToString(); p_objHospRecord.m_strSex = clsDataUpload_Svc.m_strConvertValue("sex", dr["sex_chr"].ToString(), ""); p_objHospRecord.m_strEthnicGroup = clsDataUpload_Svc.m_strConvertValue("ethnicgroup", dr["race_vchr"].ToString(), ""); p_objHospRecord.m_strAddress = dr["homeaddress_vchr"].ToString(); if (dr["inpatient_dat"] != DBNull.Value) { p_objHospRecord.m_dtmConfirmDate = Convert.ToDateTime(dr["inpatient_dat"].ToString().Trim()); string m_strDateTime = p_objHospRecord.m_dtmConfirmDate.ToString("yyyy-MM-dd"); p_objHospRecord.m_dtmConfirmDate = Convert.ToDateTime(m_strDateTime); } p_objHospRecord.m_strJobTitle = dr["officeaddress_vchr"].ToString(); p_objHospRecord.m_strPhoneNum = dr["homephone_vchr"].ToString(); p_objHospRecord.m_strContactPerson = dr["contactpersonfirstname_vchr"].ToString(); p_objHospRecord.m_strNationality = clsDataUpload_Svc.m_strConvertValue("nationality", dr["nationality_vchr"].ToString(), ""); p_objHospRecord.m_strMaritalStatus = clsDataUpload_Svc.m_strConvertValue("maritalstatus", dr["married_chr"].ToString(), ""); p_objHospRecord.m_dtmBirthDay = Convert.ToDateTime(dr["birth_dat"]); p_objHospRecord.m_strIDNumber = dr["idcard_chr"].ToString(); p_objHospRecord.m_strSSID = dr["insuranceid_vchr"].ToString(); p_objHospRecord.m_strInHospNO = dr["inpatientid_chr"].ToString(); p_objHospRecord.m_intInHospCount = int.Parse(dr["inpatientcount_int"].ToString()); p_objHospRecord.m_strRegisterID = dr["registerid_chr"].ToString(); p_objHospRecord.m_strClinicID = dr["patientcardid_chr"].ToString(); p_objHospRecord.m_strBedNO = dr["code_chr"].ToString(); p_objHospRecord.m_strInDeptCode = dr["areaid_chr"].ToString(); p_objHospRecord.m_strInDeptName = dr["deptname_vchr"].ToString(); p_objHospRecord.m_strMainDoctorID = dr["casedoctor_chr"].ToString(); p_objHospRecord.m_strMainDoctorName = dr["doctorname"].ToString(); p_objHospRecord.m_dtmInDate = DateTime.Parse(dr["inpatient_dat"].ToString()); p_objHospRecord.m_strInDiagnosName = dr["icd10diagtext_vchr"].ToString(); p_objHospRecord.m_strInDiagnosCode = dr["icd10diagid_vchr"].ToString(); p_objHospRecord.m_strOutDeptName = dr["outdeptname"].ToString(); p_objHospRecord.m_strOutDeptCode = dr["outareaid_chr"].ToString(); p_objHospRecord.m_dtmOutDate = Convert.ToDateTime(dr["outhospital_dat"]); p_objHospRecord.m_strOutDiagnosName = dr["outdiagnose"].ToString(); p_objHospRecord.m_strOutDiagnosCode = dr["ins_diagnose_vchr"].ToString(); p_objHospRecord.m_strStatus = dr["type_int"].ToString();//改 p_objHospRecord.m_intCancel = int.Parse(dr["status_int"].ToString()); TimeSpan ts = p_objHospRecord.m_dtmOutDate - p_objHospRecord.m_dtmInDate; p_objHospRecord.m_intHospDay = ts.Days; p_objHospRecord.m_strKind = clsDataUpload_Svc.m_strConvertValue("kind", dr["paytypeid_chr"].ToString(), "");// 跟身份关联 p_objHospRecord.m_strBirthPlace = dr["BIRTHPLACE_VCHR"].ToString(); p_objHospRecord.m_dtmInAreaTime = Convert.ToDateTime(dr["inareadate_dat"]); dtTmp.Dispose(); dtTmp = null; //////////////////////////////////////////////////// #endregion #region 2. 发票信息 //2.1 主信息 // strSQL = @"select a.registerid_chr, c.invoiceno_vchr, a.totalsum_mny, a.sbsum_mny, // a.operdate_dat, e.typeid_chr, e.typename_vchr, a.chargeno_chr, // sum (b.totalmoney_dec) as submoney,a.paytypeid_chr // from t_opr_bih_charge a, // t_opr_bih_chargeitementry b, // t_opr_bih_chargedefinv c, // t_bse_chargeitemextype e // where a.chargeno_chr = c.chargeno_chr // and a.chargeno_chr = b.chargeno_chr // and b.invcateid_chr = e.typeid_chr // and e.flag_int = 4 // and a.registerid_chr = ? // group by a.registerid_chr, // c.invoiceno_vchr, // a.totalsum_mny, // a.sbsum_mny, // a.operdate_dat, // e.typeid_chr, // e.typename_vchr, // a.chargeno_chr // order by c.invoiceno_vchr"; strSQL = @"select b.sid_int, a.registerid_chr, c.orderid_chr, c.create_dat, c.createarea_chr, d.invoiceno_vchr, a.totalsum_mny, a.sbsum_mny, a.operdate_dat, g.itemcode_vchr as chargeitemid_chr, b.chargeitemname_chr, b.amount_dec, b.unitprice_dec, b.totalmoney_dec as itemmoney, b.createarea_chr, e.deptname_vchr, b.doctorid_chr, f.lastname_vchr, b.invcateid_chr, a.chargeno_chr, b.sid_int, g.itemsrcid_vchr, g.itemcode_vchr, h.drugid_chr from t_opr_bih_charge a, t_opr_bih_chargeitementry b, t_opr_bih_patientcharge c, t_opr_bih_chargedefinv d, t_bse_deptdesc e, t_bse_employee f, t_bse_chargeitem g, t_bse_medidrefloadupdrugid h where b.chargeitemid_chr = g.itemid_chr(+) and a.chargeno_chr = b.chargeno_chr and a.chargeno_chr = d.chargeno_chr and a.chargeno_chr = c.paymoneyid_chr and b.pchargeid_chr = c.pchargeid_chr and b.createarea_chr = e.deptid_chr and b.doctorid_chr = f.empid_chr and g.itemsrcid_vchr = h.medicineid_chr(+) and a.registerid_chr = ? "; objHRPSvc = new clsHRPTableService(); dtTmp = new DataTable(); objHRPSvc.CreateDatabaseParameter(1, out param); param[0].Value = m_strRegID; lngRes = objHRPSvc.lngGetDataTableWithParameters(strSQL, ref dtTmp, param); objHRPSvc.Dispose(); objHRPSvc = null; param = null; if (lngRes < 0 || dtTmp.Rows.Count < 1) { return(lngRes); } // 2.2 要取得开始和结束时间 int intRowCount = dtTmp.Rows.Count; List <string> m_glsChargeNo = new List <string>(); for (int i = 0; i < intRowCount; i++) { dr = dtTmp.Rows[i]; if (!m_glsChargeNo.Contains(dr["chargeno_chr"].ToString())) { m_glsChargeNo.Add(dr["chargeno_chr"].ToString()); } } System.Text.StringBuilder stbTmp = new System.Text.StringBuilder(m_glsChargeNo.Count * 23); int i1 = 0; for (i1 = 0; i1 < m_glsChargeNo.Count - 1; i1++) { stbTmp.Append("'" + m_glsChargeNo[i1].ToString() + "',"); } stbTmp.Append("'" + m_glsChargeNo[i1].ToString() + "'"); strSQL = @"select a.chargeno_chr, max (c.chargeactive_dat) as enddate, min (c.chargeactive_dat) as begindate from t_opr_bih_charge a, t_opr_bih_chargeitementry b, t_opr_bih_patientcharge c where a.chargeno_chr = b.chargeno_chr and b.pchargeid_chr = c.pchargeid_chr and a.chargeno_chr in (" + stbTmp.ToString().Trim() + ") group by a.chargeno_chr"; stbTmp = null; objHRPSvc = new clsHRPTableService(); DataTable dtChargeNO = new DataTable(); lngRes = objHRPSvc.DoGetDataTable(strSQL, ref dtChargeNO); objHRPSvc.Dispose(); objHRPSvc = null; if (lngRes < 0 || dtChargeNO.Rows.Count < 0) { return(lngRes); } Dictionary <string, List <DateTime> > m_gDicChargeDefTime = new Dictionary <string, List <DateTime> >(dtChargeNO.Rows.Count); List <DateTime> m_glsTime; for (i1 = 0; i1 < dtChargeNO.Rows.Count; i1++) { dr = dtChargeNO.Rows[i1]; m_glsTime = new List <DateTime>(2); m_glsTime.Add(Convert.ToDateTime(dr["begindate"])); m_glsTime.Add(Convert.ToDateTime(dr["enddate"])); m_gDicChargeDefTime.Add(dr["chargeno_chr"].ToString(), m_glsTime); } dtChargeNO = null; // 2.3 赋值 m_glsHospBill = new List <clsHospBillCS_Vo>(intRowCount); for (i1 = 0; i1 < intRowCount; i1++) { dr = dtTmp.Rows[i1]; clsHospBillCS_Vo objNew = new clsHospBillCS_Vo(); objNew.m_strRegisterID = dr["registerid_chr"].ToString(); objNew.m_strInvoNo = dr["invoiceno_vchr"].ToString(); objNew.m_dclInvoTotolMoney = Convert.ToDecimal(dr["totalsum_mny"]); objNew.m_dclInvoFSPMoney = Convert.ToDecimal(dr["sbsum_mny"]); objNew.m_dtmBeginDate = m_gDicChargeDefTime[dr["chargeno_chr"].ToString()][0]; objNew.m_dtmEndDate = m_gDicChargeDefTime[dr["chargeno_chr"].ToString()][1]; objNew.m_dtmBillDate = Convert.ToDateTime(dr["operdate_dat"]); objNew.m_strKind = p_objHospRecord.m_strKind;//身份 //objNew.m_strFareCode = dr["typeid_chr"].ToString(); //objNew.m_strFareName = dr["typename_vchr"].ToString(); objNew.m_strFareCode = dr["itemcode_vchr"].ToString(); objNew.m_strFareName = dr["chargeitemname_chr"].ToString(); objNew.m_dclSubMoney = decimal.Parse(dr["itemmoney"].ToString()); objNew.m_intAmount = decimal.Parse(dr["amount_dec"].ToString()); objNew.m_dclPrice = decimal.Parse(dr["unitprice_dec"].ToString()); objNew.m_strInDeptName = dr["createarea_chr"].ToString(); objNew.m_strInDeptID = dr["deptname_vchr"].ToString(); objNew.m_strDoctorID = dr["doctorid_chr"].ToString(); objNew.m_strDoctorName = dr["lastname_vchr"].ToString(); objNew.m_strFareKind = clsDataUpload_Svc.m_strConvertValue("billkind", dr["invcateid_chr"].ToString(), ""); objNew.m_strSEQID = dr["sid_int"].ToString(); objNew.m_strOrderID = dr["orderid_chr"].ToString(); objNew.m_strITEMID = dr["drugid_chr"].ToString().Trim(); objNew.m_dtEXECUTEDATE = Convert.ToDateTime(dr["create_dat"].ToString()); objNew.m_strDEPCODE = dr["createarea_chr"].ToString(); objNew.m_strDEPNAME = dr["deptname_vchr"].ToString().Trim(); m_glsHospBill.Add(objNew); } #endregion #region 3. 个人医嘱 strSQL = @" select a.creatorid_chr, a.registerid_chr, a.creator_chr, a.createareaid_chr, a.createareaname_vchr, a.recipeno_int, c.itemcode_vchr as chargeitemid_chr, b.chargeitemname_chr, b.spec_vchr, b.amount_dec, b.unitprice_dec, b.unit_vchr, a.createdate_dat, a.startdate_dat, a.executetype_int, a.orderid_chr, '' as kind, b.flag_int, decode(a.dosage_dec,null,b.amount_dec,a.dosage_dec) as dosage_dec, a.dosageunit_chr, a.execfreqname_chr as execfreqid_chr, a.dosetypeid_chr, a.dosetypename_chr, a.curareaid_chr, d.deptname_vchr as curareaname, a.stoperid_chr, a.stoper_chr, a.stopdate_dat, c.itemipinvtype_chr, e.sample_type_desc_vchr, f.partname, a.remark_vchr, c.itemsrcid_vchr, g.drugid_chr, decode(n.flaga_int,1,'01',2,'02','99') as JXBZDM from t_opr_bih_order a, t_opr_bih_orderchargedept b, t_bse_chargeitem c, t_bse_deptdesc d, t_aid_lis_sampletype e, ar_apply_partlist f, t_bse_medidrefloadupdrugid g, t_bse_medicine m, t_aid_medicinepreptype n where a.orderid_chr = b.orderid_chr and b.chargeitemid_chr = c.itemid_chr and a.sampleid_vchr = e.sample_type_id_chr(+) and a.partid_vchr = f.partid(+) and a.curareaid_chr = d.deptid_chr and c.itemsrcid_vchr = g.medicineid_chr(+) and c.itemsrcid_vchr=m.medicineid_chr(+) and m.medicinepreptype_chr = n.medicinepreptype_chr(+) and a.status_int in (2, 3, 6) and a.registerid_chr = ? "; objHRPSvc = new clsHRPTableService(); objHRPSvc.CreateDatabaseParameter(1, out param); param[0].Value = m_strRegID; lngRes = objHRPSvc.lngGetDataTableWithParameters(strSQL, ref dtTmp, param); objHRPSvc.Dispose(); objHRPSvc = null; if (lngRes < 0) { return(lngRes); } intRowCount = dtTmp.Rows.Count; m_glsHospOrder = new List <clsHospOrderCS_Vo>(intRowCount); for (int i = 0; i < intRowCount; i++) { dr = dtTmp.Rows[i]; clsHospOrderCS_Vo objOrder = new clsHospOrderCS_Vo(); objOrder.m_strKind = p_objHospRecord.m_strKind; objOrder.m_strCreatorID = dr["creatorid_chr"].ToString(); objOrder.m_strCreateDoctor = dr["creator_chr"].ToString(); objOrder.m_strCreateDeptID = dr["createareaid_chr"].ToString(); objOrder.m_strCreateDept = dr["createareaname_vchr"].ToString(); objOrder.m_strOrderID = dr["orderid_chr"].ToString(); objOrder.m_strChargeItemID = dr["chargeitemid_chr"].ToString(); objOrder.m_strChargeItemName = dr["chargeitemname_chr"].ToString(); objOrder.m_strSpec = dr["spec_vchr"].ToString(); objOrder.m_dclAmount = decimal.Parse(dr["amount_dec"].ToString()); objOrder.m_dclPrice = decimal.Parse(dr["unitprice_dec"].ToString()); objOrder.m_strUnit = dr["unit_vchr"].ToString() == "" ? "[无]" : dr["unit_vchr"].ToString(); objOrder.m_intGroupNo = int.Parse(dr["recipeno_int"].ToString()); if (dr["createdate_dat"] != DBNull.Value) { objOrder.m_dtmCreateDate = DateTime.Parse(dr["createdate_dat"].ToString()); } if (dr["startdate_dat"] != DBNull.Value) { objOrder.m_dtmStartDT = DateTime.Parse(dr["startdate_dat"].ToString()); } if (dr["stopdate_dat"] != DBNull.Value) { objOrder.m_dtmStopDT = DateTime.Parse(dr["stopdate_dat"].ToString()); } if (dr["executetype_int"] != DBNull.Value) { objOrder.m_intOrderStauts = int.Parse(dr["executetype_int"].ToString()); if (dr["executetype_int"].ToString() == "1") { TimeSpan t = objOrder.m_dtmStopDT - objOrder.m_dtmStartDT; objOrder.m_intDays = t.Days; } else { objOrder.m_intDays = 0; } } objOrder.m_strRegisterID = m_strRegID; objOrder.m_intGroupNo = int.Parse(dr["recipeno_int"].ToString()); objOrder.m_strType = clsDataUpload_Svc.m_strConvertValue("ordertype", dr["executetype_int"].ToString(), ""); if (dr["flag_int"].ToString() == "0") { if (dr["dosage_dec"] == DBNull.Value) { try { objOrder.m_dclDosageUse = Convert.ToDecimal(dr["amount_dec"]); } catch { objOrder.m_dclDosageUse = 0; } } else { try { objOrder.m_dclDosageUse = Convert.ToDecimal(dr["dosage_dec"]); } catch { objOrder.m_dclDosageUse = 0; } } objOrder.m_strUseUnit = dr["dosageunit_chr"].ToString(); objOrder.m_strFrequencyName = clsDataUpload_Svc.m_strConvertValue("Frequency", dr["execfreqid_chr"].ToString(), ""); objOrder.m_strUsageType = clsDataUpload_Svc.m_strConvertValue("medicineusage", dr["dosetypeid_chr"].ToString(), ""); } objOrder.m_strINDeptID = dr["curareaid_chr"].ToString(); objOrder.m_strINDeptName = dr["curareaname"].ToString(); objOrder.m_strStopDoctor = dr["stoperid_chr"].ToString(); objOrder.m_strStopDoctorName = dr["stoper_chr"].ToString(); objOrder.m_strFarekind = clsDataUpload_Svc.m_strConvertValue("billkind", dr["itemipinvtype_chr"].ToString(), ""); objOrder.m_strCheckName = dr["sample_type_desc_vchr"].ToString(); objOrder.m_strCheckPark = dr["partname"].ToString(); objOrder.m_strRemark = dr["remark_vchr"].ToString(); objOrder.m_strITEMID = dr["drugid_chr"].ToString().Trim(); objOrder.m_strJXBZDM = dr["JXBZDM"].ToString().Trim(); //objOrder. m_glsHospOrder.Add(objOrder); } dtTmp.Dispose(); dtTmp = null; #endregion } catch (Exception objEx) { string strTmp = objEx.Message; com.digitalwave.Utility.clsLogText objLogger = new clsLogText(); bool blnRes = objLogger.LogError(objEx); } return(lngRes); }