Kaynağa Gözat

验证二维码是否相关居民扫描

zhangdan 6 yıl önce
ebeveyn
işleme
987037e5a6

+ 1 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/specialist/SpecialistMapping.java

@ -62,6 +62,7 @@ public class SpecialistMapping {
        public static final String updateRehabilitationTemplateDetail = "/updateRehabilitationTemplateDetail";
        public static final String createPatientRehabilitationPlan = "/createPatientRehabilitationPlan";
        public static final String createServiceQrCode ="/createServiceQrCode";
        public static final String checkAfterQrCode = "checkAfterQrCode";
    }
}

+ 27 - 2
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/rehabilitation/RehabilitationPlanController.java

@ -154,8 +154,6 @@ public class RehabilitationPlanController extends EnvelopRestEndpoint {
        }
    }
    @PostMapping(value = SpecialistMapping.rehabilitation.createServiceQrCode)
    @ApiOperation(value = "根据康复计划id和居民code生成服务码")
    public MixEnvelop<String,String> createServiceQrCode(@ApiParam(name = "planId", value = "计划居民关系唯一标识")@RequestParam(value = "planId", required = true)String planId,
@ -168,4 +166,31 @@ public class RehabilitationPlanController extends EnvelopRestEndpoint {
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = SpecialistMapping.rehabilitation.checkAfterQrCode)
    @ApiOperation(value = "居民扫码后验证是否是关联的居民扫码")
    public MixEnvelop<Boolean,Boolean> checkAfterQrCode(@ApiParam(name = "planId", value = "计划居民关系唯一标识")@RequestParam(value = "planId", required = true)String planId,
                                                         @ApiParam(name = "patientCode", value = "居民端登录的居民code")@RequestParam(value = "patientCode", required = true)String patientCode){
        try {
            String message="";
            Boolean flag = true;
            if (rehabilitationPlanService.checkAfterQrCode(planId,patientCode)==1){
                message = "验证成功!";
            }
            if (rehabilitationPlanService.checkAfterQrCode(planId,patientCode)==-1){
                message = "请相关居民扫描二维码";
                flag=false;
            }
            if (rehabilitationPlanService.checkAfterQrCode(planId,patientCode)==-10000){
                message = "相关康复管理数据错误,请联系工作人员!";
                flag=false;
            }
            return MixEnvelop.getSuccess(message,flag);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

+ 15 - 2
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationPlanService.java

@ -58,8 +58,6 @@ public class RehabilitationPlanService {
    private FileUploadService fileUploadService;
    @Autowired
    protected HttpServletRequest request;
    @Autowired
    private PatientRehabilitationPlanDao patientRehabilitationPlanDao;
    public MixEnvelop<String, String> createRehabilitationTemplate(RehabilitationPlanTemplateDO templateDO) {
        templateDO.setCreateTime(new Date());
@ -164,4 +162,19 @@ public class RehabilitationPlanService {
        }
        return MixEnvelop.getSuccess("获取二维码成功!",fileUrl);
    }
    public Integer checkAfterQrCode(String planId,String patietCode){
        int result = 0;
        PatientRehabilitationPlanDO patientRehabilitationPlanDO =  patientRehabilitationPlanDao.findById(planId);
        if (patientRehabilitationPlanDO!=null){
            if (StringUtils.pathEquals(patientRehabilitationPlanDO.getPatient(),patietCode)){
                result =200;
            }else {
                result = -1;
            }
        }else {
            result = -10000;
        }
        return result;
    }
}