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.
		
		
		
		
			
				
					172 lines
				
				6.8 KiB
			
		
		
			
		
	
	
					172 lines
				
				6.8 KiB
			| 
								 
											3 years ago
										 
									 | 
							
								package com.ynxbd.common.dao.his;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								import com.alibaba.fastjson.JSONArray;
							 | 
						||
| 
								 | 
							
								import com.alibaba.fastjson.JSONObject;
							 | 
						||
| 
								 | 
							
								import com.ynxbd.common.bean.TreatRecord;
							 | 
						||
| 
								 | 
							
								import com.ynxbd.common.bean.report.CheckReport;
							 | 
						||
| 
								 | 
							
								import com.ynxbd.common.bean.report.InspectionReport;
							 | 
						||
| 
								 | 
							
								import com.ynxbd.common.bean.report.PEIS;
							 | 
						||
| 
								 | 
							
								import com.ynxbd.common.helper.his.HisEnum;
							 | 
						||
| 
								 | 
							
								import com.ynxbd.common.helper.his.HisHelper;
							 | 
						||
| 
								 | 
							
								import com.ynxbd.common.result.JsonResult;
							 | 
						||
| 
								 | 
							
								import lombok.extern.slf4j.Slf4j;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								import java.util.ArrayList;
							 | 
						||
| 
								 | 
							
								import java.util.List;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * His报告调用
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * @Author wsq
							 | 
						||
| 
								 | 
							
								 * @Date 2020/8/24 10:51
							 | 
						||
| 
								 | 
							
								 * @Copyright @ 2020 云南新八达科技有限公司 All rights reserved.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								@Slf4j
							 | 
						||
| 
								 | 
							
								public class HisReportDao {
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								//    /**
							 | 
						||
| 
								 | 
							
								//     * 查询就诊记录
							 | 
						||
| 
								 | 
							
								//     *
							 | 
						||
| 
								 | 
							
								//     * @return 就诊记录
							 | 
						||
| 
								 | 
							
								//     */
							 | 
						||
| 
								 | 
							
								//    public List<MZRecordBean> treatRecord(String patientId, String begDate, String endDate, String patientType, String reportType) {
							 | 
						||
| 
								 | 
							
								//        List<MZRecordBean> mzList = new ArrayList<>();
							 | 
						||
| 
								 | 
							
								//        Map<Object, Object> params = new HashMap<>();
							 | 
						||
| 
								 | 
							
								//        params.put("TransactionCode", "1004");
							 | 
						||
| 
								 | 
							
								//        params.put("PatientId", patientId);
							 | 
						||
| 
								 | 
							
								//        params.put("BegDate", begDate);
							 | 
						||
| 
								 | 
							
								//        params.put("EndDate", endDate);
							 | 
						||
| 
								 | 
							
								//        params.put("InOutState", patientType == null ? "0" : patientType); // ,1:门诊号,2:住院号,3:全部
							 | 
						||
| 
								 | 
							
								//        params.put("CheckOrInspection", reportType == null ? "0" : reportType); // 0:全部;1:检查;2:检验;3:检查+检验
							 | 
						||
| 
								 | 
							
								//
							 | 
						||
| 
								 | 
							
								//        HisTool tool = new HisTool("UniversalInterface", params);
							 | 
						||
| 
								 | 
							
								//
							 | 
						||
| 
								 | 
							
								//        String xml = tool.getRespos();
							 | 
						||
| 
								 | 
							
								//        HisResult hisResult = HisResult.xmlToBean(xml);
							 | 
						||
| 
								 | 
							
								//
							 | 
						||
| 
								 | 
							
								//        // WsResult{ResponseCode=0, ResponseMessage='成功', TransactionCode='1004', DataMap={Records=[{"Record":[{"InOutState":"1","ConsultDate":"2020-08-12 10:29:54","DeptCode":"1201","RegisterDate":"2020-08-12 10:29:54","DeptName":"口腔科","DoctName":"李加济","MZNum":"1252050","DoctCode":"0441"},{"InOutState":"1","ConsultDate":"2020-07-22 11:26:17","DeptCode":"1201","RegisterDate":"2020-07-22 11:26:17","DeptName":"口腔科","DoctName":"李加济","MZNum":"1234481","DoctCode":"0441"}]}]}}
							 | 
						||
| 
								 | 
							
								//        if (hisResult.getResponseCode() == 0) { // 0成功 -1异常
							 | 
						||
| 
								 | 
							
								//            mzList = hisResult.getDataMapList(MZRecordBean.class, "Records", "Record");
							 | 
						||
| 
								 | 
							
								//        }
							 | 
						||
| 
								 | 
							
								//        return mzList;
							 | 
						||
| 
								 | 
							
								//    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * 根据患者id查询检查报告
							 | 
						||
| 
								 | 
							
								     *
							 | 
						||
| 
								 | 
							
								     * @param patientId 患者id
							 | 
						||
| 
								 | 
							
								     * @param bedDate   开始时间
							 | 
						||
| 
								 | 
							
								     * @param endDate   结束时间
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    public List<CheckReport> getCheckByPatient(String patientId, String bedDate, String endDate) {
							 | 
						||
| 
								 | 
							
								        List<CheckReport> reports = new ArrayList<>();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        JsonResult jsonResult = HisHelper.getJsonResult(HisEnum.AP_Query_CheckApplication, params -> {
							 | 
						||
| 
								 | 
							
								            params.put("PatientID", patientId);
							 | 
						||
| 
								 | 
							
								        });
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        if (jsonResult.success()) {
							 | 
						||
| 
								 | 
							
								            reports = jsonResult.getDataMapList(CheckReport.class, "Report");
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								        return reports;
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * [体检报告]查询
							 | 
						||
| 
								 | 
							
								     *
							 | 
						||
| 
								 | 
							
								     * @param name     患者姓名
							 | 
						||
| 
								 | 
							
								     * @param idCardNo 身份证号码
							 | 
						||
| 
								 | 
							
								     * @return list
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    public List<PEIS> getPEISReportByPatient(String name, String idCardNo, String bedDate, String endDate) {
							 | 
						||
| 
								 | 
							
								        List<PEIS> reports = new ArrayList<>();
							 | 
						||
| 
								 | 
							
								        JsonResult jsonResult = HisHelper.getJsonResult(HisEnum.AP_Query_PEISReport, params -> {
							 | 
						||
| 
								 | 
							
								            params.put("Name", name);
							 | 
						||
| 
								 | 
							
								            params.put("IdCardNo", idCardNo);
							 | 
						||
| 
								 | 
							
								        });
							 | 
						||
| 
								 | 
							
								        if (jsonResult.success()) {
							 | 
						||
| 
								 | 
							
								            reports = jsonResult.getDataMapList(PEIS.class, "Enrollment");
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								        return reports;
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * 根据患者查询化验(检验)
							 | 
						||
| 
								 | 
							
								     *
							 | 
						||
| 
								 | 
							
								     * @param patientId 患者
							 | 
						||
| 
								 | 
							
								     * @return 报告集合
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    public List<InspectionReport> getInspectByPatient(String patientId) {
							 | 
						||
| 
								 | 
							
								        List<InspectionReport> reports = new ArrayList<>();
							 | 
						||
| 
								 | 
							
								        JsonResult jsonResult = HisHelper.getJsonResult(HisEnum.AP_Query_InspectionApplication, params -> {
							 | 
						||
| 
								 | 
							
								            params.put("PatientID", patientId);
							 | 
						||
| 
								 | 
							
								        });
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        if (jsonResult.success()) {
							 | 
						||
| 
								 | 
							
								            reports = jsonResult.getDataMapList(InspectionReport.class, "Report");
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								        return reports;
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * 根据患者查询化验(检验)报告
							 | 
						||
| 
								 | 
							
								     *
							 | 
						||
| 
								 | 
							
								     * @param patientId 患者
							 | 
						||
| 
								 | 
							
								     * @return 报告集合
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    public List<InspectionReport> getInspectByTreatNum(String patientId, String zyNum, String mzNum) {
							 | 
						||
| 
								 | 
							
								        List<InspectionReport> reportList = new ArrayList<>();
							 | 
						||
| 
								 | 
							
								        JsonResult jsonResult = HisHelper.getJsonResult(HisEnum.AP_Query_InspectionApplication, params -> {
							 | 
						||
| 
								 | 
							
								            params.put("PatientID", patientId);
							 | 
						||
| 
								 | 
							
								            params.put("ZYNum", zyNum == null ? "" : zyNum);
							 | 
						||
| 
								 | 
							
								            params.put("MZNum", mzNum == null ? "" : mzNum);
							 | 
						||
| 
								 | 
							
								        });
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        if (jsonResult.success()) {
							 | 
						||
| 
								 | 
							
								            reportList = jsonResult.getDataMapList(InspectionReport.class, "Report");
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								        return reportList;
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * 查询就诊记录
							 | 
						||
| 
								 | 
							
								     *
							 | 
						||
| 
								 | 
							
								     * @return 就诊记录
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    public List<TreatRecord> getTreatRecordList(String patientId, String begDate, String endDate, String patientType, String reportType) {
							 | 
						||
| 
								 | 
							
								        List<TreatRecord> resultList = new ArrayList<>();
							 | 
						||
| 
								 | 
							
								        JsonResult jsonResult = HisHelper.getJsonResult(HisEnum.Query_TreatRecords, params -> {
							 | 
						||
| 
								 | 
							
								            params.put("PatientId", patientId);
							 | 
						||
| 
								 | 
							
								            params.put("BegDate", begDate);
							 | 
						||
| 
								 | 
							
								            params.put("EndDate", endDate);
							 | 
						||
| 
								 | 
							
								            params.put("InOutState", patientType == null ? "0" : patientType); // 0:全部; 1:门诊号; 2:住院号
							 | 
						||
| 
								 | 
							
								            params.put("CheckOrInspection", reportType == null ? "0" : reportType); // 0:全部; 1:检查; 2:检验; 3:检查+检验
							 | 
						||
| 
								 | 
							
								        });
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        if (jsonResult.success()) { // 0成功 -1异常
							 | 
						||
| 
								 | 
							
								            JSONArray jsonArray = jsonResult.getJsonArray("Records", "Record");
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            TreatRecord item;
							 | 
						||
| 
								 | 
							
								            JSONObject nodeItem;
							 | 
						||
| 
								 | 
							
								            for (int i = 0; i < jsonArray.size(); i++) {
							 | 
						||
| 
								 | 
							
								                nodeItem = jsonArray.getJSONObject(i);
							 | 
						||
| 
								 | 
							
								                item = new TreatRecord();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                item.setInOutState(nodeItem.getString("InOutState"));
							 | 
						||
| 
								 | 
							
								                item.setTreatNum(nodeItem.getString("MZNum"));
							 | 
						||
| 
								 | 
							
								                item.setDeptCode(nodeItem.getString("DeptCode")); // 职称
							 | 
						||
| 
								 | 
							
								                item.setDeptName(nodeItem.getString("DeptName")); //
							 | 
						||
| 
								 | 
							
								                item.setDoctCode(nodeItem.getString("DoctCode")); //
							 | 
						||
| 
								 | 
							
								                item.setDoctName(nodeItem.getString("DoctName")); //
							 | 
						||
| 
								 | 
							
								                item.setRegisterDate(nodeItem.getString("RegisterDate")); // 描述
							 | 
						||
| 
								 | 
							
								                item.setConsultDate(nodeItem.getString("ConsultDate")); // 描述
							 | 
						||
| 
								 | 
							
								                resultList.add(item);
							 | 
						||
| 
								 | 
							
								            }
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								        return resultList;
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								}
							 |