Browse Source

添加获取机构服务项目列表接口

humingfen 7 years ago
parent
commit
a8e79b8b53

+ 3 - 19
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/RehabilitationPlanService.java

@ -66,7 +66,7 @@ public class RehabilitationPlanService extends BaseService {
            e.printStackTrace();
        }
        JSONObject rs = new JSONObject(response.getContent());
        if ("success".equals(rs.getString("message"))) {
        if (rs.getInt("status") == 200) {
            return rs.getJSONArray("detailModelList");
        }
        throw new Exception("请求获取模板明细列表失败!");
@ -133,23 +133,6 @@ public class RehabilitationPlanService extends BaseService {
        return rs.getString("message");
    }
    public JSONArray findServiceItemsByHospital(String doctorHospital, String signHospital) throws Exception {
        Map<String, Object> param = new HashedMap();
        param.put("doctorHospital", doctorHospital);
        param.put("signHospital", signHospital);
        HttpResponse response = null;
        try {
            response = HttpUtils.doGet(specialistUrl + "svr-specialist/findServiceItemsByHospital", param);
        } catch (Exception e) {
            e.printStackTrace();
        }
        JSONObject rs = new JSONObject(response.getContent());
        if ("success".equals(rs.getString("message"))) {
            return rs.getJSONArray("detailModelList");
        }
        throw new Exception("请求获取机构服务项目列表失败!");
    }
    public String createRehabilitationPlan(String json, Doctor doctor) {
        JSONObject object = new JSONObject(json);
        String patient = object.getString("patient");
@ -167,7 +150,7 @@ public class RehabilitationPlanService extends BaseService {
        JSONArray detailModelList = (JSONArray) rs.get("detailModelList");
        //康复计划创建完给执行者发送消息
        for (Object obj : detailModelList){
            JSONObject detail = new JSONObject(obj);
            JSONObject detail = (JSONObject) obj;
            Message message = new Message();
            message.setSender(doctor.getCode());
            message.setType(19);
@ -207,4 +190,5 @@ public class RehabilitationPlanService extends BaseService {
            throw new Exception("请求微服务失败!");
        }
    }
}

+ 40 - 10
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/SpecialistHospitalItemService.java

@ -4,10 +4,15 @@ package com.yihu.wlyy.service.specialist;/**
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.organization.HospitalDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.family.FamilyService;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.util.HttpClientUtil;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -34,6 +39,10 @@ public class SpecialistHospitalItemService extends BaseService {
    private HttpClientUtil httpClientUtil;
    @Value("${specialist.url}")
    private String specialistUrl;
    @Autowired
    private DoctorService doctorService;
    @Autowired
    private FamilyService familyService;
    public List<Hospital> selectHospital(){
        List<Hospital> hospitals = hospitalDao.findAllHospital();
@ -45,16 +54,16 @@ public class SpecialistHospitalItemService extends BaseService {
     * @param hospitals
     * @return
     */
    public JSONObject selectByHospital(String hospitals){
    public JSONArray selectByHospital(String hospitals){
        String response = null;
        JSONObject object = new JSONObject();
        JSONArray array = new JSONArray();
        String url =specialistUrl + "svr-specialist/selectByHospital";
        Map<String,String> params = new HashMap<>();
        params.put("hospitals",hospitals);
        try {
            response = httpClientUtil.httpPost(url,params);
            object = JSONObject.parseObject(response);
            JSONArray array = object.getJSONArray("detailModelList");
            JSONObject object = JSONObject.parseObject(response);
            array = object.getJSONArray("detailModelList");
            for (int i = 0;i<array.size();i++){
                JSONObject jsonObject = array.getJSONObject(i);
                String hospital = jsonObject.getString("hospital");
@ -65,7 +74,7 @@ public class SpecialistHospitalItemService extends BaseService {
            e.printStackTrace();
            logger.error(e.getMessage());
        }
        return object;
        return array;
    }
@ -75,16 +84,16 @@ public class SpecialistHospitalItemService extends BaseService {
     * @param ids
     * @return
     */
    public JSONObject selectByIds(String ids){
    public JSONArray selectByIds(String ids){
        String response = null;
        JSONObject object = new JSONObject();
        JSONArray array = new JSONArray();
        String url =specialistUrl + "svr-specialist/selectById";
        Map<String,String> params = new HashMap<>();
        params.put("ids",ids);
        try {
            response = httpClientUtil.httpPost(url,params);
            object = JSONObject.parseObject(response);
            JSONArray array = object.getJSONArray("detailModelList");
            JSONObject object = JSONObject.parseObject(response);
            array = object.getJSONArray("detailModelList");
            for (int i = 0;i<array.size();i++){
                JSONObject jsonObject = array.getJSONObject(i);
                String hospital = jsonObject.getString("hospital");
@ -95,6 +104,27 @@ public class SpecialistHospitalItemService extends BaseService {
            e.printStackTrace();
            logger.error(e.getMessage());
        }
        return object;
        return array;
    }
    public JSONArray getHospital(String doctor, String patient, String serviceItemName) throws Exception{
        String response = null;
        JSONObject object = new JSONObject();
        String url =specialistUrl + "svr-specialist/selectByHospital1";
        Map<String,String> params = new HashMap<>();
        SignFamily signFamily = new SignFamily();
        Doctor d = doctorService.findDoctorByCode(doctor);
        params.put("docHospital",d.getHospital());
        if(StringUtils.isNotBlank(patient)) {
            signFamily = familyService.findByPatient(patient);
            params.put("hospital", signFamily.getHospital());
        }
        if(StringUtils.isNotBlank(serviceItemName)) {
            params.put("serviceItemName", serviceItemName);
        }
        response = httpClientUtil.httpPost(url, params);
        object = JSONObject.parseObject(response);
        JSONArray array = object.getJSONArray("detailModelList");
        return array;
    }
}

+ 17 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/specialist/HospitalServiceItemController.java

@ -60,4 +60,21 @@ public class HospitalServiceItemController extends BaseController {
            return write(-1,"获取失败!");
        }
    }
    @RequestMapping(value = "/findServiceItemsByHospital", method = RequestMethod.GET)
    @ApiOperation(value = "获取机构服务项目列表")
    public String findServiceItemsByHospital(@ApiParam(name = "doctor", value = "医生标识")
                                             @RequestParam(required = true)String doctor,
                                             @ApiParam(name = "patient", value = "居民标识")
                                             @RequestParam(required = false)String patient,
                                             @ApiParam(name = "serviceItemName", value = "服务项目名称")
                                             @RequestParam(required = false)String serviceItemName){
        try {
            return write(200, "获取成功", "data", specialistHospitalItemService.getHospital(doctor, patient, serviceItemName));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
}

+ 0 - 21
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/specialist/ThirdRehabilitationPlanController.java

@ -2,7 +2,6 @@ package com.yihu.wlyy.web.third.specialist;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.service.app.family.FamilyService;
import com.yihu.wlyy.service.app.team.AdminTeamService;
import com.yihu.wlyy.service.common.account.DoctorService;
@ -11,7 +10,6 @@ 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.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
@ -108,25 +106,6 @@ public class ThirdRehabilitationPlanController extends BaseController {
        }
    }
    @RequestMapping(value = "/findServiceItemsByHospital", method = RequestMethod.GET)
    @ApiOperation(value = "获取机构服务项目列表")
    public String findServiceItemsByHospital(@ApiParam(name = "doctor", value = "医生标识")
                                                 @RequestParam(required = true)String doctor,
                                             @ApiParam(name = "patient", value = "居民标识")
                                                 @RequestParam(required = false)String patient){
        try {
            SignFamily signFamily = new SignFamily();
            Doctor d = doctorService.findDoctorByCode(doctor);
            if(StringUtils.isNotBlank(patient)) {
                signFamily = familyService.findByPatient(patient);
            }
            return write(200, "获取成功", "data", rehabilitationPlanService.findServiceItemsByHospital(d.getHospital(), signFamily.getHospital()));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "/createRehabilitationPlan", method = RequestMethod.POST)
    @ApiOperation(value = "创建居民康复计划")
    public String createRehabilitationPlan(@ApiParam(name = "doctor", value = "医生标识")