/// <summary> /// 加载监护 /// </summary> private void loadCustody() { string sql = ""; if (true == cbAllPatient.IsChecked) { sql = string.Format(SQL.SEL_CUSTODY_BYDATE, ((DateTime)dpSDate.SelectedDate).ToString("yyyy-MM-dd"), ((DateTime)dpEDate.SelectedDate).AddDays(1).ToString("yyyy-MM-dd")); } else if (null == this.patient) { return; } else { sql = string.Format(SQL.SEL_CUSTODY_BYPNT2, this.patient.PatientCode); } DataTable tbl = null; if (AppConst.db.GetRecordSet(sql, ref tbl)) { BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(tbl.CreateDataReader()); string content = ""; while (bldr.next()) { content = WinCustodyEdit.getObjectStr(bldr.getInt("CustodyID")) + ". " + bldr.getString("CustodyDesc"); if (!bldr.isNull("FinishTime")) { content += ". (已结束)"; } this.tblOpRecord.Rows.Add(new object[] { "custody", bldr.getInt("CustodyID"), bldr.getString("DeptName"), bldr.getString("BedNo"), bldr.getString("PatientName"), bldr.getDateTime("CustodyTime"), content, ComClass.getEmpName(bldr.getString("Custodyer")) }); } bldr.close(); tbl.Clear(); } else { BLPublic.Dialogs.Error("加载监护失败:" + AppConst.db.Error); } }
private PatientModel getPatientInfo() { if (string.IsNullOrWhiteSpace(this.patientCode)) { return(null); } PatientModel pnt = null; IDataReader dr = null; //体格检查 if (AppConst.db.GetRecordSet(string.Format(SQL.SEL_PNTINFO, this.patientCode), ref dr)) { BLPublic.BLDataReader blDR = new BLPublic.BLDataReader(dr); if (blDR.next()) { string ageStr = ""; if (!blDR.isNull("Birthday")) { ageStr = BLPublic.Utils.getAgeStr(blDR.getDateTime("Birthday")); } pnt = new PatientModel() { WardName = blDR.getString("DeptName"), BedNo = blDR.getString("BedNo"), HospitalNo = blDR.getString("HospitalNo"), PatientName = blDR.getString("PatientName"), Age = ageStr, Sex = "f".Equals(blDR.getString("Sex")) ? "女" : "男" }; } blDR.close(); } return(pnt); }
private bool addRecipe(PatientModel _pnt) { DataTable tbl = new DataTable(); if (!AppConst.db.GetRecordSet(string.Format(SQL.SEL_PNT_TPN, _pnt.PatientCode) + " ORDER BY StartTime", ref tbl)) { BLPublic.Dialogs.Error("加载患者医嘱失败:" + AppConst.db.Error); return(false); } int no = 1; foreach (object obj in lvExpTPN.Items) { if (!string.IsNullOrWhiteSpace(((ExpTPNRecipe)obj).RecipeID) && !string.IsNullOrWhiteSpace(((ExpTPNRecipe)obj).BedNo)) { no++; } } string rcpIDs = ""; int startIndx = lvExpTPN.Items.Count; BLPublic.BLDataReader dr = new BLPublic.BLDataReader(tbl.CreateDataReader()); while (dr.next()) { rcpIDs += ",'" + dr.getString("RecipeID") + "'"; lvExpTPN.Items.Add(new ExpTPNRecipe() { No = (no++).ToString(), RecipeID = dr.getString("RecipeID"), PatientCode = _pnt.PatientCode, WardName = dr.getString("DeptName"), BedNo = dr.getString("BedNo"), PatientName = dr.getString("PatientName"), HospitalNo = dr.getString("HospitalNo"), Age = dr.getString("Age") + getAgeUnit(dr.getString("AgeUnit")), Sex = ComClass.getZhSex(dr.getString("Sex")), InHospitalTime = dr.isNull("InHospitalDT") ? "" : dr.getDateTime("InHospitalDT").ToString("yyyy-M-d"), Weight = "-", Height = "-", Diagnose = _pnt.Diagnose, TPNUseTime = dr.getDateTime("StartTime").ToString("yyyy-MM-dd HH:mm:ss") + " ~ " + (dr.isNull("StopTime") ? "" : dr.getDateTime("StopTime").ToString("yyyy-MM-dd HH:mm:ss")), StartTime = dr.getDateTime("StartTime"), Drugs = "", IsOK = "是" }); } dr.close(); tbl.Clear(); if (string.IsNullOrWhiteSpace(rcpIDs)) { return(true); } //加载医嘱内容 if (!AppConst.db.GetRecordSet(string.Format(SQL.SEL_ORDERSPREP_BYRCPs, rcpIDs.Substring(1)), ref tbl)) { BLPublic.Dialogs.Error("加载医嘱内容失败:" + AppConst.db.Error); return(false); } ExpTPNRecipe item = null; DataRow[] rows = null; int i = 0; int orderType = 0; string mntRcpIDs = ""; string tpnChkRcpIDs = ""; for (i = lvExpTPN.Items.Count - 1; i >= startIndx; i--) { item = (ExpTPNRecipe)lvExpTPN.Items[i]; if (string.IsNullOrWhiteSpace(item.RecipeID)) { continue; } rows = tbl.Select("RecipeID='" + item.RecipeID + "'"); foreach (DataRow r in rows) { if ("498".Equals(r["UniPreparationID"].ToString())) //卡文 { orderType = 498; break; } else if (0x07 > orderType) { orderType |= tpnmonitor.TPNMonitor.getPrepSAFType(Convert.ToInt32(r["UniPreparationID"].ToString())); } else { break; } } if (0 < rows.Length) { if (498 == orderType) { item.Drugs = "卡文"; tpnChkRcpIDs += ",'" + item.RecipeID + "'"; } else if (0x07 == orderType) { item.Drugs = "三合一"; mntRcpIDs += ",'" + item.RecipeID + "'"; } else if (0 < orderType) { item.Drugs = "二合一"; tpnChkRcpIDs += ",'" + item.RecipeID + "'"; } } } tbl.Clear(); if (!string.IsNullOrWhiteSpace(mntRcpIDs)) { monitorResult(mntRcpIDs.Substring(1), startIndx); } if (!string.IsNullOrWhiteSpace(tpnChkRcpIDs)) { comCheckResult(tpnChkRcpIDs.Substring(1), startIndx); } return(true); }