public long m_lngGetBultraSoundRecordInfo(DateTime p_dtmStartDate, DateTime p_dtmEndDate, out List <clsCheckRecord> p_lstRecord) { p_lstRecord = new List <clsCheckRecord>(); string strSql = @"select t.patientcardid_chr, t.inpatientid_chr, t.otherid_chr, t.checkdate_dat, t.reportdate_dat, t.reportdoctorid_chr, t.reportdoctor_chr, t.applydoctorid_chr, t.applydoctor_chr, '1', '超声检查', t.checkpart_chr, t.ultrasoundprompts_chr, case when t.positivenumber_int > 0 then '2' else '1' end, '0000252', '超声科', t.applydeptid_chr, t.applydepartment_chr, t2.sysfrom_int, t2.sourceitemid_vchr, t3.paytypeid_chr, t4.registerid_chr from t_ris_us_report t, (select a.applyid, b.sysfrom_int, max(b.sourceitemid_vchr) sourceitemid_vchr from ar_common_apply a, t_opr_attachrelation b where a.applyid = b.attachid_vchr and a.applydate between ? and ? group by a.applyid, b.sysfrom_int) t2, t_bse_patient t3, (select registerid_chr, a1.inpatientid_chr from t_opr_bih_register a1, (select inpatientid_chr, max(inpatientcount_int) as incount from t_opr_bih_register group by inpatientid_chr) b1 where a1.inpatientcount_int = b1.incount and a1.inpatientid_chr = b1.inpatientid_chr) t4 where t.status_int = 1 and t.applyid_chr = t2.applyid and t.patientid_chr = t3.patientid_chr and t.inpatientid_chr = t4.inpatientid_chr(+) and t.checkdate_dat between ? and ?"; long lngRes = 1; clsHRPTableService objHRPSvc = null; try { IDataParameter[] objDPArr = null; objHRPSvc = new clsHRPTableService(); objHRPSvc.CreateDatabaseParameter(4, out objDPArr); objDPArr[0].Value = p_dtmStartDate; objDPArr[1].Value = p_dtmEndDate; objDPArr[2].Value = p_dtmStartDate; objDPArr[3].Value = p_dtmEndDate; DataTable dtResult = null; lngRes = objHRPSvc.lngGetDataTableWithParameters(strSql, ref dtResult, objDPArr); if (dtResult != null && dtResult.Rows.Count > 0) { int intSource = 0; clsCheckRecord record = null; foreach (DataRow row in dtResult.Rows) { record = new clsCheckRecord(); record.m_strVisitNo = row[0].ToString().Trim(); record.m_strInHossSeqNo = row[1].ToString().Trim(); record.m_strCheckRecordID = row[2].ToString().Trim(); record.m_dtmCheckRecordAppDate = Convert.ToDateTime(row[3]); record.m_dtmCheckRecordDate = Convert.ToDateTime(row[4]); record.m_strClinicianCode = row[5].ToString().Trim(); record.m_strClinicianName = row[6].ToString().Trim(); record.m_strClinicianAppCode = row[7].ToString().Trim(); record.m_strClinicianAppName = row[8].ToString().Trim(); record.m_strCheckReocrdApparatus = ""; record.m_strCheckRecordType = row[9].ToString().Trim();; record.m_strCheckRecordSubName = row[10].ToString().Trim(); record.m_strCheckSite = row[11].ToString(); record.m_strCheckRecordContent = row[12].ToString(); record.m_strCheckRecordResult = row[13].ToString().Trim();; record.m_strCheckRecordDeptCode = row[14].ToString(); record.m_strCheckRecordDeptName = row[15].ToString(); record.m_strCheckRecordAppDeptCode = row[16].ToString(); record.m_strCheckRecordAppDeptName = row[17].ToString(); if (!Convert.IsDBNull(row[20])) { record.m_strKind = clsDataUpload_Svc.m_strConvertValue("kind", row[20].ToString(), ""); } if (!Convert.IsDBNull(row[18])) { try { intSource = Convert.ToInt32(row[18]); } catch { } } if (intSource == 1 && !Convert.IsDBNull(row[19])) { record.m_strVisitNo = row[19].ToString().Trim(); } else if (intSource == 2 && !Convert.IsDBNull(row[21])) { record.m_strInHossSeqNo = row[21].ToString().Trim(); } record.m_strInvalid = "1"; p_lstRecord.Add(record); } } } catch (Exception objEx) { lngRes = 0; clsLogText objLogger = new clsLogText(); objLogger.LogError(objEx); } finally { objHRPSvc.Dispose(); } return(lngRes); }
public long m_lngGetPACSRecordInfo(DateTime p_dtmStartDate, DateTime p_dtmEndDate, out List <clsCheckRecord> p_lstRecord) { p_lstRecord = new List <clsCheckRecord>(); string strSql = @"select t1.order_no_vchr, t2.examinedate, t1.modify_dat, t1.doctor_id_chr, t1.doctor_name_vchr, t2.reportdoctorid, t2.reportdoctorname, t4.machine_name_vhar, case when t3.category_id_chr = '0000' then '5' when t3.category_id_chr = '0001' then '3' when t3.category_id_chr = '0002' then '3' end as category_id_chr, t1.part_vchr, t2.examineprompt, case when t2.positive_int = 0 then '1' when t2.positive_int = 1 then '2' else '0' end as checkrecordresult, t1.dept_id_chr, t1.dept_name_vchr, t7.paytypeid_chr, t8.sysfrom_int, t8.sourceitemid_vchr, t9.registerid_chr, decode(t1.pstatus_int,0,'1','0') pstatus from t_opr_pacs_booking_order t1, imagereport t2, t_bse_pacs_check_category t3, t_bse_pacs_machine t4, t_bse_patient t7, (select a.applyid, b.sysfrom_int, max(b.sourceitemid_vchr) sourceitemid_vchr from ar_common_apply a, t_opr_attachrelation b where a.applyid = b.attachid_vchr and a.applydate between ? and ? group by a.applyid, b.sysfrom_int) t8, (select registerid_chr, a1.inpatientid_chr,a1.patientid_chr from t_opr_bih_register a1, (select inpatientid_chr, max(inpatientcount_int) as incount from t_opr_bih_register group by inpatientid_chr) b1 where a1.inpatientcount_int = b1.incount and a1.inpatientid_chr = b1.inpatientid_chr) t9 where t1.reportid = t2.reportid and t1.machine_id = t4.machine_id_chr and t4.category_id_chr = t3.category_id_chr and t1.patient_id_chr = t7.patientid_chr and t1.app_order_id_chr = t8.applyid(+) and t1.pstatus_int <> -1 and t2.status = 2 and t1.inpatient_no_chr = t9.inpatientid_chr(+) and t2.examinedate between ? and ?"; long lngRes = 1; clsHRPTableService objHRPSvc = null; try { IDataParameter[] objDPArr = null; objHRPSvc = new clsHRPTableService(); objHRPSvc.CreateDatabaseParameter(4, out objDPArr); objDPArr[0].Value = p_dtmStartDate; objDPArr[1].Value = p_dtmEndDate; objDPArr[2].Value = p_dtmStartDate; objDPArr[3].Value = p_dtmEndDate; DataTable dtResult = null; lngRes = objHRPSvc.lngGetDataTableWithParameters(strSql, ref dtResult, objDPArr); if (dtResult != null && dtResult.Rows.Count > 0) { clsCheckRecord record = null; int intSource = 0; foreach (DataRow row in dtResult.Rows) { record = new clsCheckRecord(); record.m_strCheckRecordID = row[0].ToString().Trim() + Convert.ToDateTime(row[2]).ToString("yyyyMMddHHmmss"); record.m_dtmCheckRecordAppDate = Convert.ToDateTime(row[1]); record.m_dtmCheckRecordDate = Convert.ToDateTime(row[2]); record.m_strClinicianCode = row[3].ToString().Trim(); record.m_strClinicianName = row[4].ToString().Trim(); record.m_strClinicianAppCode = row[5].ToString().Trim(); record.m_strClinicianAppName = row[6].ToString().Trim(); record.m_strCheckReocrdApparatus = row[7].ToString().Trim(); record.m_strCheckRecordType = row[8].ToString().Trim(); record.m_strCheckRecordSubName = "放射科检查"; record.m_strCheckSite = row[9].ToString(); record.m_strCheckRecordContent = row[10].ToString(); record.m_strCheckRecordResult = row[11].ToString(); record.m_strCheckRecordDeptCode = row[12].ToString(); record.m_strCheckRecordDeptName = row[13].ToString(); //record.m_strCheckRecordAppDeptCode = row[16].ToString(); //record.m_strCheckRecordAppDeptName = row[17].ToString(); if (!Convert.IsDBNull(row[14])) { record.m_strKind = clsDataUpload_Svc.m_strConvertValue("kind", row[14].ToString(), ""); } if (!Convert.IsDBNull(row[15])) { try { intSource = Convert.ToInt32(row[15]); } catch { } } if (intSource == 1 && !Convert.IsDBNull(row[16])) { record.m_strVisitNo = row[16].ToString().Trim(); } else if (intSource == 2 && !Convert.IsDBNull(row[17])) { record.m_strInHossSeqNo = row[17].ToString().Trim(); } record.m_strInvalid = row[18].ToString().Trim(); p_lstRecord.Add(record); } } } catch (Exception objEx) { lngRes = 0; clsLogText objLogger = new clsLogText(); objLogger.LogError(objEx); } finally { objHRPSvc.Dispose(); } return(lngRes); }
public long m_lngGetRISRecordInfo(DateTime p_dtmStartDate, DateTime p_dtmEndDate, out List <clsCheckRecord> p_lstRecord) { p_lstRecord = new List <clsCheckRecord>(); string strSql = @"select t.patient_no_chr, t.inpatient_no_chr, t.report_id_chr, t.report_dat, a.applydate, a.doctorid_chr, a.doctorname, t.reportor_id_chr, t.reportor_name_vchr, a.diagnosepart, t.summary2_vchr, a.deptid_chr, a.department, t1.paytypeid_chr, t2.sysfrom_int, t2.sourceitemid_vchr, t3.registerid_chr from t_opr_ris_cardiogram_report t, ar_common_apply a, t_bse_patient t1, (select a.applyid, b.sysfrom_int, max(b.sourceitemid_vchr) sourceitemid_vchr from ar_common_apply a, t_opr_attachrelation b where a.applyid = b.attachid_vchr and a.applydate between ? and ? group by a.applyid, b.sysfrom_int) t2, (select registerid_chr, a1.inpatientid_chr from t_opr_bih_register a1, (select inpatientid_chr, max(inpatientcount_int) as incount from t_opr_bih_register group by inpatientid_chr) b1 where a1.inpatientcount_int = b1.incount and a1.inpatientid_chr = b1.inpatientid_chr) t3 where t.applyid_int = a.applyid(+) and t.patient_id_chr = t1.patientid_chr and t.applyid_int = t2.applyid(+) and t.inpatient_no_chr = t3.inpatientid_chr(+) and t.status_int = 1 and t.report_dat between ? and ?"; long lngRes = 1; clsHRPTableService objHRPSvc = null; try { IDataParameter[] objDPArr = null; DataTable dtResult = null; objHRPSvc = new clsHRPTableService(); objHRPSvc.CreateDatabaseParameter(4, out objDPArr); objDPArr[0].Value = p_dtmStartDate; objDPArr[1].Value = p_dtmEndDate; objDPArr[2].Value = p_dtmStartDate; objDPArr[3].Value = p_dtmEndDate; lngRes = objHRPSvc.lngGetDataTableWithParameters(strSql, ref dtResult, objDPArr); if (dtResult != null && dtResult.Rows.Count > 0) { clsCheckRecord record = null; int intSource = 0; foreach (DataRow row in dtResult.Rows) { record = new clsCheckRecord(); //record.m_strVisitNo = row[0].ToString().Trim(); //record.m_strInHossSeqNo = row[1].ToString().Trim(); record.m_strCheckRecordID = row[2].ToString().Trim(); if (!Convert.IsDBNull(row[3])) { record.m_dtmCheckRecordAppDate = Convert.ToDateTime(row[3]); } if (!Convert.IsDBNull(row[4])) { record.m_dtmCheckRecordDate = Convert.ToDateTime(row[4]); } record.m_strClinicianCode = row[5].ToString().Trim(); record.m_strClinicianName = row[6].ToString().Trim(); record.m_strClinicianAppCode = row[7].ToString().Trim(); record.m_strClinicianAppName = row[8].ToString().Trim(); record.m_strCheckReocrdApparatus = ""; record.m_strCheckRecordType = "2"; record.m_strCheckRecordSubName = "心电图检查"; record.m_strCheckSite = row[9].ToString(); record.m_strCheckRecordContent = row[10].ToString(); record.m_strCheckRecordResult = "0"; record.m_strCheckRecordDeptCode = row[11].ToString(); record.m_strCheckRecordDeptName = row[12].ToString(); record.m_strCheckRecordAppDeptCode = "0000253"; record.m_strCheckRecordAppDeptName = "心电图室"; record.m_strInvalid = "1"; if (!Convert.IsDBNull(row[13])) { clsDataUpload_Svc.m_strConvertValue("kind", row[13].ToString(), ""); } if (!Convert.IsDBNull(row[14])) { try { intSource = Convert.ToInt32(row[14]); } catch { } } if (intSource == 1 && !Convert.IsDBNull(row[15])) { record.m_strVisitNo = row[15].ToString().Trim(); } else if (intSource == 2 && !Convert.IsDBNull(row[16])) { record.m_strInHossSeqNo = row[16].ToString().Trim(); } p_lstRecord.Add(record); } } //strSql = @""; //objHRPSvc.CreateDatabaseParameter(2, out objDPArr); //objDPArr[0].Value = p_dtmStartDate; //objDPArr[1].Value = p_dtmEndDate; //lngRes = objHRPSvc.lngGetDataTableWithParameters(strSql, ref dtResult, objDPArr); //if (dtResult != null && dtResult.Rows.Count > 0) //{ // clsCheckRecord record = null; // foreach (DataRow row in dtResult.Rows) // { // record = new clsCheckRecord(); // record.m_strVisitNo = row[0].ToString().Trim(); // record.m_strInHossSeqNo = row[1].ToString().Trim(); // record.m_strCheckRecordID = row[2].ToString().Trim(); // record.m_dtmCheckRecordAppDate = Convert.ToDateTime(row[3]); // record.m_dtmCheckRecordDate = Convert.ToDateTime(row[4]); // record.m_strClinicianCode = row[5].ToString().Trim(); // record.m_strClinicianName = row[6].ToString().Trim(); // record.m_strClinicianAppCode = row[7].ToString().Trim(); // record.m_strClinicianAppName = row[8].ToString().Trim(); // record.m_strCheckReocrdApparatus = ""; // record.m_strCheckRecordType = "2"; // record.m_strCheckRecordSubName = "心电图检查"; // record.m_strCheckSite = row[9].ToString(); // record.m_strCheckRecordContent = row[10].ToString(); // record.m_strCheckRecordResult = "0"; // record.m_strCheckRecordDeptCode = row[11].ToString(); // record.m_strCheckRecordDeptName = row[12].ToString(); // record.m_strCheckRecordAppDeptCode = "0000253"; // record.m_strCheckRecordAppDeptName = "心电图室"; // p_lstRecord.Add(record); // } //} } catch (Exception objEx) { lngRes = 0; clsLogText objLogger = new clsLogText(); objLogger.LogError(objEx); } finally { objHRPSvc.Dispose(); } return(lngRes); }
/// <summary> /// 读取检查信息 /// </summary> /// <param name="p_dtmStartDate">起始日期</param> /// <param name="p_dtmEndDate">截止日期</param> /// <param name="p_lstRecord"></param> /// <returns></returns> public long m_lngGetCheckInfo(DateTime p_dtmStartDate, DateTime p_dtmEndDate, out List <clsCheckRecord> p_lstRecord, out List <clsCheckPic> p_lstPic) { long lngRes = -1; p_lstRecord = new List <clsCheckRecord>(); p_lstPic = new List <clsCheckPic>(); clsCheckQuery_Svc objSvc = (clsCheckQuery_Svc)clsObjectGenerator.objCreatorObjectByType(typeof(clsCheckQuery_Svc)); List <clsCheckRecord> lstRecord = null; List <clsCheckPic> lstPic = null; objSvc.m_lngGetPACSRecordInfo(p_dtmStartDate, p_dtmEndDate, out lstRecord); objSvc.m_lngGetPACSPicInfo(p_dtmStartDate, p_dtmEndDate, out lstPic); p_lstRecord.AddRange(lstRecord); p_lstPic.AddRange(lstPic); lstRecord = null; objSvc.m_lngGetRISRecordInfo(p_dtmStartDate, p_dtmEndDate, out lstRecord); p_lstRecord.AddRange(lstRecord); lstRecord = null; objSvc.m_lngGetBultraSoundRecordInfo(p_dtmStartDate, p_dtmEndDate, out lstRecord); clsImageFileManager objImageManager = new clsImageFileManager(); string strReportID = string.Empty; List <string> lstImagePath = null; clsLogText log = new clsLogText(); bool blnMissFile = false; foreach (clsCheckRecord objRecord in lstRecord) { try { objSvc.m_lngGetImageList(objRecord.m_strCheckRecordID, out lstImagePath); clsCheckPic pic = null; System.Drawing.Image objImg = null; byte[] bytImage = null; System.IO.MemoryStream objStream2 = null; int i = 1; foreach (string strImagePath in lstImagePath) { objImageManager.m_lngGetImage(strImagePath, out objImg); if (objImg == null) { log.LogError("归档文件丢失" + strImagePath); blnMissFile = true; continue; } pic = new clsCheckPic(); pic.m_strCheckRecordID = objRecord.m_strCheckRecordID; pic.m_strPicID = i.ToString(); pic.m_intPicType = 3; objStream2 = new MemoryStream(); objImg.Save(objStream2, System.Drawing.Imaging.ImageFormat.Jpeg); bytImage = objStream2.ToArray(); pic.m_bytPic = bytImage; p_lstPic.Add(pic); objImg = null; i++; } } catch (Exception ex) { log.LogError(ex.Message + ex.StackTrace); } } if (blnMissFile) { //MessageBox.Show(@"发现有归档文件丢失,文件列表记录在D:\code\logerror.txt"); } //objSvc.m_lngGetBultraSoundPicInfo(p_dtmStartDate, p_dtmEndDate, out lstPic); p_lstRecord.AddRange(lstRecord); //----------------------------------- //因为此处为多的合并,故在此处处理数据重复 //by huafeng.xiao Hashtable objHsTable = new Hashtable(); if (p_lstRecord != null && p_lstRecord.Count > 0) { lstRecord = new List <clsCheckRecord>(); int intCount = p_lstRecord.Count; for (int intI = 0; intI < intCount; intI++) { clsCheckRecord objRecord = p_lstRecord[intI]; try { objHsTable.Add(objRecord.m_strCheckRecordID + objRecord.m_strVisitNo + objRecord.m_strInHossSeqNo, ""); lstRecord.Add(objRecord); } catch { } } p_lstRecord.Clear(); p_lstRecord.AddRange(lstRecord);; } //----------------------------------- lstRecord = null; lstPic = null; objSvc = null; return(lngRes); }