Browse Source

康复计划--服务码;设备绑定增加活跃度;

zd_123 7 years ago
parent
commit
13699dc533

+ 1 - 1
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/JMService.java

@ -442,7 +442,7 @@ public class JMService {
        return re;
    }
    private String apiString = "Action";
    private String apiString = "";
    /**
     * 获取口令,4小时有效,465439011

+ 1 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/bank/TaskService.java

@ -307,6 +307,7 @@ public class TaskService {
        object.put("patientIdcard",patient.getIdcard());
        object.put("patientOpenid",patient.getOpenid());
        String url =getBaseUrl() + "createActiveRecord";
        //String url = "http://localhost:10051/svr-health-bank/createActiveRecord";
        try {
            response = httpClientUtil.iotPostBody(url,object.toString());
        }catch (Exception e){

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

@ -45,6 +45,8 @@ public class RehabilitationManageService extends BaseService {
    private String updateStatusRehabilitationOperate = "/svr-specialist/updateStatusRehabilitationOperate";//康复管理-服务项目-完成项目内容信息
    private String patientRehabilitationDetail = "/svr-specialist/patientRehabilitationDetail";//康复管理-居民详情页
    private String recentPlanDetailRecord = "/svr-specialist/recentPlanDetailRecord";//居民康复计划详情页-近期康复相关记录
    private String createServiceQrCode ="/svr-specialist/createServiceQrCode";//根据康复计划明细id和对话sessionId生成服务码
    private String checkAfterQrCode="/svr-specialist/checkAfterQrCode";//居民扫码后验证是否是关联的居民扫码
    /************************************************************* end ************************************************************************/
    /**
@ -198,7 +200,6 @@ public class RehabilitationManageService extends BaseService {
     * @param messageId
     * @param patientCode
     * @param doctorCode
     * @param doctorType
     * @param content
     * @param planDetailId
     * @return
@ -291,4 +292,27 @@ public class RehabilitationManageService extends BaseService {
        }
        throw new Exception("请求微服务失败!");
    }
    public String createServiceQrCode(String planDetailId,String sessionId) throws Exception{
        Map<String, Object> param = new HashedMap();
        param.put("planDetailId", planDetailId);
        param.put("sessionId", sessionId);
        //specialistUrl= "http://localhost:10051";
        HttpResponse response = HttpUtils.doPost(specialistUrl + createServiceQrCode, param);
        JSONObject result = new JSONObject(response.getContent());
        if(result.getInt("status")==200){
            return String.valueOf(result.get("obj"));
        }
        throw new Exception("获取二维码失败!");
    }
    public JSONObject checkAfterQrCode(String planDetailId,String patientCode) throws Exception{
        Map<String, Object> param = new HashedMap();
        param.put("planDetailId", planDetailId);
        param.put("patientCode", patientCode);
        //specialistUrl= "http://localhost:10051";
        HttpResponse response = HttpUtils.doPost(specialistUrl + checkAfterQrCode, param);
        JSONObject result = new JSONObject(response.getContent());
        return  result;
    }
}

+ 19 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/device/DoctorDeviceController.java

@ -136,6 +136,20 @@ public class DoctorDeviceController extends BaseController {
			//修改设备表中{"1":"0", "2":"0"}绑定次数 和其他绑定信息,
			deviceDetailService.updateAfterBinding(device,new Date(),flag);
			String flagStr ="";
			if ("1".equals(device.getCategoryCode())){
				flagStr="GLU_BIND";
			}else if ("2".equals(device.getCategoryCode())){
				flagStr="BP_BIND";
			}
			Patient patient = patientDao.findByCode(device.getUser());
			//活动的活跃度
			if (flag){
				JSONObject jsonObject = new JSONObject();
				jsonObject.put("patientId",patient.getCode());
				jsonObject.put("taskCode",flagStr);
				taskService.createActiveRecord(jsonObject);
			}
			return success("设备保存成功!");
		}
		catch (Exception ex) {
@ -178,12 +192,12 @@ public class DoctorDeviceController extends BaseController {
			SignFamily signFamily = signFamilyDao.findSignByPatient(patient.getCode(),2);
			//调用增加积分接口  海沧区的居民才能添加积分
			String flagStr ="";
			if ("1".equals(device.getCategoryCode())){
				flagStr="GLU_BIND";
			}else if ("2".equals(device.getCategoryCode())){
				flagStr="BP_BIND";
			}
			if (flag && "350205".equals(signFamily.getHospital().substring(0,6))){
				if ("1".equals(device.getCategoryCode())){
					flagStr="GLU_BIND";
				}else if ("2".equals(device.getCategoryCode())){
					flagStr="BP_BIND";
				}
				String creditDetail = "{\"tradeType\":\"ACTIVITY_TASK\",\"flag\":\""+flagStr+"\",\"tradeDirection\":1,\"status\":1,\"patientId\":\""+device.getUser()+"\",\"hospital\":\""+patient.getTown()+"\"}";
				JSONObject jsonObject = JSONObject.parseObject(creditDetail);
				JSONObject response = creditLogService.insert(jsonObject);

+ 29 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/specialist/rehabilitation/RehabilitationManageController.java

@ -240,4 +240,33 @@ public class RehabilitationManageController extends BaseController {
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "createServiceQrCode", method = RequestMethod.POST)
    @ApiOperation("康复管理-根据康复计划明细id和对话sessionId生成服务码")
    @ObserverRequired
    public String createServiceQrCode(@ApiParam(name = "planDetailId", value = "康复计划项目明细ID")@RequestParam(value = "planDetailId", required = true)String planDetailId,
                                      @ApiParam(name = "sessionId", value = "IM对话sessionId")@RequestParam(value = "sessionId", required = true)String sessionId){
        try {
            return write(200, "获取二维码成功!", "data", rehabilitationManageService.createServiceQrCode(planDetailId,sessionId));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求二维码失败");
        }
    }
    @RequestMapping(value = "checkAfterQrCode", method = RequestMethod.POST)
    @ApiOperation("康复管理-居民扫码后验证是否是关联的居民扫码")
    @ObserverRequired
    public String checkAfterQrCode(@ApiParam(name = "planDetailId", value = "康复计划项目明细ID")@RequestParam(value = "planDetailId", required = true)String planDetailId,
                                      @ApiParam(name = "patientCode", value = "居民端登录的居民code")@RequestParam(value = "patientCode", required = true)String patientCode){
        try {
            JSONObject result = rehabilitationManageService.checkAfterQrCode(planDetailId,patientCode);
            return write(200, String.valueOf(result.get("message")), "data", result.get("obj"));
        } catch (Exception e) {
            error(e);
            return error(-1, "验证失败");
        }
    }
}

+ 5 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/device/PatientDeviceController.java

@ -253,12 +253,12 @@ public class PatientDeviceController extends BaseController {
            deviceDetailService.updateAfterBinding(device,new Date(),flag);
            SignFamily signFamily = signFamilyDao.findSignByPatient(patient.getCode());
            String flagStr ="";
            if ("1".equals(device.getCategoryCode())){
                flagStr="GLU_BIND";
            }else if ("2".equals(device.getCategoryCode())){
                flagStr="BP_BIND";
            }
            if (flag && "350205".equals(signFamily.getHospital().substring(0,6))){
                if ("1".equals(device.getCategoryCode())){
                    flagStr="GLU_BIND";
                }else if ("2".equals(device.getCategoryCode())){
                    flagStr="BP_BIND";
                }
                String creditDetail = "{\"tradeType\":\"ACTIVITY_TASK\",\"flag\":\""+flagStr+"\",\"tradeDirection\":1,\"status\":1,\"patientId\":\""+device.getUser()+"\",\"hospital\":\""+patient.getTown()+"\"}";
                com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(creditDetail);
                com.alibaba.fastjson.JSONObject response = creditLogService.insert(jsonObject);