Sfoglia il codice sorgente

健康档案连接

zhenglingfeng 8 anni fa
parent
commit
e1cbaa4b46

+ 3 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/record/DrugService.java

@ -58,6 +58,9 @@ public class DrugService extends BaseService {
            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) {

+ 10 - 6
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/record/HealthDataService.java

@ -29,7 +29,7 @@ public class HealthDataService extends BaseService {
    /**
     * 获取健康档案信息
     */
    public Map getHealthData(String strSSID, String strEvent, String strCatalog, String strSerial) throws Exception {
    public String getHealthData(String strSSID, String strEvent, String strCatalog, String strSerial) throws Exception {
        String url = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
        url = url + "/third/smjk/HealthData";
@ -40,16 +40,20 @@ public class HealthDataService extends BaseService {
        params.add(new BasicNameValuePair("strSerial", strSerial));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        Map result = new HashMap<>();
        String result = "";
        if (!StringUtils.isEmpty(response)){
            JSONObject jsonObject = new JSONObject(response);
            int status = jsonObject.getInt("status");
            if (status == 200){
                String xmlData = jsonObject.getString("data");
                if (!StringUtils.isEmpty(xmlData)){
                    String xmlJson = XMLUtil.xml2json(xmlData);
                    result = objectMapper.readValue(xmlJson, Map.class);
                result = jsonObject.getString("data");
                result = result.replace("<\\?xml version=\"1.0\" encoding=\"utf-8\"\\?>","");
                if (result.startsWith("error")) {
                    return result;
                }
//                if (!StringUtils.isEmpty(xmlData)){
//                    String xmlJson = XMLUtil.xml2json(xmlData);
//                    result = objectMapper.readValue(xmlJson, Map.class);
//                }
            }
        }

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

@ -64,6 +64,9 @@ public class OutpatientService extends BaseService {
            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) {

+ 44 - 6
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/record/RegDeptSpeDoctorService.java

@ -1,6 +1,8 @@
package com.yihu.wlyy.service.app.record;
import com.yihu.wlyy.entity.dict.SystemDict;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.system.SystemDictService;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.SystemConf;
import org.apache.commons.lang3.StringUtils;
@ -8,6 +10,7 @@ import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@ -21,6 +24,8 @@ import java.util.Map;
@Service
public class RegDeptSpeDoctorService extends BaseService {
    @Autowired
    SystemDictService systemDictService;
    /**
     * 获取转诊预约医生号源信息
     */
@ -37,20 +42,53 @@ public class RegDeptSpeDoctorService extends BaseService {
        params.add(new BasicNameValuePair("DocCode", DocCode));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        JSONArray result = new JSONArray();
        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 jsonObject = new JSONObject(response);
            int status = jsonObject.getInt("status");
            JSONObject responseObject = new JSONObject(response);
            int status = responseObject.getInt("status");
            if (status == 200){
                String data = jsonObject.getString("data");
                String data = responseObject.getString("data");
                if (!StringUtils.isEmpty(data)){
                    if (data.startsWith("error")) {
                        return data;
                    }
                    JSONObject jsonData = new JSONObject(data);
                    result = jsonData.getJSONArray("EhrList");
                    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 catalogValue = systemDictMap.get(catalogCode);
                            jsonObject.remove("CATALOG_CODE");
                            if (jsonObjectMap.containsKey(key)) {
                                jsonObject = jsonObjectMap.get(key);
                                catalogObject = jsonObject.getJSONObject("CATALOG");
                            }
                            catalogObject.put(catalogCode, catalogValue);
                            jsonObject.put("CATALOG", catalogObject);
                            jsonObjectMap.put(key, jsonObject);
                        }
                        for (String key : jsonObjectMap.keySet()) {
                            resultArray.put(jsonObjectMap.get(key));
                        }
                    }
                }
            }
        }
        return result.toString();
        return resultArray.toString();
    }
}

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

@ -39,6 +39,9 @@ public class DrugController extends BaseController {
                               @RequestParam(value="endNum",required = true) String endNum) {
        try {
            String data = drugService.getDrugsList(strSSID, startNum, endNum);
            if (data.startsWith("error")) {
                return write(-1, "获取用药记录失败!", "data", data);
            }
            return write(200, "获取用药记录成功!", "data", data);
        } catch (Exception e) {
            error(e);

+ 4 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/record/HealthDataController.java

@ -43,8 +43,10 @@ public class HealthDataController extends BaseController {
                                @ApiParam(name="strSerial",value="该类别顺序号,默认填1",defaultValue = "1")
                                @RequestParam(value="strSerial",required = true) String strSerial) {
        try {
            Map data = healthDataService.getHealthData(strSSID, strEvent, strCatalog, strSerial);
            String data = healthDataService.getHealthData(strSSID, strEvent, strCatalog, strSerial);
            if (data.startsWith("error")) {
                return write(-1, "获取健康档案信息失败!", "data", data);
            }
            return write(200, "获取健康档案信息成功!", "data", data);
        } catch (Exception e) {
            error(e);

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

@ -40,6 +40,9 @@ public class InspectionController extends BaseController {
        try {
            //TODO 检查/检验报告接口
            String result = inspectionService.getInspectionAndChecking(strSSID, startNum, endNum);
            if (result.startsWith("error")) {
                return write(-1, "获取检查/检验记录异常!", "data", result);
            }
            return write(200, "获取检查/检验记录成功!", "data", result);
        } catch (Exception e) {
            error(e);

+ 5 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/record/OutpatientController.java

@ -5,6 +5,8 @@ import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
@ -38,6 +40,9 @@ public class OutpatientController extends BaseController {
                      @RequestParam(value="endNum",required = true) String endNum) {
        try {
            String result = outpatientService.getOutpatientRecord(strSSID, startNum, endNum);
            if (result.startsWith("error")) {
                return write(-1, "获取门/急诊数据失败!", "data", result);
            }
            return write(200, "获取门/急诊数据成功!", "data", result);
        } catch (Exception e) {
            error(e);

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

@ -43,6 +43,9 @@ public class RegDeptSpeDoctorController extends BaseController {
                                                 @RequestParam(value="DocCode",required = true) String DocCode) {
        try {
            String data = regDeptSpeDoctorService.getRegDeptSpeDoctorSectionList(OrgCode, DeptCode, strStart, strEnd, DocCode);
            if (data.startsWith("error")) {
                return write(-1, "获取转诊预约医生号源信息失败!", "data", data);
            }
            return write(200, "获取转诊预约医生号源信息成功!", "data", data);
        } catch (Exception e) {
            error(e);