Bladeren bron

设备首绑更新发放医生;康复计划代码优化

zd_123 7 jaren geleden
bovenliggende
commit
346405c1a6

+ 12 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/device/DeviceDetailService.java

@ -66,6 +66,8 @@ public class DeviceDetailService extends BaseService {
		String hospital = "";
		String isFirstBind = "";
		String hospitalName = "";
		String doctorCode ="";
		String doctorName="";
		String keyType = "1";
		if ("2".equals(patientDevice.getUserType())){
			keyType="2";
@ -74,10 +76,12 @@ public class DeviceDetailService extends BaseService {
			adminTeam = signFamily.getAdminTeamId();
			hospital = signFamily.getHospital();
			hospitalName = signFamily.getHospitalName();
			doctorCode = signFamily.getDoctor();
			doctorName = signFamily.getDoctorName();
		}
		//设备表没有数据则插入一条数据
		if (deviceDetail==null){
			insertDevice(patientDevice,String.valueOf(adminTeam),hospitalName,hospital,"",1);
			insertDevice(patientDevice,String.valueOf(adminTeam),hospitalName,hospital,"",doctorCode,doctorName,1);
			deviceDetail = deviceDetailDao.findBySn(patientDevice.getDeviceSn());
		}
@ -90,16 +94,16 @@ public class DeviceDetailService extends BaseService {
		}
		if (isFirst){
			String updateFirstSql ="update device.wlyy_devices dd set dd.is_grant=1,dd.grant_admin_team=?,dd.grant_org_code=?,dd.binding_count=?,dd.grant_time = ?,dd.org_name=?,dd.is_binding=1 where dd.device_code=?";
			jdbcTemplate.update(updateFirstSql,new Object[]{String.valueOf(adminTeam),hospital,isFirstBind,grantTime,hospitalName,patientDevice.getDeviceSn()});
			String updateFirstSql ="update device.wlyy_devices dd set dd.is_grant=1,dd.grant_admin_team=?,dd.grant_org_code=?,dd.binding_count=?,dd.grant_time = ?,dd.org_name=?,dd.grant_doctor=?,dd.grant_doctor_name=?,dd.is_binding=1 where dd.device_code=?";
			jdbcTemplate.update(updateFirstSql,new Object[]{String.valueOf(adminTeam),hospital,isFirstBind,grantTime,hospitalName,doctorCode,doctorName,patientDevice.getDeviceSn()});
			//deviceDetailDao.updateAfterBindingFirst(String.valueOf(adminTeam),hospital,isFirstBind,grantTime,patientDevice.getDeviceSn());
		}else {
			List<PatientDevice> patientDeviceList = patientDeviceDao.findByDeviceSn(patientDevice.getDeviceSn());
			int patientDeviceSize = patientDeviceList.size();
			String updateSql = "";
			if (bind == 0){
				updateSql ="update device.wlyy_devices dd set dd.is_grant=1,dd.grant_admin_team=?,dd.grant_org_code=?,dd.binding_count=?,dd.is_binding=?,dd.org_name=?  where dd.device_code=?";
				jdbcTemplate.update(updateSql,new Object[]{String.valueOf(adminTeam),hospital,isFirstBind,patientDeviceSize,hospitalName,patientDevice.getDeviceSn()});
				updateSql ="update device.wlyy_devices dd set dd.is_grant=1,dd.grant_admin_team=?,dd.grant_org_code=?,dd.binding_count=?,dd.is_binding=?,dd.org_name=?,dd.grant_doctor=?,dd.grant_doctor_name=?  where dd.device_code=?";
				jdbcTemplate.update(updateSql,new Object[]{String.valueOf(adminTeam),hospital,isFirstBind,patientDeviceSize,hospitalName,doctorCode,doctorName,patientDevice.getDeviceSn()});
			}else if (bind>0){
				updateSql ="update device.wlyy_devices dd set dd.is_grant=1,dd.binding_count=?,dd.is_binding=? where dd.device_code=?";
				jdbcTemplate.update(updateSql,new Object[]{isFirstBind,patientDeviceSize,patientDevice.getDeviceSn()});
@ -118,7 +122,7 @@ public class DeviceDetailService extends BaseService {
	 * @param isBind 0未绑定  1已绑定
	 * @throws Exception
	 */
	public void insertDevice(PatientDevice patientDevice, String adminTeam, String orgName, String orgCode,String bindCount,int isBind)throws Exception{
	public void insertDevice(PatientDevice patientDevice, String adminTeam, String orgName, String orgCode,String bindCount,String doctorCode,String doctorName,int isBind)throws Exception{
		//获取原始数据
		DeviceDetail deviceDetail = new DeviceDetail();
		Patient patient = patientDao.findByCode(patientDevice.getUser());
@ -133,6 +137,8 @@ public class DeviceDetailService extends BaseService {
		deviceDetail.setGrantTime(patientDevice.getCzrq());
		deviceDetail.setApplyDate(DateUtil.getStringDate("yyyy-MM-dd HH:mm:ss"));
		deviceDetail.setOrgName(orgName);
		deviceDetail.setGrantDoctor(doctorCode);
		deviceDetail.setGrantDoctorName(doctorName);
		if (isBind>0){
			deviceDetail.setIsGrant(1);
			deviceDetail.setIsBinding(1);

+ 5 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/device/PatientDeviceService.java

@ -1214,6 +1214,8 @@ public class PatientDeviceService extends BaseService {
            String orgCode ="";
            String orgName="";
            String bingCount="";
            String doctorCode = "";
            String doctorName = "";
            if (Integer.valueOf(userType)>0){
                bingCount="{\"1\":\"0\",\"2\":\"0\"}";
            }else {
@ -1223,8 +1225,10 @@ public class PatientDeviceService extends BaseService {
                adminTeam = signFamily.getAdminTeamId();
                orgCode = signFamily.getHospital();
                orgName=signFamily.getHospitalName();
                doctorCode = signFamily.getDoctor();
                doctorName = signFamily.getDoctorName();
            }
            deviceDetailService.insertDevice(patientDevice,String.valueOf(adminTeam),orgName,orgCode,bingCount,0);
            deviceDetailService.insertDevice(patientDevice,String.valueOf(adminTeam),orgName,orgCode,bingCount,doctorCode,doctorName,0);
        }
        if (deviceDetail!=null && StringUtils.isNotEmpty(deviceDetail.getBindingCount())){
            JSONObject jsonObject =new JSONObject(String.valueOf(deviceDetail.getBindingCount()));

+ 0 - 210
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/RehabilitationPlanService.java

@ -1,210 +0,0 @@
package com.yihu.wlyy.service.specialist;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.team.AdminTeamService;
import com.yihu.wlyy.util.http.HttpResponse;
import com.yihu.wlyy.util.http.HttpUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Map;
/**
 * Created by humingfen on 2018/8/22.
 */
@Service
@Transactional
public class RehabilitationPlanService extends BaseService {
    @Value("${specialist.url}")
    private String specialistUrl;
    @Autowired
    private AdminTeamService teamService;
    @Autowired
    private SpecialistEvaluateSevice specialistEvaluateSevice;
    public JSONArray findTemplateInfo(String doctor, String patient) throws Exception {
        Map<String, Object> param = new HashedMap();
        Long adminTeamId = null;
        AdminTeam team = teamService.findByLeaderCode(doctor);
        if(StringUtils.isBlank(patient)){
            adminTeamId = team.getId();
            param.put("adminTeamCode", adminTeamId);
        }else {
            param.put("doctor", doctor);
            param.put("patient", patient);
        }
        HttpResponse response = null;
        try {
            response = HttpUtils.doGet(specialistUrl + "svr-specialist/findRehabilitationPlanTemplate", 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 JSONArray findTemplateDetailInfo(String templateId) throws Exception {
        Map<String, Object> param = new HashedMap();
        param.put("templateId", templateId);
        HttpResponse response = null;
        try {
            response = HttpUtils.doGet(specialistUrl + "svr-specialist/findTemplateDetailByTemplateId", 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 createTemplate(String title, Doctor doctor, Long teamId) throws Exception {
        JSONObject json = new JSONObject();
        json.put("title", title);
        json.put("adminTeamCode", teamId);
        json.put("hospital", doctor.getHospital());
        json.put("hospitalName", doctor.getHospitalName());
        json.put("createUser", doctor.getCode());
        json.put("createUserName", doctor.getName());
        Map<String, Object> param = new HashedMap();
        param.put("rehabilitationTemplate", json.toString());
        HttpResponse response = null;
        try {
            response = HttpUtils.doPost(specialistUrl + "svr-specialist/createRehabilitationPlanTemplate", param);
        } catch (Exception e) {
            e.printStackTrace();
        }
        JSONObject rs = new JSONObject(response.getContent());
        if ("success".equals(rs.getString("message"))) {
            return rs.getString("obj");
        }
        return rs.getString("message");
    }
    public String createTemplateDetail(String json, String type, Doctor doctor) {
        JSONObject object = new JSONObject(json);
        JSONArray details = new JSONArray();
        String templateId = object.get("templateId").toString();
        String hospitalServiceItemIds = object.get("hospitalServiceItemId").toString();
        if(hospitalServiceItemIds.contains(",")) {
            String [] itemIds = hospitalServiceItemIds.split(",");
            int len = itemIds.length;
            while (len > 0){
                len --;
                JSONObject j = new JSONObject();
                j.put("templateId", templateId);
                j.put("hospitalServiceItemId", itemIds[len]);
                j.put("createUser", doctor.getCode());
                j.put("createUserName", doctor.getName());
                details.put(len, j);
            }
        }else {
            object.put("createUser", doctor.getCode());
            object.put("createUserName", doctor.getName());
            details.put(object);
        }
        Map<String, Object> param = new HashedMap();
        param.put("rehabilitationTemplateDetail", details.toString());
        HttpResponse response = null;
        try {
            if(type.equals("create")) {
                response = HttpUtils.doPost(specialistUrl + "svr-specialist/createRehabilitationTemplateDetail", param);
            }else if(type.equals("edit")) {
                response = HttpUtils.doPost(specialistUrl + "svr-specialist/updateRehabilitationTemplateDetail", param);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        JSONObject rs = new JSONObject(response.getContent());
        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");
        object.put("createUser", doctor.getCode());
        object.put("createUserName", doctor.getName());
        Map<String, Object> param = new HashedMap();
        param.put("rehabilitationPlan", object.toString());
        HttpResponse response = null;
        try {
            response = HttpUtils.doPost(specialistUrl + "svr-specialist/createPatientRehabilitationPlan", param);
        } catch (Exception e) {
            e.printStackTrace();
        }
        JSONObject rs = new JSONObject(response.getContent());
        JSONArray detailModelList = (JSONArray) rs.get("detailModelList");
        //康复计划创建完给执行者发送消息
        for (Object obj : detailModelList){
            JSONObject detail = new JSONObject(obj);
            Message message = new Message();
            message.setSender(doctor.getCode());
            message.setType(19);
            message.setRelationCode(detail.getString("planId"));
            message.setReceiver(detail.getString("doctor"));
            specialistEvaluateSevice.sendMessage(message, detail.getString("hospital"), patient,null);
        }
        return rs.getString("message");
    }
    public String deleteTemplate(String templateId) {
        Map<String, Object> param = new HashedMap();
        param.put("id", templateId);
        HttpResponse response = null;
        try {
            response = HttpUtils.doPost(specialistUrl + "svr-specialist/deleteRehabilitationPlanTemplate", param);
        } catch (Exception e) {
            e.printStackTrace();
        }
        JSONObject rs = new JSONObject(response.getContent());
        return rs.getString("message");
    }
    /**
     * 更新计划的状态
     * @param planId
     * @param status
     * @throws Exception
     */
    public void updatePlanStatusById(String planId, Integer status) throws Exception{
        Map<String, Object> param = new HashedMap();
        param.put("planId", planId);
        param.put("status", status);
        HttpResponse response = HttpUtils.doPost(specialistUrl + "svr-specialist/updatePlanStatusById", param);
        JSONObject result = new JSONObject(response.getContent());
        if(result.getInt("status")!=200){
            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;
    }
}

+ 33 - 11
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/rehabilitation/RehabilitationManageService.java

@ -59,7 +59,7 @@ public class RehabilitationManageService extends BaseService {
    private String serviceDoctorList = "/svr-specialist/serviceDoctorList";//康复管理-医生端居民详情服务医生列表
    private String appCalendarPlanDetailList = "/svr-specialist/appCalendarPlanDetailList";//康复管理-app端、微信端计划的服务项目列表
    private String dailyJob = "/svr-specialist/dailyJob";//每日康复服务通知
    private String saveRehabilitationOperateRecodr ="/svr-specialist/saveRehabilitationOperateRecodr";//新增operateRecodr
    private String saveRehabilitationOperateRecord ="/svr-specialist/saveRehabilitationOperateRecord";//新增operateRecodr
    private String updateNoteAndImageRehabilitationOperate ="/svr-specialist/updateNoteAndImageRehabilitationOperate";//康复计划完成时更新服务完成笔记和图片接口;
    private String updatePlanDetailStatusById = "/svr-specialist/updatePlanDetailStatusById";//康复管理-更新康复计划服务项目状态
    /************************************************************* end ************************************************************************/
@ -195,8 +195,21 @@ public class RehabilitationManageService extends BaseService {
        param.put("planDetailIds", planDetailIds);
        HttpResponse response = HttpUtils.doGet(specialistUrl + serviceItemList, param);
        JSONObject result = new JSONObject(response.getContent());
        JSONArray jsonArray = null;
        if(result.getInt("status")==200){
            return result.getJSONArray("obj");
            jsonArray = result.getJSONArray("obj");
            for(int i=0;i<jsonArray.length();i++){
                String patient = jsonArray.getJSONObject(i).get("patient")+"";
                List<SignFamily> list = signFamilyDao.findByPatientAndExpensesStatusAndStatus(patient,"1",1);
                if(list.size()>0){
                    jsonArray.getJSONObject(i).put("familyDoctorCode",list.get(0).getDoctor());
                    jsonArray.getJSONObject(i).put("familyDoctorName",list.get(0).getDoctorName());
                }else{
                    jsonArray.getJSONObject(i).put("familyDoctorCode","");
                    jsonArray.getJSONObject(i).put("familyDoctorName","");
                }
            }
            return jsonArray;
        }
        throw new Exception("请求微服务失败!");
    }
@ -230,19 +243,18 @@ public class RehabilitationManageService extends BaseService {
    /**
     * 康复管理-保存指导留言
     * @param messageId
     * @param patientCode
     * @param doctorCode
     * @param content
     * @param planDetailId
     * @return
     * @throws Exception
     */
    public void saveGuidanceMessage(String messageId,String patientCode,String doctorCode,String content,String planDetailId) throws Exception{
    public void saveGuidanceMessage(String messageId,String doctorCode,String content,String planDetailId) throws Exception{
        Doctor doctor = doctorDao.findByCode(doctorCode);
        Integer doctorType = doctor.getLevel();
        Map<String, Object> param = new HashedMap();
        param.put("messageId", messageId);
        param.put("patientCode", patientCode);
//        param.put("patientCode", patientCode);
        param.put("doctorCode", doctorCode);
        param.put("doctorType", doctorType);
        param.put("content", content);
@ -355,7 +367,7 @@ public class RehabilitationManageService extends BaseService {
        Map<String, Object> param = new HashedMap();
        param.put("planDetailId", planDetailId);
        param.put("doctorCode", doctorCode);
        specialistUrl= "http://localhost:10051";
        //specialistUrl= "http://localhost:10051";
        HttpResponse response = HttpUtils.doPost(specialistUrl + createServiceQrCode, param);
        JSONObject result = new JSONObject(response.getContent());
        if(result.getInt("status")==200){
@ -368,7 +380,7 @@ public class RehabilitationManageService extends BaseService {
        Map<String, Object> param = new HashedMap();
        param.put("planDetailId", planDetailId);
        param.put("patientCode", patientCode);
        specialistUrl= "http://localhost:10051";
        //specialistUrl= "http://localhost:10051";
        HttpResponse response = HttpUtils.doPost(specialistUrl + checkAfterQrCode, param);
        JSONObject result = new JSONObject(response.getContent());
        return  result;
@ -448,9 +460,19 @@ public class RehabilitationManageService extends BaseService {
    public JSONObject saveRehabilitationOperateRecord(String dataJson) throws Exception{
        Map<String, Object> param = new HashedMap();
        param.put("dataJson", dataJson);
        specialistUrl= "http://localhost:10051";
        HttpResponse response = HttpUtils.doPost(specialistUrl + saveRehabilitationOperateRecodr, param);
        JSONObject json = new JSONObject(dataJson);
        if(json.has("patientCode")){
            Patient patient = patientDao.findByCode(json.get("patientCode")+"");
            json.put("patientName",patient!=null?patient.getName():"");
        }
        if(json.has("doctorCode")){
            Doctor doctor = doctorDao.findByCode(json.get("doctorCode")+"");
            json.put("doctorName",doctor!=null?doctor.getName():"");
        }
        String resultJsonStr = json.toString();
        param.put("dataJson", resultJsonStr);
        //specialistUrl= "http://localhost:10051";
        HttpResponse response = HttpUtils.doPost(specialistUrl + saveRehabilitationOperateRecord, param);
        JSONObject result = new JSONObject(response.getContent());
        return  result;
    }
@ -460,7 +482,7 @@ public class RehabilitationManageService extends BaseService {
        param.put("planDetailId", planDetailId);
        param.put("node", node);
        param.put("image", image);
        specialistUrl= "http://localhost:10051";
        //specialistUrl= "http://localhost:10051";
        HttpResponse response = HttpUtils.doPost(specialistUrl + updateNoteAndImageRehabilitationOperate, param);
        JSONObject result = new JSONObject(response.getContent());
        return  result;

+ 5 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/data/DataHandingService.java

@ -475,10 +475,14 @@ public class DataHandingService {
                String adminTeam="";
                String orgName ="";
                String orCode ="";
                String doctorCode ="";
                String doctorName="";
                if (signFamily!=null){
                    adminTeam=String.valueOf(signFamily.getAdminTeamId());
                    orgName = signFamily.getHospitalName();
                    orCode = signFamily.getHospital();
                    doctorCode = signFamily.getDoctor();
                    doctorName = signFamily.getDoctorName();
                }
                if (Integer.valueOf(patientDevice.getUserType())>0 && Integer.valueOf(patientDevice.getUserType())==1){
                    bindCount = "{\"1\":\"1\",\"2\":\"0\"}";
@ -487,7 +491,7 @@ public class DataHandingService {
                }else if (Integer.valueOf(patientDevice.getUserType())<0){
                    bindCount = "{\"1\":\"1\"}";
                }
                deviceDetailService.insertDevice(patientDevice,adminTeam,orgName,orCode,bindCount,1);
                deviceDetailService.insertDevice(patientDevice,adminTeam,orgName,orCode,bindCount,doctorCode,doctorName,1);
            }
        }
        String[] sqlStr = new String[sqlList.size()];

+ 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, "请求失败");
        }
    }
}

+ 21 - 7
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/specialist/rehabilitation/DoctorRehabilitationManageController.java

@ -1,10 +1,9 @@
package com.yihu.wlyy.web.doctor.specialist.rehabilitation;
import com.yihu.wlyy.util.ImUtill;
import com.yihu.wlyy.service.specialist.RehabilitationPlanService;
import com.yihu.wlyy.service.specialist.rehabilitation.RehabilitationPlanService;
import org.json.JSONArray;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabelInfo;
import com.yihu.wlyy.service.specialist.rehabilitation.RehabilitationManageService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
@ -19,8 +18,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
 * Created by 刘文彬 on 2018/8/30.
 */
@ -176,8 +173,8 @@ public class DoctorRehabilitationManageController extends BaseController {
    @ObserverRequired
    public String saveGuidanceMessage(@ApiParam(name = "messageId", value = "消息id", required = true)
                                      @RequestParam(value = "messageId", required = true)String messageId,
                                      @ApiParam(name = "patientCode", value = "居民code", required = true)
                                      @RequestParam(value = "patientCode", required = true)String patientCode,
//                                      @ApiParam(name = "patientCode", value = "居民code", required = true)
//                                      @RequestParam(value = "patientCode", required = true)String patientCode,
//                                      @ApiParam(name = "doctorCode", value = "医生code", required = true)
//                                      @RequestParam(value = "doctorCode", required = true)String doctorCode,
//                                      @ApiParam(name = "doctorType", value = "医生类型(1、专科医生,2、家庭医生)", required = true)
@ -188,7 +185,7 @@ public class DoctorRehabilitationManageController extends BaseController {
                                      @RequestParam(value = "planDetailId", required = true)String planDetailId){
        try {
            rehabilitationManageService.saveGuidanceMessage(messageId,patientCode,getRepUID(),content,planDetailId);
            rehabilitationManageService.saveGuidanceMessage(messageId,getRepUID(),content,planDetailId);
            return write(200, "保存成功!");
        } catch (Exception e) {
            error(e);
@ -317,6 +314,23 @@ public class DoctorRehabilitationManageController extends BaseController {
        }
    }
    @RequestMapping(value = "saveRehabilitationOperateRecord", method = RequestMethod.POST)
    @ApiOperation("康复管理-新增operateRecord")
    @ObserverRequired
    public String saveRehabilitationOperateRecord(@ApiParam(name = "dataJson", value = "实体json",defaultValue = "{\"rehabilitationDetailId\":\"402803f6657f195301657f4fbd3c0001\",\"patientCode\":\"00\",\"patientName\":\"11\",\"doctorCode\":\"22\",\"doctorName\":\"33\",\"node\":\"jjjjjj\",\"relationRecordType\":\"4\",\"relation_record_code\":\"55\",\"relationRecordImg\":\"666666\",\"status\":\"0\"}")@RequestParam(value = "dataJson", required = true)String dataJson){
        try {
            JSONObject result = rehabilitationManageService.saveRehabilitationOperateRecord(dataJson);
            if(result.getInt("status")==200){
                return write(200, "新增康复计划日志成功!", "data", result.getJSONObject("obj"));
            }else {
                return error(-1, result.getString("message"));
            }
        } catch (Exception e) {
            error(e);
            return error(-1, "新增康复计划日志失败!");
        }
    }
    @RequestMapping(value = "updateNoteAndImageRehabilitationOperate", method = RequestMethod.POST)
    @ApiOperation("康复管理-康复计划完成时更新服务完成笔记和图片接口并且确认完成")
    @ObserverRequired

+ 56 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/specialist/rehabilitation/PatientRehabilitationManageController.java

@ -154,4 +154,60 @@ public class PatientRehabilitationManageController extends BaseController {
            return error(-1, "新增康复计划日志失败!");
        }
    }
    @RequestMapping(value = "recentPlanDetailRecord", method = RequestMethod.GET)
    @ApiOperation("康复管理-近期康复相关记录")
    @ObserverRequired
    public String recentPlanDetailRecord(@ApiParam(name = "patientCode", value = "居民code", required = false)
                                         @RequestParam(value = "patientCode", required = false)String patientCode,
                                         @ApiParam(name = "startTime", value = "开始时间(格式:yyyy-MM-dd HH:mm:ss)", required = false)
                                         @RequestParam(value = "startTime", required = false)String startTime,
                                         @ApiParam(name = "endTime", value = "结束时间(格式:yyyy-MM-dd HH:mm:ss)", required = false)
                                         @RequestParam(value = "endTime", required = false)String endTime,
                                         @ApiParam(name = "page", value = "第几页,从1开始", required = true)
                                         @RequestParam(value = "page", required = false,defaultValue = "1")Integer page,
                                         @ApiParam(name = "pageSize", value = "每页分页大小", required = true)
                                         @RequestParam(value = "pageSize", required = false,defaultValue = "10")Integer pageSize){
        try {
            if(!StringUtils.isNotEmpty(patientCode)){
                patientCode = getUID();
            }
            JSONObject result = rehabilitationManageService.recentPlanDetailRecord(patientCode,startTime,endTime,page,pageSize);
            return write(200, "获取成功!", "data", result);
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "serviceItemList", method = RequestMethod.GET)
    @ApiOperation("康复管理-多个康复计划服务项目内容列表")
    @ObserverRequired
    public String serviceItemList(@ApiParam(name = "planDetailIds", value = "康复计划多个服务项目id(多个‘,’分隔)", required = true)
                                  @RequestParam(value = "planDetailIds", required = true)String planDetailIds){
        try {
            JSONArray result = rehabilitationManageService.serviceItemList(planDetailIds);
            return write(200, "获取成功", "data", result);
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "serviceItem", method = RequestMethod.GET)
    @ApiOperation("康复管理-康复计划服务项目确认详情页")
    @ObserverRequired
    public String serviceItem(@ApiParam(name = "planDetailId", value = "康复计划服务项目id", required = true)
                              @RequestParam(value = "planDetailId", required = true)String planDetailId){
        try {
            JSONObject result = rehabilitationManageService.serviceItem(planDetailId);
            return write(200, "获取成功", "data", result);
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
}

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

@ -1,145 +0,0 @@
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;
import com.yihu.wlyy.service.specialist.RehabilitationPlanService;
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;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
 * Created by humingfen on 2018/8/22.
 */
@RestController
@RequestMapping(value = "/third/rehabilitaionPlan",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "康复服务套餐管理")
public class ThirdRehabilitationPlanController extends BaseController {
    @Autowired
    private RehabilitationPlanService rehabilitationPlanService;
    @Autowired
    private AdminTeamService teamService;
    @Autowired
    private DoctorService doctorService;
    @Autowired
    private FamilyService familyService;
    @RequestMapping(value = "/findTemplateList", method = RequestMethod.GET)
    @ApiOperation(value = "获取康复服务套餐模板列表")
    public String templateList(@ApiParam(name = "doctor", value = "医生标识")
                                   @RequestParam(required = true)String doctor,
                               @ApiParam(name = "patient", value = "居民标识")
                                   @RequestParam(required = false)String patient){
        try {
            return write(200, "获取成功", "data", rehabilitationPlanService.findTemplateInfo(doctor, patient));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "/findTemplateDetail", method = RequestMethod.GET)
    @ApiOperation(value = "获取康复服务套餐模板明细")
    public String findTemplateDetail(@ApiParam(name = "templateId", value = "模板id")
                                         @RequestParam(required = true)String templateId){
        try {
            return write(200, "获取成功", "data", rehabilitationPlanService.findTemplateDetailInfo(templateId));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "/createTemplate", method = RequestMethod.POST)
    @ApiOperation(value = "创建康复服务套餐模板")
    public String createTemplate(@ApiParam(name = "doctor", value = "医生标识")
                                     @RequestParam(required = true)String doctor,
                                 @ApiParam(name = "title", value = "康复服务模板名称")
                                    @RequestParam(required = true) String title){
        try {
            AdminTeam team = teamService.findByLeaderCode(doctor);
            Doctor d = doctorService.findDoctorByCode(doctor);
            return write(200, "获取成功", "data", rehabilitationPlanService.createTemplate(title,d,team.getId()));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "/createTemplateDetail", method = RequestMethod.POST)
    @ApiOperation(value = "创建康复服务套餐模板明细")
    public String createTemplateDetail(@ApiParam(name = "doctor", value = "医生标识")
                                           @RequestParam(required = true)String doctor,
                                       @ApiParam(name = "json", value = "康复服务模板明细")
                                            @RequestParam(required = true) String json,
                                       @ApiParam(name = "type", value = "create或者edit")
                                            @RequestParam(required = true) String type){
        try {
            Doctor d = doctorService.findDoctorByCode(doctor);
            return write(200, "获取成功", "data", rehabilitationPlanService.createTemplateDetail(json, type, d));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "/deleteTemplate", method = RequestMethod.POST)
    @ApiOperation(value = "删除康复服务套餐模板")
    public String deleteTemplate(@ApiParam(name = "templateId", value = "模板id")
                                 @RequestParam(required = true)String templateId){
        try {
            return write(200, "获取成功", "data", rehabilitationPlanService.deleteTemplate(templateId));
        } catch (Exception e) {
            error(e);
            return error(-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){
        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 = "医生标识")
                                               @RequestParam(required = true)String doctor,
                                           @ApiParam(name = "json", value = "康复计划json")
                                               @RequestParam(required = true) String json){
        try {
            Doctor d = doctorService.findDoctorByCode(doctor);
            return write(200, "获取成功", "data", rehabilitationPlanService.createRehabilitationPlan(json,d));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
}

+ 8 - 4
patient-co/patient-co-wlyy/src/main/resources/application-dev.yml

@ -33,6 +33,7 @@ doctorAssistant:
im:
  im_list_get: http://172.19.103.88:3000/
  #im_list_get: http://192.168.131.24:3000/
  data_base_name: ichat
#专病配置
@ -191,22 +192,25 @@ es:
#集美宣教居民端健康文章
jkEdu:
  web:
    #articleBaseUrl: http://172.19.103.87:9088/
    articleBaseUrl: http://192.168.131.131:8088/
    articleBaseUrl: http://172.19.103.87:9088/
#    articleBaseUrl: http://192.168.131.131:8088/
#消息队列
activemq:
  username: admin
  password: admin
  url: tcp://172.19.103.87:61616
  queue:
    healtHarticleQueue: healthArticleChannel_dev  #健康文章推送
    deviceMeasurementRemindingQueue : deviceMeasurementChannel_dev #设备测量提醒
#    healtHarticleQueue: healthArticleChannel_dev  #健康文章推送
#    deviceMeasurementRemindingQueue : deviceMeasurementChannel_dev #设备测量提醒
    healtHarticleQueue: healthArticleChannel_test  #健康文章推送
    deviceMeasurementRemindingQueue : deviceMeasurementChannel_test #设备测量提醒
##如果是外网项目就是flase 内网是true
neiwang:
  enable: true
  #wlyy: http://59.61.92.90:8072/wlyy
  wlyy: http://172.19.103.54:22122/
  #wlyy: http://192.168.131.130:8080/
#系统中使用的双层对称加密使用到的KEY
Riva: