ソースを参照

健康档案-检查/检验接口初步实现

demon 8 年 前
コミット
4e77d74e8e

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

@ -0,0 +1,144 @@
package com.yihu.wlyy.service.app.record;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.SystemConf;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.List;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2016/10/17.
 */
@Service
public class InspectionService extends BaseService {
    /**
     * 获取检查报告信息
     */
    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 getInspection(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/LabReport";
        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;
    }
    /**
     * 获取检查检验 信息
     * @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       健康卡号
     * @param strEvent      事件ID
     * @param strCatalog    档案类型
     * @param strSerial     该类别顺序号,默认填1
     * @return
     * @throws Exception
     */
    public JSONArray 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";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("strSSID", strSSID));
        params.add(new BasicNameValuePair("strEvent", strEvent));
        params.add(new BasicNameValuePair("strCatalog", strCatalog));
        params.add(new BasicNameValuePair("strSerial", strSerial));
        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;
    }
}

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

@ -1,13 +1,17 @@
package com.yihu.wlyy.web.doctor.record;
import com.yihu.wlyy.service.app.record.InspectionService;
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
/**
@ -21,16 +25,26 @@ import org.springframework.web.bind.annotation.ResponseBody;
@Api(description = "医生端- 居民检查/检验记录")
public class InspectionController extends BaseController {
    @Autowired
    private InspectionService inspectionService;
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "获取检查/检验列表", produces = "application/json", notes = "获取检查/检验列表")
    public String inspectionList() {
    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 {
            JSONArray array = new JSONArray();
            //TODO 检查/检验报告接口
            JSONArray array = inspectionService.getInspectionAndChecking(strSSID,startDate,endDate,startNum,endNum);
            return write(200, "获取检查/检验记录成功!", "data", array);
        } catch (Exception e) {
            error(e);
@ -41,7 +55,16 @@ public class InspectionController extends BaseController {
    @RequestMapping(value = "/detail", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "获取检查/检验详情", produces = "application/json", notes = "获取检查/检验详情")
    public String inspectionDetail() {
    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 {
            JSONArray array = new JSONArray();
            //TODO 调用检查/检验报告接口