You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					
					
						
							209 lines
						
					
					
						
							9.7 KiB
						
					
					
				
			
		
		
	
	
							209 lines
						
					
					
						
							9.7 KiB
						
					
					
				| package com.ynxbd.common.dao.lis;
 | |
| 
 | |
| import com.alibaba.fastjson.JSONObject;
 | |
| import com.ynxbd.common.bean.lis.*;
 | |
| import com.ynxbd.common.helper.common.Base64Helper;
 | |
| import com.ynxbd.common.helper.common.DateHelper;
 | |
| import com.ynxbd.common.helper.common.JsonHelper;
 | |
| import com.ynxbd.common.helper.lis.RMLisHelper;
 | |
| import com.ynxbd.common.result.JsonResult;
 | |
| import com.ynxbd.common.result.Result;
 | |
| import com.ynxbd.common.result.ResultEnum;
 | |
| import com.ynxbd.wx.wxfactory.ReqParamHelper;
 | |
| import lombok.extern.slf4j.Slf4j;
 | |
| import org.apache.commons.lang3.ObjectUtils;
 | |
| 
 | |
| import java.util.ArrayList;
 | |
| import java.util.List;
 | |
| import java.util.stream.Collectors;
 | |
| 
 | |
| 
 | |
| @Slf4j
 | |
| public class RMLisDao {
 | |
| 
 | |
|     public static Result downLisReport(String queryType, String queryCode) {
 | |
|         if (ObjectUtils.isEmpty(queryCode)) {
 | |
|             return Result.error(ResultEnum.PARAM_IS_DEFECT);
 | |
|         }
 | |
| 
 | |
|         JsonResult jsonResult = RMLisHelper.getJsonResult("GetReportFile", params -> {
 | |
|             params.put("QueryType", (queryType == null || "".equals(queryType)) ? "1" : queryType);
 | |
|             params.put("QueryCode", queryCode);
 | |
|         });
 | |
| 
 | |
|         if (!jsonResult.success()) {
 | |
|             return Result.error(jsonResult.getMessage());
 | |
|         }
 | |
| 
 | |
|         List<String> files = jsonResult.getDataMapList(String.class, "Files", "File");
 | |
|         List<String> filePdfList = new ArrayList<>();
 | |
|         JSONObject jsonObj;
 | |
|         String file;
 | |
|         for (String fileJson : files) {
 | |
|             jsonObj = JsonHelper.parseObject(fileJson);
 | |
|             if (jsonObj != null) {
 | |
|                  file = Base64Helper.pdfBaseToImgBase(jsonObj.getString("FileContent"), 150);
 | |
|                 if (file != null) {
 | |
|                     filePdfList.add(file);
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         return Result.success(filePdfList);
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      *
 | |
|      * @param queryType 查询类别
 | |
|      * 1:pat_no 病人号
 | |
|      * 2:pat_cardno 就诊卡号
 | |
|      * 3:barcode 标本条码号
 | |
|      * 4:pat_idcardno + pat_name 身份证号+姓名 5:pat_idcardno 身份证号
 | |
|      * 6:pat_id 病人 ID
 | |
|      * @param queryCode 查询值
 | |
|      * @param queryEx1 查询值
 | |
|      * 2021.9.15 新增QueryType为4时, QueryEx1传入病人姓名且为必填参数
 | |
|      * @param dateBegin 开始时间
 | |
|      * @param dateEnd 结束时间
 | |
|      * @param withOrder 返回申请信息 1 表示同时返回申请信息 不传默认 0
 | |
|      * @return
 | |
|      */
 | |
|     public static List<XBDLisReport> getReportList(String queryType,String queryCode, String dateBegin,String dateEnd,String withOrder){
 | |
|         JsonResult jsonResult = RMLisHelper.getJsonResult("GetReportList", params -> {
 | |
|             params.put("QueryType", (queryType == null || "".equals(queryType)) ? "1" : queryType);
 | |
|             params.put("QueryCode", queryCode);
 | |
|             params.put("DateBegin",dateBegin);
 | |
|             params.put("DateEnd",dateEnd);
 | |
|             params.put("WithOrder",withOrder);
 | |
|         });
 | |
|         if (!jsonResult.success()) {
 | |
|             log.error("[瑞美lis]报告单列表请求失败-queryCode={};queryType={}]",queryCode,queryType);
 | |
|             return null;
 | |
|         }
 | |
| 
 | |
|         List<RMLisReport> reportList = jsonResult.getDataMapList(RMLisReport.class, "Items", "Item");
 | |
|         //已审核报告单
 | |
|         reportList = reportList.stream().filter(p->p.getIsRechk()=="1").collect(Collectors.toList());
 | |
|         List<XBDLisReport> xbdReportList = new ArrayList<>();
 | |
|         for(RMLisReport report : reportList){
 | |
|             XBDLisReport xbdLisReport = new XBDLisReport();
 | |
|             xbdLisReport.setReqItemName(report.getOrderItems().get(0).getProjectName());
 | |
|             xbdLisReport.setReqDate(DateHelper.DateTimeToString(report.getOrderItems().get(0).getRequestTime()));
 | |
|             xbdLisReport.setEnReportId(ReqParamHelper.encode(report.getReportID()));
 | |
|             xbdLisReport.setReportType(report.getReportType());
 | |
|             xbdLisReport.setPatientType(report.getPatientKind());
 | |
|             xbdLisReport.setReportDate(DateHelper.DateTimeToString(report.getRechkDate()));
 | |
|             xbdLisReport.setReporter(report.getRechkUserName());
 | |
|             xbdLisReport.setTreatId(report.getPatientNo());
 | |
|             xbdLisReport.setSampleCode(report.getBarcode());
 | |
|             xbdLisReport.setPatientName(report.getPatientName());
 | |
|             xbdLisReport.setSex(report.getGender());
 | |
|             xbdLisReport.setAge(report.getAge());
 | |
|             xbdLisReport.setReqDeptName(report.getDeptName());
 | |
|             xbdLisReport.setBedNo(report.getBedNo());
 | |
|             xbdLisReport.setReqDoctName(report.getDoctorName());
 | |
|             xbdReportList.add(xbdLisReport);
 | |
|         }
 | |
|         return xbdReportList;
 | |
|     }
 | |
| 
 | |
| 
 | |
|     public  static  List<XBDLisResult> getReportResult(String reportId){
 | |
|         JsonResult jsonResult = RMLisHelper.getJsonResult("GetReportResult", params -> {
 | |
|             params.put("ReportID",reportId);
 | |
|         });
 | |
|         if (!jsonResult.success()) {
 | |
|             log.error("[瑞美lis]普通报告单请求失败-reportId={}]",reportId);
 | |
|             return null;
 | |
|         }
 | |
|         List<RMLisResult> resultList = jsonResult.getDataMapList(RMLisResult.class, "GeneralItems", "GeneralItem");
 | |
|         List<XBDLisResult> xbdLisResultList = new ArrayList<>();
 | |
|         for(RMLisResult result:resultList){
 | |
|             XBDLisResult xbdLisResult = new XBDLisResult();
 | |
|             xbdLisResult.setResult(result.getResult());
 | |
|             xbdLisResult.setReportItemCode(result.getItemCode());
 | |
|             xbdLisResult.setReportItemName(result.getItemName());
 | |
|             xbdLisResult.setUnit(result.getResultUnit());
 | |
|             xbdLisResult.setRange(result.getReferenceRange());
 | |
|             xbdLisResult.setUnusualFlag(result.getResultFlag());
 | |
|             xbdLisResultList.add(xbdLisResult);
 | |
|         }
 | |
|         return xbdLisResultList;
 | |
|     }
 | |
| 
 | |
|     public static List<XBDLisBactResult> getBactResult(String reportId){
 | |
| 
 | |
|         JsonResult jsonResult = RMLisHelper.getJsonResult("GetReportResult", params -> {
 | |
|             params.put("ReportID",reportId);
 | |
|         });
 | |
|         if (!jsonResult.success()) {
 | |
|             log.error("[瑞美lis]细菌报告单请求失败-reportId={}]",reportId);
 | |
|             return null;
 | |
|         }
 | |
|         List<RMLisBactResult> bactResultList = jsonResult.getDataMapList(RMLisBactResult.class, "BacteriaItems", "BacteriaItem");
 | |
|         List<RMLisAntbResult> antbResultList = jsonResult.getDataMapList(RMLisAntbResult.class, "MedicineItems", "MedicineItem");
 | |
|         List<XBDLisBactResult> xbdLisBactResultList = new ArrayList<>();
 | |
|         for(RMLisBactResult bactResult:bactResultList){
 | |
|             List<RMLisAntbResult> antbResult = antbResultList.stream().
 | |
|                     filter(p->p.getResultId().equals(bactResult.getResultId())).collect(Collectors.toList());
 | |
|             List<XBDLisAntbResult> xbdAntbResult = new ArrayList<>();
 | |
|             for (RMLisAntbResult antb:antbResult){
 | |
|                 XBDLisAntbResult xbdLisAntbResult = new XBDLisAntbResult();
 | |
|                 xbdLisAntbResult.setResult(antb.getMedResult());
 | |
|                 xbdLisAntbResult.setAntbCode(antb.getMedCode());
 | |
|                 xbdLisAntbResult.setAntbName(antb.getMedName());
 | |
|                 xbdLisAntbResult.setMic(antb.getMicResult());
 | |
|                 xbdAntbResult.add(xbdLisAntbResult);
 | |
|             }
 | |
|             XBDLisBactResult xbdLisBactResult = new XBDLisBactResult();
 | |
|             xbdLisBactResult.setResultId(bactResult.getResultId());
 | |
|             xbdLisBactResult.setResult(bactResult.getBacteriaResult());
 | |
|             xbdLisBactResult.setBactName(bactResult.getBacteriaName());
 | |
|             xbdLisBactResult.setAntbResults(xbdAntbResult);
 | |
|             xbdLisBactResult.setComment4RM(bactResult.getExtraData1());
 | |
|         }
 | |
|         return xbdLisBactResultList;
 | |
|     }
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|     public static void main(String[] args) throws Exception {
 | |
| //        System.out.println(new JSONArray().toJSONString());
 | |
|         String xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
 | |
|                 "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n" +
 | |
|                 "\t<soap:Body>\n" +
 | |
|                 "\t\t<UnifiedEntranceResponse xmlns=\"http://www.ruimei.com.cn\">\n" +
 | |
|                 "\t\t\t<UnifiedEntranceResult><Response>  <ResultCode>1</ResultCode>  <ResultMessage>调用打印成功!</ResultMessage>  <Files>    <File>      <FileContent>JVBERi0xLjQNCiWio4</FileContent>    </File>  </Files></Response></UnifiedEntranceResult>\n" +
 | |
|                 "\t\t</UnifiedEntranceResponse>\n" +
 | |
|                 "\t</soap:Body>\n" +
 | |
|                 "</soap:Envelope>\n";
 | |
| 
 | |
| 
 | |
|         try {
 | |
| 
 | |
|             //解析响应消息,使用SAXReader对象
 | |
| 
 | |
| 
 | |
| //            unifiedEntranceResponse.element();
 | |
| 
 | |
| //            String text = unifiedEntranceResult.getText();
 | |
| //            System.out.println(text);
 | |
| 
 | |
| //            element.element("DATA").element("RECORD").element("CODE").getText();
 | |
| 
 | |
| 
 | |
| //            Element root = document.getRootElement();
 | |
| //            Element element = root.element("soap:Envelope");
 | |
| //            Element envelope = root.element("Envelope");
 | |
| //            Element element = root.element("soap:Envelope");
 | |
| //            Element element1 = root.element("soap:Body");
 | |
| //            System.out.println(element1.getText());
 | |
| ////            System.out.println(document.getText());
 | |
| ////            System.out.println(document.getName());
 | |
| ////            Element root = document.getRootElement(); // 获取根节点元素对象
 | |
| //            System.out.println(root.getText());
 | |
|         } catch (Exception e) {
 | |
|             e.printStackTrace();
 | |
|         }
 | |
|     }
 | |
| }
 | |
| 
 |