//WF 20151031 public List <VitalInfo> GetVitalSignsByPeriod(DataConnection pclsCache, string UserId, int StartDate, int EndDate) { { List <VitalInfo> items = new List <VitalInfo>(); CacheCommand cmd = null; CacheDataReader cdr = null; try { if (!pclsCache.Connect()) { return(null); } cmd = new CacheCommand(); cmd = Ps.VitalSigns.GetVitalSignsByPeriod(pclsCache.CacheConnectionObject); cmd.Parameters.Add("UserId", CacheDbType.NVarChar).Value = UserId; cmd.Parameters.Add("StartDate", CacheDbType.NVarChar).Value = StartDate; cmd.Parameters.Add("EndDate", CacheDbType.NVarChar).Value = EndDate; cdr = cmd.ExecuteReader(); while (cdr.Read()) { VitalInfo item = new VitalInfo(); item.RecordDate = cdr["RecordDate"].ToString(); string time = cdr["RecordTime"].ToString(); switch (time.Length) { case 1: item.RecordTime = "00:0" + time; break; case 2: item.RecordTime = "00:" + time; break; case 3: item.RecordTime = "0" + time.Substring(0, 1) + ":" + time.Substring(1, 2); break; case 4: item.RecordTime = time.Substring(0, 2) + ":" + time.Substring(2, 2); break; } //item.RecordTime = cdr["RecordTime"].ToString(); item.ItemType = cdr["ItemType"].ToString(); item.ItemCode = cdr["ItemCode"].ToString(); item.Value = cdr["Value"].ToString(); item.Unit = cdr["Unit"].ToString(); item.Name = cdr["VitalName"].ToString(); items.Add(item); } return(items); } catch (Exception ex) { HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "VitalInfoMethod.GetVitalSignsByPeriod", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace); return(null); } finally { if ((cdr != null)) { cdr.Close(); cdr.Dispose(true); cdr = null; } if ((cmd != null)) { cmd.Parameters.Clear(); cmd.Dispose(); cmd = null; } pclsCache.DisConnect(); } } }
//GetClinicalInfo LS 2014-12-1 public static DataTable GetClinicalInfo(DataConnection pclsCache, string UserId) { DataTable list = new DataTable(); list.Columns.Add(new DataColumn("VisitId", typeof(int))); list.Columns.Add(new DataColumn("VisitType", typeof(int))); list.Columns.Add(new DataColumn("VisitTypeName", typeof(string))); list.Columns.Add(new DataColumn("AdmissionDate", typeof(int))); list.Columns.Add(new DataColumn("DischargeDate", typeof(int))); list.Columns.Add(new DataColumn("HospitalCode", typeof(string))); list.Columns.Add(new DataColumn("HospitalName", typeof(string))); list.Columns.Add(new DataColumn("Department", typeof(string))); list.Columns.Add(new DataColumn("DepartmentName", typeof(string))); CacheCommand cmd = null; CacheDataReader cdr = null; try { if (!pclsCache.Connect()) { //MessageBox.Show("Cache数据库连接失败"); return(null); } cmd = new CacheCommand(); cmd = Ps.ClinicalInfo.GetClinicalInfo(pclsCache.CacheConnectionObject); cmd.Parameters.Add("UserId", CacheDbType.NVarChar).Value = UserId; cdr = cmd.ExecuteReader(); while (cdr.Read()) { int DischargeDate; if (cdr["DischargeDate"].ToString() == "") { DischargeDate = 0; } else { DischargeDate = Convert.ToInt32(cdr["DischargeDate"]); } list.Rows.Add(Convert.ToInt32(cdr["VisitId"]), Convert.ToInt32(cdr["VisitType"]), cdr["VisitTypeName"].ToString(), Convert.ToInt32(cdr["AdmissionDate"]), DischargeDate, cdr["HospitalCode"].ToString(), cdr["HospitalName"].ToString(), cdr["Department"].ToString(), cdr["DepartmentName"].ToString()); } return(list); } catch (Exception ex) { HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "PsClinicalInfo.GetClinicalInfo", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace); return(null); } finally { if ((cdr != null)) { cdr.Close(); cdr.Dispose(true); cdr = null; } if ((cmd != null)) { cmd.Parameters.Clear(); cmd.Dispose(); cmd = null; } pclsCache.DisConnect(); } }
/// <summary> /// 从数据库拿出相关数据 并增加type字段 区别收缩压、舒张压、脉率 用于phone 体征详细时刻表 GL 2015-10-10 /// </summary> /// <param name="UserId"></param> /// <param name="ItemType"></param> /// <param name="ItemCode"></param> /// <param name="StartDate"></param> /// <param name="EndDate"></param> /// <returns></returns> public List <VitalInfo> GetTypedSignDetailByPeriod(DataConnection pclsCache, string UserId, string ItemType, string ItemCode, int StartDate, int EndDate) { { List <VitalInfo> items = new List <VitalInfo>(); CacheCommand cmd = null; CacheDataReader cdr = null; try { if (!pclsCache.Connect()) { return(null); } cmd = new CacheCommand(); cmd = Ps.VitalSigns.GetSignDetailByPeriod(pclsCache.CacheConnectionObject); cmd.Parameters.Add("UserId", CacheDbType.NVarChar).Value = UserId; cmd.Parameters.Add("ItemType", CacheDbType.NVarChar).Value = ItemType; cmd.Parameters.Add("ItemCode", CacheDbType.NVarChar).Value = ItemCode; cmd.Parameters.Add("StartDate", CacheDbType.NVarChar).Value = StartDate; cmd.Parameters.Add("EndDate", CacheDbType.NVarChar).Value = EndDate; cdr = cmd.ExecuteReader(); while (cdr.Read()) { VitalInfo item = new VitalInfo(); string RecordDate = cdr["RecordDate"].ToString(); RecordDate = RecordDate.Substring(0, 4) + "-" + RecordDate.Substring(4, 2) + "-" + RecordDate.Substring(6, 2); string SignType = ""; if (ItemCode == "Bloodpressure_1") //收缩压 { SignType = "1"; } else if (ItemCode == "Bloodpressure_2") //舒张压 { SignType = "2"; } else //脉率"Pulserate_1" { SignType = "3"; } item.SignType = SignType; item.RecordDate = RecordDate; item.RecordTime = new CommonFunction().TransTime(cdr["RecordTime"].ToString()); item.Value = cdr["Value"].ToString(); item.Unit = cdr["Unit"].ToString(); items.Add(item); } return(items); } catch (Exception ex) { HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "VitalInfoMethod.GetTypedSignDetailByPeriod", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace); return(null); } finally { if ((cdr != null)) { cdr.Close(); cdr.Dispose(true); cdr = null; } if ((cmd != null)) { cmd.Parameters.Clear(); cmd.Dispose(); cmd = null; } pclsCache.DisConnect(); } } }
//住院-转科处理 public static DataTable GetTransClinicalInfo(DataConnection pclsCache, string UserId, string VisitId) { //最终输出 DataTable DT_Clinical_Trans = new DataTable(); DT_Clinical_Trans.Columns.Add(new DataColumn("精确时间", typeof(DateTime))); //精确时间 转科的首要时间 定为转入时间 DT_Clinical_Trans.Columns.Add(new DataColumn("类型", typeof(string))); //区分标志: 转科 DT_Clinical_Trans.Columns.Add(new DataColumn("VisitId", typeof(string))); //即输入 DT_Clinical_Trans.Columns.Add(new DataColumn("事件", typeof(string))); // 主要指地点:从HospitalName + DepartmentName转出,哪里转入+(转科) //list.Columns.Add(new DataColumn("Key", typeof(string))); //搜索标志、关键属性:UserId+DateSort 可能后期开放 CacheCommand cmd = null; CacheDataReader cdr = null; try { if (!pclsCache.Connect()) { //MessageBox.Show("Cache数据库连接失败"); return(null); } //取出原始数据 DataTable DT_Clinical_Temp = new DataTable(); DT_Clinical_Temp.Columns.Add(new DataColumn("SortNo", typeof(int))); DT_Clinical_Temp.Columns.Add(new DataColumn("AdmissionDate", typeof(DateTime))); DT_Clinical_Temp.Columns.Add(new DataColumn("DischargeDate", typeof(DateTime))); //DT_Clinical_Temp.Columns.Add(new DataColumn("HospitalCode", typeof(string))); DT_Clinical_Temp.Columns.Add(new DataColumn("HospitalName", typeof(string))); //DT_Clinical_Temp.Columns.Add(new DataColumn("Department", typeof(string))); DT_Clinical_Temp.Columns.Add(new DataColumn("DepartmentName", typeof(string))); cmd = new CacheCommand(); cmd = Ps.InPatientInfo.GetInfobyVisitId(pclsCache.CacheConnectionObject); cmd.Parameters.Add("UserId", CacheDbType.NVarChar).Value = UserId; cmd.Parameters.Add("VisitId", CacheDbType.NVarChar).Value = VisitId; cdr = cmd.ExecuteReader(); while (cdr.Read()) { DT_Clinical_Temp.Rows.Add(Convert.ToInt32(cdr["SortNo"]), Convert.ToDateTime(cdr["AdmissionDate"]), Convert.ToDateTime(cdr["DischargeDate"]), cdr["HospitalName"].ToString(), cdr["DepartmentName"].ToString()); } //有转科 //转科处理 转科内容:什么时候从哪里转出,什么时候转到哪 if (DT_Clinical_Temp.Rows.Count > 1) { for (int n = 0; n < DT_Clinical_Temp.Rows.Count - 1; n++) { //医院+科室 //string things = DT_Clinical_Temp.Rows[n]["HospitalName"].ToString() + DT_Clinical_Temp.Rows[n]["DepartmentName"].ToString() + "(转出)" + " "; //things += DT_Clinical_Temp.Rows[n + 1]["HospitalName"].ToString() + DT_Clinical_Temp.Rows[n + 1]["DepartmentName"].ToString() + "(转入)"; //只科室 string things = DT_Clinical_Temp.Rows[n]["DepartmentName"].ToString() + "(转出)" + " "; things += DT_Clinical_Temp.Rows[n + 1]["DepartmentName"].ToString() + "(转入)"; DT_Clinical_Trans.Rows.Add(Convert.ToDateTime(DT_Clinical_Temp.Rows[n + 1]["AdmissionDate"]), "转科", VisitId, things); } } return(DT_Clinical_Trans); } catch (Exception ex) { HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "PsClinicalInfo.GetClinicalInfo", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace); return(null); } finally { if ((cdr != null)) { cdr.Close(); cdr.Dispose(true); cdr = null; } if ((cmd != null)) { cmd.Parameters.Clear(); cmd.Dispose(); cmd = null; } pclsCache.DisConnect(); } }
//住院(入院、出院)、门诊、急诊——住院拆分成入院、出院 再排序 共取出Num条 public static DataTable GetClinicalInfoNum(DataConnection pclsCache, string UserId, DateTime AdmissionDate, DateTime ClinicDate, int Num) { //实际最终输出 DataTable NewTable = new DataTable(); //最终输出(表格形式)【总不为空:会输出标记AdmissionDateMark和ClinicDateMark】 DateTime AdmissionDateMark = new DateTime(); //指针标记 放在NewTable最后 住院 DateTime ClinicDateMark = new DateTime(); //门诊 CacheCommand cmd = null; CacheDataReader cdr = null; try { if (!pclsCache.Connect()) { //MessageBox.Show("Cache数据库连接失败"); return(null); } DataTable list = new DataTable(); list.Columns.Add(new DataColumn("精确时间", typeof(DateTime))); //精确时间 到s list.Columns.Add(new DataColumn("类型", typeof(string))); //区分标志 目前只能 入院、出院、门诊、急诊、当前住院中 list.Columns.Add(new DataColumn("VisitId", typeof(string))); //阶段区分 list.Columns.Add(new DataColumn("事件", typeof(string))); // 主要指地点:HospitalName + DepartmentName+(类型) //list.Columns.Add(new DataColumn("Key", typeof(string))); //搜索标志、关键属性:UserId+DateSort 可能后期开放 NewTable = list.Clone(); #region 住院、门诊 取数据,放在list中 //Ps.InPatientInfo 取入院时间与出院时间 cmd = new CacheCommand(); cmd = Ps.InPatientInfo.GetInfobyDate(pclsCache.CacheConnectionObject); //只取了Num数量的VId,还需要取完整 cmd.Parameters.Add("UserId", CacheDbType.NVarChar).Value = UserId; cmd.Parameters.Add("AdmissionDate", CacheDbType.NVarChar).Value = AdmissionDate; cmd.Parameters.Add("Num", CacheDbType.NVarChar).Value = Num; cdr = cmd.ExecuteReader(); while (cdr.Read()) { //住院-入院(AdmissionDate肯定不为空) list.Rows.Add(Convert.ToDateTime(cdr["AdmissionDate"]), "入院", cdr["VisitId"].ToString(), cdr["HospitalName"].ToString() + ":" + cdr["DepartmentName"].ToString() + "(入院)"); //住院-出院(DischargeDate为1900/1/1 0:00:00,表示目前正在住院) 【注意:应该取该Vid下最大sortNo】 出院时间必须提前取出,考虑门诊在住院期间的情况 DateTime DischargeDate; DischargeDate = (DateTime)Ps.InPatientInfo.GetDischargeDate(pclsCache.CacheConnectionObject, UserId, cdr["VisitId"].ToString()); if (DischargeDate.ToString() == "9999/1/1 0:00:00") { DischargeDate = DateTime.Now; //取当前时间 list.Rows.Add(DischargeDate, "当前住院中", cdr["VisitId"].ToString(), cdr["HospitalName"].ToString() + ":" + cdr["DepartmentName"].ToString() + "(当前住院中)"); } else { //已经出院 list.Rows.Add(DischargeDate, "出院", cdr["VisitId"].ToString(), cdr["HospitalName"].ToString() + ":" + cdr["DepartmentName"].ToString() + "(出院)"); } } //Ps.OutPatientInfo 包括门诊和急诊 cmd = new CacheCommand(); cmd = Ps.OutPatientInfo.GetInfobyDate(pclsCache.CacheConnectionObject); cmd.Parameters.Add("UserId", CacheDbType.NVarChar).Value = UserId; cmd.Parameters.Add("ClinicDate", CacheDbType.NVarChar).Value = ClinicDate; cmd.Parameters.Add("Num", CacheDbType.NVarChar).Value = Num; cdr = cmd.ExecuteReader(); while (cdr.Read()) { //就诊时间(ClinicDate肯定不为空) //门诊 if (cdr["VisitId"].ToString().Substring(0, 1) == "O") { list.Rows.Add(Convert.ToDateTime(cdr["ClinicDate"]), "门诊", cdr["VisitId"].ToString(), cdr["HospitalName"].ToString() + ":" + cdr["DepartmentName"].ToString() + "(门诊)"); } //急诊 else { list.Rows.Add(Convert.ToDateTime(cdr["ClinicDate"]), "急诊", cdr["VisitId"].ToString(), cdr["HospitalName"].ToString() + ":" + cdr["DepartmentName"].ToString() + "(急诊)"); } } #endregion #region list有数据时→排序,取Num条,并确定标记 (注意:极端情况-住院期间嵌套很多门诊 解决方案,后期判断取够或到底为止,满足 门诊日期<入院日期) //就诊有数据时,排序→确定标记(取出<=Num条数据) if (list.Rows.Count > 0) //保证有数据 { //住院、门诊按时间排序 DataView dv = list.DefaultView; dv.Sort = "精确时间 desc"; //时间轴需要倒序 DataTable dtNew = dv.ToTable(); int NumMark = 0; int TypeMark = 0; //TypeMark:遇到入院,变为1;出院变为0 (确定是否在住院期间) int j = 0; int CoNum = 0; //从dtNew中拿出的实际条数 for (j = 0; j < dtNew.Rows.Count; j++) //for循环是在,内容执行完成后,j才加1;若中途break { if ((dtNew.Rows[j]["类型"].ToString() == "出院") || (dtNew.Rows[j]["类型"].ToString() == "当前住院中")) { TypeMark = 1; //表明在住院 } if (dtNew.Rows[j]["类型"].ToString() == "入院") { TypeMark = 0; //表明某一住院阶段结束 } if (((dtNew.Rows[j]["类型"].ToString() == "门诊") && (TypeMark == 0)) || ((dtNew.Rows[j]["类型"].ToString() == "急诊") && (TypeMark == 0))) { NumMark++; } //在住院期间的门诊不作为NumMark的计数 if (dtNew.Rows[j]["类型"].ToString() == "入院") { NumMark++; } if (NumMark == Num) { CoNum = j + 1; //break的时候 j不会继续自加直接跳出for循环 break; } } if (CoNum == 0) //不是所需条数达到Num、break的情况 { CoNum = j; } //分析:最后一条 要么是门诊(不在住院阶段),要么入院 //表格输出(注意入院和出院拆开了,一条变两条影响计数,所以用j,而不是Num) DataRow[] rows = list.Select("1=1"); for (int i = 0; i < CoNum; i++) //j+1的情况:是有剩余 【有问题:只有门诊的话 ,只取到j】 { //NewTable.ImportRow((DataRow)rows[i]); NewTable.Rows.Add(rows[i].ItemArray); } //获取两张表的当前标记 由于表默认取出(是按时间倒序,所以应该去最后一条,才是标记 //住院 string condition = " 类型 = '入院' "; DataRow[] InRows = NewTable.Select(condition, "精确时间 desc"); if (InRows == null || InRows.Length == 0) { AdmissionDateMark = AdmissionDate; } else { AdmissionDateMark = DateTime.Parse(InRows[InRows.Length - 1]["精确时间"].ToString()); } //门诊 condition = " 类型 = '门诊' or 类型 = '急诊'"; DataRow[] OutRows = NewTable.Select(condition, "精确时间 desc"); if (OutRows == null || OutRows.Length == 0) { ClinicDateMark = ClinicDate; } else { ClinicDateMark = DateTime.Parse(OutRows[OutRows.Length - 1]["精确时间"].ToString()); } //将两张表当前指针标记,放在表的最后,用VisitTypeName="标志",做区分 NewTable.Rows.Add(AdmissionDateMark, ClinicDateMark.ToString(), "指针", ""); } else { NewTable.Rows.Add(AdmissionDate, ClinicDate.ToString(), "指针", ""); } #endregion //DateSort、LeftShow、VisitTypeName、VisitId、Location return(NewTable); } catch (Exception ex) { HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "PsClinicalInfo.GetClinicalInfo", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace); return(null); } finally { if ((cdr != null)) { cdr.Close(); cdr.Dispose(true); cdr = null; } if ((cmd != null)) { cmd.Parameters.Clear(); cmd.Dispose(); cmd = null; } pclsCache.DisConnect(); } }
//ZAM 20150422 获取健康专员负责的所有患者列表 public static DataTable GetPatientsPlanByDoctorId(DataConnection pclsCache, string DoctorId, string Module) { DataTable list = new DataTable(); list.Columns.Add(new DataColumn("PatientId", typeof(string))); list.Columns.Add(new DataColumn("PlanNo", typeof(string))); list.Columns.Add(new DataColumn("StartDate", typeof(string))); list.Columns.Add(new DataColumn("EndDate", typeof(string))); list.Columns.Add(new DataColumn("TotalDays", typeof(string))); list.Columns.Add(new DataColumn("RemainingDays", typeof(string))); list.Columns.Add(new DataColumn("Status", typeof(string))); CacheCommand cmd = null; CacheDataReader cdr = null; try { if (!pclsCache.Connect()) { return(null); } cmd = new CacheCommand(); cmd = Ps.Plan.GetPatientsPlanByDoctorId(pclsCache.CacheConnectionObject); cmd.Parameters.Add("DoctorId", CacheDbType.NVarChar).Value = DoctorId; cmd.Parameters.Add("Module", CacheDbType.NVarChar).Value = Module; cdr = cmd.ExecuteReader(); while (cdr.Read()) { //DataCheck ZAM 2015-4-16 if (cdr["PatientId"].ToString() == string.Empty) { continue; } list.Rows.Add(cdr["PatientId"].ToString(), cdr["PlanNo"].ToString(), cdr["StartDate"].ToString(), cdr["EndDate"].ToString(), cdr["TotalDays"].ToString(), cdr["RemainingDays"].ToString(), cdr["Status"].ToString()); } return(list); } catch (Exception ex) { HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "Ps.Plan.GetPatientsPlanByDoctorId", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace); return(null); } finally { if ((cdr != null)) { cdr.Close(); cdr.Dispose(true); cdr = null; } if ((cmd != null)) { cmd.Parameters.Clear(); cmd.Dispose(); cmd = null; } pclsCache.DisConnect(); } }
//CSQ 20150714 public static DataTable GetNewExam(DataConnection pclsCache, string UserId) { DataTable list = new DataTable(); list.Columns.Add(new DataColumn("Name1", typeof(string))); list.Columns.Add(new DataColumn("Value1", typeof(string))); list.Columns.Add(new DataColumn("Name2", typeof(string))); list.Columns.Add(new DataColumn("Value2", typeof(string))); list.Columns.Add(new DataColumn("Name3", typeof(string))); list.Columns.Add(new DataColumn("Value3", typeof(string))); CacheCommand cmd = null; CacheDataReader cdr = null; try { if (!pclsCache.Connect()) { return(null); } cmd = new CacheCommand(); cmd = Ps.Examination.GetNewExam(pclsCache.CacheConnectionObject); cmd.Parameters.Add("UserId", CacheDbType.NVarChar).Value = UserId; cdr = cmd.ExecuteReader(); while (cdr.Read()) { //string ExamDateShow = "", ReportDateShow = ""; //string str = cdr["ExamDate"].ToString(); //if (str != "0") //{ // ExamDateShow = str.Substring(0, 4) + "-" + str.Substring(4, 2) + "-" + str.Substring(6, 2); //} //string str1 = cdr["ReportDate"].ToString(); //if (str1 != "0") //{ // ReportDateShow = str1.Substring(0, 4) + "-" + str1.Substring(4, 2) + "-" + str1.Substring(6, 2); //} list.Rows.Add(cdr["Name1"].ToString(), cdr["Value1"].ToString(), cdr["Name2"].ToString(), cdr["Value2"].ToString(), cdr["Name3"].ToString(), cdr["Value3"].ToString()); } return(list); } catch (Exception ex) { HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "Ps.Examination.GetNewExam", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace); return(null); } finally { if ((cdr != null)) { cdr.Close(); cdr.Dispose(true); cdr = null; } if ((cmd != null)) { cmd.Parameters.Clear(); cmd.Dispose(); cmd = null; } pclsCache.DisConnect(); } }
//CSQ 2015-3-11 public static DataTable GetExaminationList(DataConnection pclsCache, string piUserId, string piVisitId) { DataTable list = new DataTable(); list.Columns.Add(new DataColumn("VisitId", typeof(string))); list.Columns.Add(new DataColumn("SortNo", typeof(string))); list.Columns.Add(new DataColumn("ExamType", typeof(string))); list.Columns.Add(new DataColumn("ExamTypeName", typeof(string))); list.Columns.Add(new DataColumn("ExamDate", typeof(string))); list.Columns.Add(new DataColumn("ItemCode", typeof(string))); list.Columns.Add(new DataColumn("ItemName", typeof(string))); list.Columns.Add(new DataColumn("ExamPara", typeof(string))); list.Columns.Add(new DataColumn("Description", typeof(string))); list.Columns.Add(new DataColumn("Impression", typeof(string))); list.Columns.Add(new DataColumn("Recommendation", typeof(string))); list.Columns.Add(new DataColumn("IsAbnormalCode", typeof(string))); list.Columns.Add(new DataColumn("IsAbnormal", typeof(string))); list.Columns.Add(new DataColumn("StatusCode", typeof(string))); list.Columns.Add(new DataColumn("Status", typeof(string))); list.Columns.Add(new DataColumn("ReportDate", typeof(string))); list.Columns.Add(new DataColumn("ImageURL", typeof(string))); list.Columns.Add(new DataColumn("DeptCode", typeof(string))); list.Columns.Add(new DataColumn("DeptName", typeof(string))); //list.Columns.Add(new DataColumn("ExamDateShow", typeof(string))); //list.Columns.Add(new DataColumn("ReportDateShow", typeof(string))); list.Columns.Add(new DataColumn("Creator", typeof(string))); list.Columns.Add(new DataColumn("ExamDateCom", typeof(string))); //20150709 LS CacheCommand cmd = null; CacheDataReader cdr = null; try { if (!pclsCache.Connect()) { return(null); } cmd = new CacheCommand(); cmd = Ps.Examination.GetExaminationList(pclsCache.CacheConnectionObject); cmd.Parameters.Add("piUserId", CacheDbType.NVarChar).Value = piUserId; cmd.Parameters.Add("piVisitId", CacheDbType.NVarChar).Value = piVisitId; cdr = cmd.ExecuteReader(); while (cdr.Read()) { //string ExamDateShow = "", ReportDateShow = ""; //string str = cdr["ExamDate"].ToString(); //if (str != "0") //{ // ExamDateShow = str.Substring(0, 4) + "-" + str.Substring(4, 2) + "-" + str.Substring(6, 2); //} //string str1 = cdr["ReportDate"].ToString(); //if (str1 != "0") //{ // ReportDateShow = str1.Substring(0, 4) + "-" + str1.Substring(4, 2) + "-" + str1.Substring(6, 2); //} string ReportDateShow = ""; if (cdr["ReportDate"].ToString() == "9999/1/1 0:00:00") { ReportDateShow = ""; } else { ReportDateShow = cdr["ReportDate"].ToString(); } list.Rows.Add(cdr["VisitId"].ToString(), cdr["SortNo"].ToString(), cdr["ExamType"].ToString(), cdr["ExamTypeName"].ToString(), cdr["ExamDate"].ToString(), cdr["ItemCode"].ToString(), cdr["ItemName"].ToString(), cdr["ExamPara"].ToString(), cdr["Description"].ToString(), cdr["Impression"].ToString(), cdr["Recommendation"].ToString(), cdr["IsAbnormalCode"].ToString(), cdr["IsAbnormal"].ToString(), cdr["StatusCode"].ToString(), cdr["Status"].ToString(), ReportDateShow, cdr["ImageURL"].ToString(), cdr["DeptCode"].ToString(), cdr["DeptName"].ToString(), cdr["Creator"].ToString(), Convert.ToDateTime(cdr["ExamDate"]).ToString("yyyy-MM-dd HH:mm:ss")); } return(list); } catch (Exception ex) { HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "Ps.Examination.GetExaminationList", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace); return(null); } finally { if ((cdr != null)) { cdr.Close(); cdr.Dispose(true); cdr = null; } if ((cmd != null)) { cmd.Parameters.Clear(); cmd.Dispose(); cmd = null; } pclsCache.DisConnect(); } }