浏览代码

EHR业务强转智业档案模板

hzp 8 年之前
父节点
当前提交
7b6202664f

文件差异内容过多而无法显示
+ 275 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/record/EhrService.java


+ 79 - 67
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/record/HospitalizationService.java

@ -1,6 +1,8 @@
package com.yihu.wlyy.service.app.record;
import com.yihu.wlyy.entity.dict.SystemDict;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.system.SystemDictService;
import com.yihu.wlyy.util.DateUtil;
@ -27,90 +29,100 @@ public class HospitalizationService extends BaseService {
    @Autowired
    SystemDictService systemDictService;
    @Autowired
    EhrService ehrService;
    /**
     * 获取住院记录
     */
    public String getHospitalizationRecord(String strSSID, String startNum, String endNum) throws Exception {
        if(SystemConf.getInstance().getEhrUsed())     //演示环境
        {
            return ehrService.getHospitalizationRecord(strSSID);
        }
        else {
            String startDate = "1900-01-01";
            String endDate = DateUtil.dateToStr(DateUtil.getNowDate(), DateUtil.YYYY_MM_DD);
            String url = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
            url = url + "/third/smjk/InpatientRecord";
        String startDate = "1900-01-01";
        String endDate = DateUtil.dateToStr(DateUtil.getNowDate(), DateUtil.YYYY_MM_DD);
        String url = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
        url = url + "/third/smjk/InpatientRecord";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("strSSID", strSSID));
        params.add(new BasicNameValuePair("startDate", startDate));
        params.add(new BasicNameValuePair("endDate", endDate));
        params.add(new BasicNameValuePair("startNum", startNum));
        params.add(new BasicNameValuePair("endNum", endNum));
            List<NameValuePair> params = new ArrayList<>();
            params.add(new BasicNameValuePair("strSSID", strSSID));
            params.add(new BasicNameValuePair("startDate", startDate));
            params.add(new BasicNameValuePair("endDate", endDate));
            params.add(new BasicNameValuePair("startNum", startNum));
            params.add(new BasicNameValuePair("endNum", endNum));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        JSONArray resultArray = new JSONArray();
        List<SystemDict> systemDictList = systemDictService.getDictByDictName("EHR_CATALOG");
        Map<String, String> systemDictMap = new HashMap<>();
        for (SystemDict systemDict : systemDictList) {
            systemDictMap.put(systemDict.getCode(), systemDict.getValue());
        }
            String response = HttpClientUtil.post(url, params, "UTF-8");
            JSONArray resultArray = new JSONArray();
            List<SystemDict> systemDictList = systemDictService.getDictByDictName("EHR_CATALOG");
            Map<String, String> systemDictMap = new HashMap<>();
            for (SystemDict systemDict : systemDictList) {
                systemDictMap.put(systemDict.getCode(), systemDict.getValue());
            }
        if (!StringUtils.isEmpty(response)){
            JSONObject responseObject = new JSONObject(response);
            int status = responseObject.getInt("status");
            if (status == 200){
                String data = responseObject.getString("data");
                if (!StringUtils.isEmpty(data)){
                    if (data.startsWith("error")) {
                        return data;
                    }
                    JSONObject jsonData = new JSONObject(data);
                    JSONArray jsonArray = jsonData.getJSONArray("EhrList");
                    if (!jsonArray.isNull(0) && jsonArray.getJSONObject(0).length() != 0) {
                        Map<String, JSONObject> jsonObjectMap = new HashMap<>();
                        for (int i=0; i<jsonArray.length(); i++) {
                            JSONObject jsonObject = jsonArray.getJSONObject(i);
                            String patientId = jsonObject.getString("XMAN_ID");
                            String eventNo = jsonObject.getString("EVENT");
                            Integer orgId = jsonObject.getInt("ORG_ID");
                            String key = patientId + eventNo + orgId;
                            JSONObject catalogObject = new JSONObject();
                            String catalogCode = jsonObject.get("CATALOG_CODE").toString();
                            String endTimeNew = jsonObject.get("END_TIME").toString();
                            String catalogValue = systemDictMap.get(catalogCode);
                            jsonObject.remove("CATALOG_CODE");
                            if (jsonObjectMap.containsKey(key)) {
                                jsonObject = jsonObjectMap.get(key);
                                String endTimeOld = jsonObject.get("END_TIME").toString();
                                if (endTimeNew.compareTo(endTimeOld) < 0) {
                                    endTimeNew = endTimeOld;
            if (!StringUtils.isEmpty(response)) {
                JSONObject responseObject = new JSONObject(response);
                int status = responseObject.getInt("status");
                if (status == 200) {
                    String data = responseObject.getString("data");
                    if (!StringUtils.isEmpty(data)) {
                        if (data.startsWith("error")) {
                            return data;
                        }
                        JSONObject jsonData = new JSONObject(data);
                        JSONArray jsonArray = jsonData.getJSONArray("EhrList");
                        if (!jsonArray.isNull(0) && jsonArray.getJSONObject(0).length() != 0) {
                            Map<String, JSONObject> jsonObjectMap = new HashMap<>();
                            for (int i = 0; i < jsonArray.length(); i++) {
                                JSONObject jsonObject = jsonArray.getJSONObject(i);
                                String patientId = jsonObject.getString("XMAN_ID");
                                String eventNo = jsonObject.getString("EVENT");
                                Integer orgId = jsonObject.getInt("ORG_ID");
                                String key = patientId + eventNo + orgId;
                                JSONObject catalogObject = new JSONObject();
                                String catalogCode = jsonObject.get("CATALOG_CODE").toString();
                                String endTimeNew = jsonObject.get("END_TIME").toString();
                                String catalogValue = systemDictMap.get(catalogCode);
                                jsonObject.remove("CATALOG_CODE");
                                if (jsonObjectMap.containsKey(key)) {
                                    jsonObject = jsonObjectMap.get(key);
                                    String endTimeOld = jsonObject.get("END_TIME").toString();
                                    if (endTimeNew.compareTo(endTimeOld) < 0) {
                                        endTimeNew = endTimeOld;
                                    }
                                    catalogObject = jsonObject.getJSONObject("CATALOG");
                                }
                                catalogObject = jsonObject.getJSONObject("CATALOG");
                                catalogObject.put(catalogCode, catalogValue);
                                jsonObject.put("CATALOG", catalogObject);
                                jsonObject.put("END_TIME", endTimeNew);
                                jsonObjectMap.put(key, jsonObject);
                            }
                            catalogObject.put(catalogCode, catalogValue);
                            jsonObject.put("CATALOG", catalogObject);
                            jsonObject.put("END_TIME", endTimeNew);
                            jsonObjectMap.put(key, jsonObject);
                        }
                        for (String key : jsonObjectMap.keySet()) {
                            resultArray.put(jsonObjectMap.get(key));
                        }
                            for (String key : jsonObjectMap.keySet()) {
                                resultArray.put(jsonObjectMap.get(key));
                            }
                        JSONObject temp;
                        for (int i = 0; i < resultArray.length(); i++) {
                            for (int j = i+1; j < resultArray.length(); j++) {
                                String endTimeNew = resultArray.getJSONObject(j).get("END_TIME").toString();
                                String endTimeOld = resultArray.getJSONObject(i).get("END_TIME").toString();
                                if (endTimeNew.compareTo(endTimeOld) > 0) {
                                    temp = resultArray.getJSONObject(i);
                                    resultArray.put(i, resultArray.getJSONObject(j));
                                    resultArray.put(j, temp);  // 两个数交换位置
                            JSONObject temp;
                            for (int i = 0; i < resultArray.length(); i++) {
                                for (int j = i + 1; j < resultArray.length(); j++) {
                                    String endTimeNew = resultArray.getJSONObject(j).get("END_TIME").toString();
                                    String endTimeOld = resultArray.getJSONObject(i).get("END_TIME").toString();
                                    if (endTimeNew.compareTo(endTimeOld) > 0) {
                                        temp = resultArray.getJSONObject(i);
                                        resultArray.put(i, resultArray.getJSONObject(j));
                                        resultArray.put(j, temp);  // 两个数交换位置
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        return resultArray.toString();
            return resultArray.toString();
        }
    }
}

+ 79 - 67
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/record/OutpatientService.java

@ -2,6 +2,8 @@ package com.yihu.wlyy.service.app.record;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.entity.dict.SystemDict;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.system.SystemDictService;
import com.yihu.wlyy.util.DateUtil;
@ -34,91 +36,101 @@ public class OutpatientService extends BaseService {
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    EhrService ehrService;
    /**
     * 获取门/急诊记录
     */
    public String getOutpatientRecord(String strSSID, String startNum, String endNum) {
        String startDate = "1900-01-01";
        String endDate = DateUtil.dateToStr(DateUtil.getNowDate(), DateUtil.YYYY_MM_DD);
        String url = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
        url = url + "/third/smjk/OutpatientRecord";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("strSSID", strSSID));
        params.add(new BasicNameValuePair("startDate", startDate));
        params.add(new BasicNameValuePair("endDate", endDate));
        params.add(new BasicNameValuePair("startNum", startNum));
        params.add(new BasicNameValuePair("endNum", endNum));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        JSONArray resultArray = new JSONArray();
        List<SystemDict> systemDictList = systemDictService.getDictByDictName("EHR_CATALOG");
        Map<String, String> systemDictMap = new HashMap<>();
        for (SystemDict systemDict : systemDictList) {
            systemDictMap.put(systemDict.getCode(), systemDict.getValue());
        if(SystemConf.getInstance().getEhrUsed())     //演示环境
        {
            return ehrService.getOutpatientRecord(strSSID);
        }
        else{
            String startDate = "1900-01-01";
            String endDate = DateUtil.dateToStr(DateUtil.getNowDate(), DateUtil.YYYY_MM_DD);
            String url = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
            url = url + "/third/smjk/OutpatientRecord";
            List<NameValuePair> params = new ArrayList<>();
            params.add(new BasicNameValuePair("strSSID", strSSID));
            params.add(new BasicNameValuePair("startDate", startDate));
            params.add(new BasicNameValuePair("endDate", endDate));
            params.add(new BasicNameValuePair("startNum", startNum));
            params.add(new BasicNameValuePair("endNum", endNum));
            String response = HttpClientUtil.post(url, params, "UTF-8");
            JSONArray resultArray = new JSONArray();
            List<SystemDict> systemDictList = systemDictService.getDictByDictName("EHR_CATALOG");
            Map<String, String> systemDictMap = new HashMap<>();
            for (SystemDict systemDict : systemDictList) {
                systemDictMap.put(systemDict.getCode(), systemDict.getValue());
            }
        if (!StringUtils.isEmpty(response)){
            JSONObject responseObject = new JSONObject(response);
            int status = responseObject.getInt("status");
            if (status == 200){
                String data = responseObject.getString("data");
                if (!StringUtils.isEmpty(data)){
                    if (data.startsWith("error")) {
                        return data;
                    }
                    JSONObject jsonData = new JSONObject(data);
                    JSONArray jsonArray = jsonData.getJSONArray("EhrList");
                    if (!jsonArray.isNull(0) && jsonArray.getJSONObject(0).length() != 0) {
                        Map<String, JSONObject> jsonObjectMap = new HashMap<>();
                        for (int i=0; i<jsonArray.length(); i++) {
                            JSONObject jsonObject = jsonArray.getJSONObject(i);
                            String patientId = jsonObject.getString("XMAN_ID");
                            String eventNo = jsonObject.getString("EVENT");
                            Integer orgId = jsonObject.getInt("ORG_ID");
                            String key = patientId + eventNo + orgId;
                            JSONObject catalogObject = new JSONObject();
                            String catalogCode = jsonObject.get("CATALOG_CODE").toString();
                            String endTimeNew = jsonObject.get("END_TIME").toString();
                            String catalogValue = systemDictMap.get(catalogCode);
                            jsonObject.remove("CATALOG_CODE");
                            if (jsonObjectMap.containsKey(key)) {
                                jsonObject = jsonObjectMap.get(key);
                                String endTimeOld = jsonObject.get("END_TIME").toString();
                                if (endTimeNew.compareTo(endTimeOld) < 0) {
                                    endTimeNew = endTimeOld;
            if (!StringUtils.isEmpty(response)){
                JSONObject responseObject = new JSONObject(response);
                int status = responseObject.getInt("status");
                if (status == 200){
                    String data = responseObject.getString("data");
                    if (!StringUtils.isEmpty(data)){
                        if (data.startsWith("error")) {
                            return data;
                        }
                        JSONObject jsonData = new JSONObject(data);
                        JSONArray jsonArray = jsonData.getJSONArray("EhrList");
                        if (!jsonArray.isNull(0) && jsonArray.getJSONObject(0).length() != 0) {
                            Map<String, JSONObject> jsonObjectMap = new HashMap<>();
                            for (int i=0; i<jsonArray.length(); i++) {
                                JSONObject jsonObject = jsonArray.getJSONObject(i);
                                String patientId = jsonObject.getString("XMAN_ID");
                                String eventNo = jsonObject.getString("EVENT");
                                Integer orgId = jsonObject.getInt("ORG_ID");
                                String key = patientId + eventNo + orgId;
                                JSONObject catalogObject = new JSONObject();
                                String catalogCode = jsonObject.get("CATALOG_CODE").toString();
                                String endTimeNew = jsonObject.get("END_TIME").toString();
                                String catalogValue = systemDictMap.get(catalogCode);
                                jsonObject.remove("CATALOG_CODE");
                                if (jsonObjectMap.containsKey(key)) {
                                    jsonObject = jsonObjectMap.get(key);
                                    String endTimeOld = jsonObject.get("END_TIME").toString();
                                    if (endTimeNew.compareTo(endTimeOld) < 0) {
                                        endTimeNew = endTimeOld;
                                    }
                                    catalogObject = jsonObject.getJSONObject("CATALOG");
                                }
                                catalogObject = jsonObject.getJSONObject("CATALOG");
                                catalogObject.put(catalogCode, catalogValue);
                                jsonObject.put("CATALOG", catalogObject);
                                jsonObject.put("END_TIME", endTimeNew);
                                jsonObjectMap.put(key, jsonObject);
                            }
                            catalogObject.put(catalogCode, catalogValue);
                            jsonObject.put("CATALOG", catalogObject);
                            jsonObject.put("END_TIME", endTimeNew);
                            jsonObjectMap.put(key, jsonObject);
                        }
                        for (String key : jsonObjectMap.keySet()) {
                            resultArray.put(jsonObjectMap.get(key));
                        }
                            for (String key : jsonObjectMap.keySet()) {
                                resultArray.put(jsonObjectMap.get(key));
                            }
                        JSONObject temp;
                        for (int i = 0; i < resultArray.length(); i++) {
                            for (int j = i+1; j < resultArray.length(); j++) {
                                String endTimeNew = resultArray.getJSONObject(j).get("END_TIME").toString();
                                String endTimeOld = resultArray.getJSONObject(i).get("END_TIME").toString();
                                if (endTimeNew.compareTo(endTimeOld) > 0) {
                                    temp = resultArray.getJSONObject(i);
                                    resultArray.put(i, resultArray.getJSONObject(j));
                                    resultArray.put(j, temp);  // 两个数交换位置
                            JSONObject temp;
                            for (int i = 0; i < resultArray.length(); i++) {
                                for (int j = i+1; j < resultArray.length(); j++) {
                                    String endTimeNew = resultArray.getJSONObject(j).get("END_TIME").toString();
                                    String endTimeOld = resultArray.getJSONObject(i).get("END_TIME").toString();
                                    if (endTimeNew.compareTo(endTimeOld) > 0) {
                                        temp = resultArray.getJSONObject(i);
                                        resultArray.put(i, resultArray.getJSONObject(j));
                                        resultArray.put(j, temp);  // 两个数交换位置
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        return resultArray.toString();
            return resultArray.toString();
        }
    }
    /**

+ 2 - 6
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/sign/SignJwService.java

@ -25,13 +25,13 @@ import java.util.*;
/**
 * Created by hzp on 2016/9/26.
 * 基卫签约服务
 * 基卫签约服务 (弃用)
 */
@Service
public class SignJwService {
    //基卫服务地址
    private String jwUrl = SystemConf.getInstance().getJwUrl();
    private String jwUrl = "";
    @Autowired
    private ObjectMapper objectMapper = new ObjectMapper();
@ -92,8 +92,4 @@ public class SignJwService {
        }
    }
    public static void main(String args[]) throws Exception {
        System.out.print(new SignJwService().UploadSignFamily("66ae08fd897643048ed8feba09549554")+"\r\n");
         System.out.print(new SignJwService().CheckSignFamily("1")+"\r\n");
    }
}

+ 18 - 4
patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SystemConf.java

@ -310,12 +310,26 @@ public class SystemConf {
	/****************************************************************************************/
	/********************************* 基卫配置 **********************************************/
	/********************************* EHR配置 **********************************************/
	/**
	 * 获取基卫服务地址
	 * 是否启用EHR演示
	 */
	public String getJwUrl() {
		return getSystemProperties().getProperty("jw_url");
	public Boolean getEhrUsed() {
		return Boolean.valueOf(getSystemProperties().getProperty("ehr_used"));
	}
	/**
	 * EHR档案服务地址
	 */
	public String getEhrServices() {
		return getSystemProperties().getProperty("ehr_services");
	}
	/**
	 * EHR底层地址
	 */
	public String getEhrServicesBase() {
		return getSystemProperties().getProperty("ehr_services_base");
	}
	/**************************************************************************************/

+ 3 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/record/InspectionController.java

@ -32,11 +32,11 @@ public class InspectionController extends BaseController {
    @ResponseBody
    @ApiOperation(value = "获取检查/检验列表", produces = "application/json", notes = "获取检查/检验列表")
    public String inspectionList(
            @ApiParam(name = "strSSID", value = "健康卡号")
            @ApiParam(name = "strSSID", value = "健康卡号",defaultValue = "A0601003595X")
            @RequestParam(value = "strSSID") String strSSID,
            @ApiParam(name = "startNum", value = "需要获取的起始行数")
            @ApiParam(name = "startNum", value = "需要获取的起始行数",defaultValue = "0")
            @RequestParam(value = "startNum") String startNum,
            @ApiParam(name = "endNum", value = "需要获取的结束的行数")
            @ApiParam(name = "endNum", value = "需要获取的结束的行数",defaultValue = "10")
            @RequestParam(value = "endNum") String endNum) {
        try {
            //TODO 检查/检验报告接口

+ 5 - 2
patient-co-wlyy/src/main/resources/system.properties

@ -181,5 +181,8 @@ template_expenses_remind=tldWEb9AN7p_RoHoD8ml0GxWW3V1V_mpEEhp2v6p56s
guahao_url = http://www.xmsmjk.com/UrpNetService/ReservationNet.asmx
guahao_namespace = http://www.zysoft.com.cn/
# 價怹勤諉督昢華硊
jw_url = http://localhost:8011/
#EHR紫偶督昢華硊
ehr_used = false
ehr_services = http://localhost:9009/api/v1.0/
ehr_services_base = http://localhost:9009/api/v1.0/