Forráskód Böngészése

调用健康档案转接服务

zhenglingfeng 8 éve
szülő
commit
f04c1bfee0

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

@ -0,0 +1,54 @@
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.commons.lang3.StringUtils;
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 java.util.ArrayList;
import java.util.List;
/**
 * Created by zhenglingfeng on 2016/10/17.
 */
@Service
public class DrugService extends BaseService {
    /**
     * 获取用药记录
     */
    public String getDrugsList(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/DrugsList";
        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 result = new JSONArray();
        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.toString();
    }
}

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

@ -0,0 +1,52 @@
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.commons.lang3.StringUtils;
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 java.util.ArrayList;
import java.util.List;
/**
 * Created by zhenglingfeng on 2016/10/17.
 */
@Service
public class HealthDataService extends BaseService {
    /**
     * 获取健康档案信息
     */
    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";
        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));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        JSONArray result = new JSONArray();
        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.toString();
    }
}

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

@ -3,8 +3,11 @@ 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.commons.lang3.StringUtils;
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 java.util.ArrayList;
@ -17,7 +20,7 @@ import java.util.List;
public class HospitalizationService extends BaseService {
    /**
     * 获取健康档案信息
     * 获取住院记录
     */
    public String getHospitalizationRecord(String strSSID, String startDate, String endDate, String startNum, String endNum) throws Exception {
        String url = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
@ -30,7 +33,21 @@ public class HospitalizationService extends BaseService {
        params.add(new BasicNameValuePair("startNum", startNum));
        params.add(new BasicNameValuePair("endNum", endNum));
        String result = HttpClientUtil.post(url, params, "UTF-8");
        return result;
        String response = HttpClientUtil.post(url, params, "UTF-8");
        JSONArray result = new JSONArray();
        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.toString();
    }
}

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

@ -3,8 +3,11 @@ 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.commons.lang3.StringUtils;
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 javax.transaction.Transactional;
@ -16,6 +19,10 @@ import java.util.List;
 */
@Service
public class OutpatientService extends BaseService {
    /**
     * 获取门/急诊记录
     */
    public String getOutpatientRecord(String strSSID, String startDate, String endDate, String startNum, String endNum) {
        String url = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
@ -28,7 +35,21 @@ public class OutpatientService extends BaseService {
        params.add(new BasicNameValuePair("startNum", startNum));
        params.add(new BasicNameValuePair("endNum", endNum));
        String result = HttpClientUtil.post(url, params, "UTF-8");
        return result;
        String response = HttpClientUtil.post(url, params, "UTF-8");
        JSONArray result = new JSONArray();
        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.toString();
    }
}

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

@ -0,0 +1,56 @@
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.commons.lang3.StringUtils;
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 java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by zhenglingfeng on 2016/10/17.
 */
@Service
public class RegDeptSpeDoctorService extends BaseService {
    /**
     * 获取转诊预约医生号源信息
     */
    public String getRegDeptSpeDoctorSectionList(String OrgCode,String DeptCode,String strStart,String strEnd,String DocCode)  throws Exception
    {
        String url = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
        url = url + "/third/smjk/RegDeptSpeDoctorSectionList";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("OrgCode", OrgCode));
        params.add(new BasicNameValuePair("DeptCode", DeptCode));
        params.add(new BasicNameValuePair("strStart", strStart));
        params.add(new BasicNameValuePair("strEnd", strEnd));
        params.add(new BasicNameValuePair("DocCode", DocCode));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        JSONArray result = new JSONArray();
        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.toString();
    }
}

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

@ -0,0 +1,53 @@
package com.yihu.wlyy.web.doctor.record;
import com.yihu.wlyy.service.app.record.DrugService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
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;
/**
 * Created by zhenglingfeng on 2016/10/17.
 */
@Controller
@RequestMapping(value = "/doctor/record", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "医生端-健康档案用药记录")
public class DrugController extends BaseController {
    @Autowired
    private DrugService drugService;
    /**
     * 获取用药记录
     *
     * @return
     */
    @RequestMapping(value = "/drug", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ResponseBody
    @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);
            return write(200, "获取用药记录成功!", "data", data);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取用药记录失败!");
        }
    }
}

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

@ -0,0 +1,52 @@
package com.yihu.wlyy.web.doctor.record;
import com.yihu.wlyy.service.app.record.HealthDataService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
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;
/**
 * Created by zhenglingfeng on 2016/10/17.
 */
@Controller
@RequestMapping(value = "/doctor/record", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "医生端-健康档案信息")
public class HealthDataController extends BaseController {
    @Autowired
    private HealthDataService healthDataService;
    /**
     * 获取门/急诊数据
     *
     * @return
     */
    @RequestMapping(value = "/healthData", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取健康档案信息")
    public String getHealthData(@ApiParam(name="strSSID",value="健康卡号",defaultValue = "A20140513123")
                                @RequestParam(value="strSSID",required = true) String strSSID,
                                @ApiParam(name="strEvent",value="事件ID",defaultValue = "")
                                @RequestParam(value="strEvent",required = true) String strEvent,
                                @ApiParam(name="strCatalog",value="档案类型",defaultValue = "")
                                @RequestParam(value="strCatalog",required = true) String strCatalog,
                                @ApiParam(name="strSerial",value="该类别顺序号,默认填1",defaultValue = "1")
                                @RequestParam(value="strSerial",required = true) String strSerial) {
        try {
            String data = healthDataService.getHealthData(strSSID, strEvent, strCatalog, strSerial);
            return write(200, "获取健康档案信息成功!", "data", data);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取健康档案信息失败!");
        }
    }
}

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

@ -32,7 +32,7 @@ public class HospitalizationController extends BaseController {
    @RequestMapping(value = "/hospitalization", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取住院记录")
    public String getHospitalizationRecord(@ApiParam(name="strSSID",value="健康卡号",defaultValue = "D56668987")
    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,
@ -48,7 +48,7 @@ public class HospitalizationController extends BaseController {
            return write(200, "获取住院记录成功!", "data", data);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取住院记录成功!");
            return invalidUserException(e, -1, "获取住院记录失败!");
        }
    }
}

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

@ -31,17 +31,16 @@ public class OutpatientController extends BaseController {
    @ApiOperation("获取门/急诊数据")
    @RequestMapping(value = "/outpatient", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ResponseBody
    public String getOutpatientRecord(
                    @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) {
    public String getOutpatientRecord(@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 result = outpatientService.getOutpatientRecord(strSSID,
                    startDate, endDate, startNum, endNum);

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

@ -0,0 +1,52 @@
package com.yihu.wlyy.web.doctor.record;
import com.yihu.wlyy.service.app.record.RegDeptSpeDoctorService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
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;
/**
 * Created by zhenglingfeng on 2016/10/17.
 */
@Controller
@RequestMapping(value = "/doctor/record", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "医生端-获取转诊预约医生号源信息")
public class RegDeptSpeDoctorController extends BaseController {
    @Autowired
    private RegDeptSpeDoctorService regDeptSpeDoctorService;
    /**
     * 获取转诊预约医生号源信息
     *
     * @return
     */
    @ApiOperation("获取转诊预约医生号源信息")
    @RequestMapping(value = "regDeptSpeDoctor", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ResponseBody
    public String getRegDeptSpeDoctorSectionList(@ApiParam(name="OrgCode",value="机构编码",defaultValue = "350211A1001")
                                                 @RequestParam(value="OrgCode",required = true) String OrgCode,
                                                 @ApiParam(name="DeptCode",value="科室编码",defaultValue = "1040610")
                                                 @RequestParam(value="DeptCode",required = true) String DeptCode,
                                                 @ApiParam(name="strStart",value="预约排班开始时间",defaultValue = "2016-10-18")
                                                 @RequestParam(value="strStart",required = true) String strStart,
                                                 @ApiParam(name="strEnd",value="预约排班结束时间",defaultValue = "2016-10-20")
                                                 @RequestParam(value="strEnd",required = true) String strEnd,
                                                 @ApiParam(name="DocCode",value="医生编码",defaultValue = "80772")
                                                 @RequestParam(value="DocCode",required = true) String DocCode) {
        try {
            String data = regDeptSpeDoctorService.getRegDeptSpeDoctorSectionList(OrgCode, DeptCode, strStart, strEnd, DocCode);
            return write(200, "获取转诊预约医生号源信息成功!", "data", data);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取转诊预约医生号源信息失败!");
        }
    }
}