public long m_lngGetPACSPicInfo(DateTime p_dtmStartDate, DateTime p_dtmEndDate, out List <clsCheckPic> p_lstPic) { p_lstPic = new List <clsCheckPic>(); // string strSql = @"select t4.order_id_chr, t1.seriesuid, t1.imagenumber, t1.smallimage, // t4.part_id_chr,t4.machine_id,t4.check_date_dat,t4.modify_dat // from dicom.images t1, // dicom.series t2, // dicom.studies t3, // t_opr_pacs_booking_order t4, // imagereport t5 // where t1.seriesuid = t2.seriesuid(+) // and t2.studyuid = t3.studyuid(+) // and t3.patientid = t4.order_no_vchr(+) // and t4.reportid = t5.reportid // and t5.status = 2 // and t5.aduitdate between ? and ?"; string strSql = @"select '' order_id_chr, t1.seriesuid, t1.imagenumber, t1.smallimage, '' part_id_chr,'' machine_id,'' check_date_dat,'' modify_dat ,t3.patientid from images t1, series t2, studies t3 where t1.seriesuid = t2.seriesuid(+) and t2.studyuid = t3.studyuid(+) --查询pacs and t3.patientid in "; string strSql1 = @"select t4.order_id_chr,t4.part_id_chr,t4.machine_id,t4.check_date_dat,t4.modify_dat,t4.order_no_vchr from t_opr_pacs_booking_order t4, imagereport t5 where t4.reportid = t5.reportid(+) and t5.status = 2 and t5.aduitdate between ? and ? --查询icare"; long lngRes = 1; clsHRPTableService objHRPSvc = null; clsHRPTableService objHRPSvcPacs = null; objHRPSvcPacs = new clsHRPTableService(); try { //查询icare IDataParameter[] objDPArr = null; objHRPSvc = new clsHRPTableService(); objHRPSvc.CreateDatabaseParameter(2, out objDPArr); objDPArr[0].Value = p_dtmStartDate; objDPArr[1].Value = p_dtmEndDate; DataTable dtResultIcare = null; lngRes = objHRPSvc.lngGetDataTableWithParameters(strSql1, ref dtResultIcare, objDPArr); StringBuilder sb = new StringBuilder(); if (dtResultIcare.Rows.Count > 0) { sb.Append("("); foreach (DataRow dricare in dtResultIcare.Rows) { sb.Append("'" + dricare["order_no_vchr"].ToString() + "',"); } sb.Append("'ABC')"); } else { return(-1); } strSql += sb.ToString(); //查询pacs //objHRPSvcPacs = new clsHRPTableService(); objHRPSvcPacs.m_bytSetOtherDSN = (byte)com.digitalwave.iCare.middletier.HRPService.clsHRPTableService.enumDatabase.bytPACS; DataTable dtResultPacs = null; lngRes = objHRPSvcPacs.lngGetDataTableWithoutParameters(strSql, ref dtResultPacs); if (dtResultPacs.Rows.Count > 0) { foreach (DataRow dricare in dtResultIcare.Rows) { DataRow[] drArr = dtResultPacs.Select("patientid = '" + dricare["order_no_vchr"].ToString() + "'"); int i = 0; foreach (DataRow drpacs in drArr) { drArr[i]["order_id_chr"] = dricare["order_id_chr"].ToString(); drArr[i]["part_id_chr"] = dricare["part_id_chr"].ToString(); drArr[i]["machine_id"] = dricare["machine_id"].ToString(); drArr[i]["check_date_dat"] = dricare["check_date_dat"].ToString(); drArr[i]["modify_dat"] = dricare["modify_dat"].ToString(); i++; } } } else { return(-1); } if (dtResultPacs != null && dtResultPacs.Rows.Count > 0) { clsCheckPic pic = null; System.Drawing.Image objImg = null; System.IO.MemoryStream objStream = null; byte[] bytImage = null; System.IO.MemoryStream objStream2 = null; foreach (DataRow row in dtResultPacs.Rows) { pic = new clsCheckPic(); pic.m_strCheckRecordID = row[0].ToString() + Convert.ToDateTime(row[7]).ToString("yyyyMMddHHmmss"); pic.m_strPicID = row[2].ToString(); pic.m_intPicType = 3; pic.m_strCheckSite = row[4].ToString(); pic.m_strCheckRecordAppAratus = row[5].ToString(); DateTime dtTime; if (DateTime.TryParse(row[6].ToString(), out dtTime)) { pic.m_strSystemTime = dtTime; } objStream = new MemoryStream((byte[])row[3]); objStream2 = new MemoryStream(); objImg = new System.Drawing.Bitmap(objStream); objImg = new System.Drawing.Bitmap(objImg, objImg.Width * 2, objImg.Height * 2); objImg.Save(objStream2, System.Drawing.Imaging.ImageFormat.Jpeg); bytImage = objStream2.ToArray(); pic.m_bytPic = bytImage; p_lstPic.Add(pic); } } } catch (Exception objEx) { lngRes = 0; clsLogText objLogger = new clsLogText(); objLogger.LogError(objEx); } finally { objHRPSvc.Dispose(); objHRPSvcPacs.Dispose(); } return(lngRes); }
public long m_lngGetBultraSoundPicInfo(DateTime p_dtmStartDate, DateTime p_dtmEndDate, out List <clsCheckPic> p_lstPic) { p_lstPic = new List <clsCheckPic>(); string strSql = @"select d.ctl_content, a.imageid, 3, a.imagecontent from ar_image a, (select b1.recordid from ar_apply_report b1 where b1.opendate between ? and ? and b1.delstatus = 0 and b1.sendstatus = 1) b, (select c.recordid, c.ctl_content from ar_content c where c.controlid = 'm_txtBultraSoundID') d where b.recordid = a.recordid and b.recordid = d.recordid"; long lngRes = 1; clsHRPTableService objHRPSvc = null; try { IDataParameter[] objDPArr = null; objHRPSvc = new clsHRPTableService(); objHRPSvc.m_bytSetOtherDSN = (byte)com.digitalwave.iCare.middletier.HRPService.clsHRPTableService.enumDatabase.bytPACS; objHRPSvc.CreateDatabaseParameter(2, out objDPArr); objDPArr[0].Value = p_dtmStartDate; objDPArr[1].Value = p_dtmEndDate; DataTable dtResult = null; lngRes = objHRPSvc.lngGetDataTableWithParameters(strSql, ref dtResult, objDPArr); if (dtResult != null && dtResult.Rows.Count > 0) { clsCheckPic pic = null; System.Drawing.Image objImg = null; System.IO.MemoryStream objStream = null; byte[] bytImage = null; System.IO.MemoryStream objStream2 = null; foreach (DataRow row in dtResult.Rows) { pic = new clsCheckPic(); pic.m_strCheckRecordID = row[0].ToString(); pic.m_strPicID = row[1].ToString(); pic.m_intPicType = 3; objStream = new MemoryStream((byte[])row[3]); objStream2 = new MemoryStream(); objImg = new System.Drawing.Bitmap(objStream); objImg.Save(objStream2, System.Drawing.Imaging.ImageFormat.Jpeg); bytImage = objStream2.ToArray(); pic.m_bytPic = bytImage; p_lstPic.Add(pic); objImg = null; } } } 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); }