private void loadPatient(DataSet dsPatient) { lvPatient.Items.Clear(); string ageStr = ""; int ageMonths = 0; if (dsPatient != null && dsPatient.Tables.Count > 0 && dsPatient.Tables[0].Rows.Count > 0) { DateTime birthday = DateTime.Now; foreach (DataRow item in dsPatient.Tables[0].Rows) { if (item["Birthday"] != DBNull.Value)//生日为空 { birthday = DateTime.Parse(item["Birthday"].ToString()); } ageStr = BLPublic.Utils.getAge(birthday, out ageMonths); lvPatient.Items.Add(new PatientModel { PatientCode = item["PatientCode"].ToString().Trim(), WardCode = item["DeptCode"].ToString().Trim(), WardName = item["DeptName"].ToString().Trim(), BedNo = item["BedNo"].ToString().Trim(), HospitalNo = item["HospitalNo"].ToString().Trim(), PatientName = item["PatientName"].ToString().Trim(), Age = ageStr, AgeMonth = ageMonths, Sex = ComClass.getZhSex(item["Sex"].ToString().Trim()), IsHospital = true,//csw修改,赋值为常量true,原是从数据集中获取,修改sql后不再获取 HadNotCheckOrders = dsNoReviewTpnOfPatient.Tables[0].Select("PatientCode = " + item["PatientCode"].ToString().Trim()).Length == 1, HadTodayOrders = dsTodayTpnOfPatient.Tables[0].Select("PatientCode = " + item["PatientCode"].ToString().Trim()).Length == 1, }); } } txtPatientNum.Text = "患者数:" + lvPatient.Items.Count.ToString(); }
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); }