ソースを参照

Merge branch 'dev' of zlf/patient-co-management into dev

zlf 8 年 前
コミット
a2cb807813

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

@ -1,6 +1,9 @@
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.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.SystemConf;
import org.apache.commons.lang3.StringUtils;
@ -8,10 +11,13 @@ 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;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by zhenglingfeng on 2016/10/17.
@ -19,10 +25,15 @@ import java.util.List;
@Service
public class DrugService extends BaseService {
    @Autowired
    SystemDictService systemDictService;
    /**
     * 获取用药记录
     */
    public String getDrugsList(String strSSID,String startDate,String endDate,String startNum,String endNum) throws Exception {
    public String getDrugsList(String strSSID, String startNum,String endNum) throws Exception {
        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/DrugsList";
@ -34,21 +45,50 @@ public class DrugService extends BaseService {
        params.add(new BasicNameValuePair("endNum", endNum));
        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)){
                    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();
    }
}

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

@ -1,6 +1,9 @@
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.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.SystemConf;
import org.apache.commons.lang3.StringUtils;
@ -8,10 +11,13 @@ 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;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by zhenglingfeng on 2016/10/17.
@ -19,10 +25,15 @@ import java.util.List;
@Service
public class HospitalizationService extends BaseService {
    @Autowired
    SystemDictService systemDictService;
    /**
     * 获取住院记录
     */
    public String getHospitalizationRecord(String strSSID, String startDate, String endDate, String startNum, String endNum) throws Exception {
    public String getHospitalizationRecord(String strSSID, String startNum, String endNum) throws Exception {
        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";
@ -34,20 +45,50 @@ public class HospitalizationService extends BaseService {
        params.add(new BasicNameValuePair("endNum", endNum));
        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)){
                    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();
    }
}

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

@ -1,6 +1,9 @@
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.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.util.XMLUtil;
@ -8,11 +11,14 @@ 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 org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * @author HZY
@ -22,44 +28,49 @@ import java.util.List;
@Service
public class InspectionService extends BaseService {
    @Autowired
    SystemDictService systemDictService;
    /**
     * 获取检查报告信息
     */
    public JSONArray getChecking(String strSSID, String startDate, String endDate, String startNum, String endNum) throws Exception {
        String url = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
        url = url + "/third/smjk/ExamReport";
        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));
        JSONArray result = new JSONArray();
        String response = HttpClientUtil.post(url, params, "UTF-8");
        if (!StringUtils.isEmpty(response)){
            JSONObject jsonObject = new JSONObject(response);
            int status = jsonObject.getInt("status");
            if (status == 200){
                String data = jsonObject.getString("data");
                if (!StringUtils.isEmpty(data)){
                    JSONObject jsonData = new JSONObject(data);
                    result = jsonData.getJSONArray("EhrList");
                }
            }
        }
        return result;
    public JSONArray getChecking(String strSSID, String startNum, String endNum) throws Exception {
        String api = "/third/smjk/ExamReport";
        return getResult(api, strSSID, startNum, endNum);
    }
    /**
     * 获取检验报告信息
     */
    public JSONArray getInspection(String strSSID, String startDate, String endDate, String startNum, String endNum) throws Exception {
    public JSONArray getInspection(String strSSID, String startNum, String endNum) throws Exception {
        String api = "/third/smjk/LabReport";
        return getResult(api, strSSID, startNum, endNum);
    }
    /**
     * 获取检查检验 信息
     * @param strSSID
     * @param startNum
     * @param endNum
     * @return
     * @throws Exception
     */
    public String getInspectionAndChecking(String strSSID, String startNum, String endNum) throws Exception {
        JSONArray total = new JSONArray();
        JSONArray check = getChecking(strSSID, startNum, endNum);
        JSONArray inspect = getInspection(strSSID, startNum, endNum);
        //TODO 检查检验数据合并
        total.put(check);
        total.put(inspect);
        return total.toString();
    }
    public JSONArray getResult(String api, 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/LabReport";
        url = url + api;
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("strSSID", strSSID));
@ -68,43 +79,53 @@ public class InspectionService extends BaseService {
        params.add(new BasicNameValuePair("startNum", startNum));
        params.add(new BasicNameValuePair("endNum", endNum));
        JSONArray result = new JSONArray();
        String response = HttpClientUtil.post(url, params, "UTF-8");
        if (!StringUtils.isEmpty(response)){
            JSONObject jsonObject = new JSONObject(response);
            int status = jsonObject.getInt("status");
        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 (!org.apache.commons.lang3.StringUtils.isEmpty(response)){
            JSONObject responseObject = new JSONObject(response);
            int status = responseObject.getInt("status");
            if (status == 200){
                String data = jsonObject.getString("data");
                if (!StringUtils.isEmpty(data)){
                String data = responseObject.getString("data");
                if (!org.apache.commons.lang3.StringUtils.isEmpty(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;
        return resultArray;
    }
    /**
     * 获取检查检验 信息
     * @param strSSID
     * @param startDate
     * @param endDate
     * @param startNum
     * @param endNum
     * @return
     * @throws Exception
     */
    public JSONArray getInspectionAndChecking(String strSSID, String startDate, String endDate, String startNum, String endNum) throws Exception {
        JSONArray total = new JSONArray();
        JSONArray check = getChecking(strSSID, startDate, endDate, startNum, endNum);
        JSONArray inspect = getInspection(strSSID, startDate, endDate, startNum, endNum);
        //TODO 检查检验数据合并
        return  total;
    }
    /**
     * 档案详情
     * @param strSSID       健康卡号

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

@ -34,16 +34,11 @@ public class DrugController extends BaseController {
    @ApiOperation("获取用药记录")
    public String getDrugsList(@ApiParam(name="strSSID",value="健康卡号",defaultValue = "A20140513123")
                               @RequestParam(value="strSSID",required = true) String strSSID,
                               @ApiParam(name="startDate",value="查询的开始日期",defaultValue = "2015-01-01")
                               @RequestParam(value="startDate",required = true) String startDate,
                               @ApiParam(name="endDate",value="查询的结束日期",defaultValue = "2016-10-01")
                               @RequestParam(value="endDate",required = true) String endDate,
                               @ApiParam(name="startNum",value="需要获取的起始行数",defaultValue = "0")
                               @RequestParam(value="startNum",required = true) String startNum,
                               @ApiParam(name="endNum",value="需要获取的结束的行数",defaultValue = "10")
                               @RequestParam(value="endNum",required = true) String endNum) {
        try {
            String data = drugService.getDrugsList(strSSID, startDate, endDate, startNum, endNum);
            String data = drugService.getDrugsList(strSSID, startNum, endNum);
            return write(200, "获取用药记录成功!", "data", data);
        } catch (Exception e) {
            error(e);

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

@ -34,16 +34,12 @@ public class HospitalizationController extends BaseController {
    @ApiOperation("获取住院记录")
    public String getHospitalizationRecord(@ApiParam(name="strSSID",value="健康卡号",defaultValue = "A20140513123")
                                     @RequestParam(value="strSSID",required = true) String strSSID,
                                     @ApiParam(name="startDate",value="查询的开始日期",defaultValue = "2015-01-01")
                                     @RequestParam(value="startDate",required = true) String startDate,
                                     @ApiParam(name="endDate",value="查询的结束日期",defaultValue = "2016-10-01")
                                     @RequestParam(value="endDate",required = true) String endDate,
                                     @ApiParam(name="startNum",value="需要获取的起始行数",defaultValue = "0")
                                     @RequestParam(value="startNum",required = true) String startNum,
                                     @ApiParam(name="endNum",value="需要获取的结束的行数",defaultValue = "10")
                                     @RequestParam(value="endNum",required = true) String endNum) {
        try {
            String data = hospitalizationService.getHospitalizationRecord(strSSID, startDate, endDate, startNum, endNum);
            String data = hospitalizationService.getHospitalizationRecord(strSSID, startNum, endNum);
            return write(200, "获取住院记录成功!", "data", data);
        } catch (Exception e) {

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

@ -5,8 +5,6 @@ import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
@ -35,46 +33,18 @@ public class InspectionController extends BaseController {
    public String inspectionList(
            @ApiParam(name = "strSSID", value = "健康卡号")
            @RequestParam(value = "strSSID") String strSSID,
            @ApiParam(name = "startDate", value = "查询的开始日期")
            @RequestParam(value = "startDate") String startDate,
            @ApiParam(name = "endDate", value = "查询的结束日期")
            @RequestParam(value = "endDate") String endDate,
            @ApiParam(name = "startNum", value = "需要获取的起始行数")
            @RequestParam(value = "startNum") String startNum,
            @ApiParam(name = "endNum", value = "需要获取的结束的行数")
            @RequestParam(value = "endNum") String endNum) {
        try {
            //TODO 检查/检验报告接口
            JSONArray array = inspectionService.getInspectionAndChecking(strSSID,startDate,endDate,startNum,endNum);
            return write(200, "获取检查/检验记录成功!", "data", array);
            String result = inspectionService.getInspectionAndChecking(strSSID, startNum, endNum);
            return write(200, "获取检查/检验记录成功!", "data", result);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取检查/检验记录异常!");
        }
    }
    @RequestMapping(value = "/detail", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "获取检查/检验详情", produces = "application/json", notes = "获取检查/检验详情")
    public String inspectionDetail(
            @ApiParam(name = "strSSID", value = "健康卡号")
            @RequestParam(value = "strSSID") String strSSID,
            @ApiParam(name = "strEvent", value = "事件ID")
            @RequestParam(value = "strEvent") String strEvent,
            @ApiParam(name = "strCatalog", value = "档案类型")
            @RequestParam(value = "strCatalog") String strCatalog,
            @ApiParam(name = "strSerial", value = "该类别顺序号,默认填1")
            @RequestParam(value = "strSerial") String strSerial
    ) {
        try {
            JSONObject array = new JSONObject();
            //TODO 调用检查/检验报告接口
            array = inspectionService.getHealthData(strSSID,strEvent,strCatalog,strSerial);
            return write(200, "获取检查/检验详情成功!", "data", array);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取检查/检验详情异常!");
        }
    }
}