浏览代码

我的家人模块代码提交

liuwenbin 6 年之前
父节点
当前提交
6724bbe24c

+ 3 - 3
svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/myFamily/MyFamilyEndpoint.java

@ -145,7 +145,7 @@ public class MyFamilyEndpoint extends EnvelopRestEndpoint {
    public Envelop scanQRcodeConfirmApply(
            @ApiParam(name = "applyPatient", value = "申请人code", required = true)
            @RequestParam(value = "applyPatient",required = true) String applyPatient,
            @ApiParam(name = "applyPatient", value = "家人code", required = false)
            @ApiParam(name = "familyPatient", value = "家人code", required = false)
            @RequestParam(value = "familyPatient",required = false) String familyPatient,
            @ApiParam(name = "familyBindRole", value = "家庭关系关系 1配偶 2父亲 3母亲 4公公 5婆婆 6岳父 7岳母 8子女", required = true)
            @RequestParam(value = "familyBindRole",required = true) Integer familyBindRole,
@ -154,8 +154,8 @@ public class MyFamilyEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "status", value = "3、通过,4、拒绝", required = true)
            @RequestParam(value = "status",required = true) Integer status) throws Exception {
        try{
            myFamilyService.scanQRcodeConfirmApply(status,applyPatient,getUID(familyPatient),familyBindRole,isAuthorize);
            return success();
            Map<String,Object> resultMap = myFamilyService.scanQRcodeConfirmApply(status,applyPatient,getUID(familyPatient),familyBindRole,isAuthorize);
            return success(resultMap);
        }catch (Exception e){
            e.printStackTrace();
            return failed(e.getMessage());

+ 29 - 15
svr/svr-patient/src/main/java/com/yihu/jw/patient/service/myFamily/MyFamilyService.java

@ -102,8 +102,15 @@ public class MyFamilyService {
        BasePatientDO patientDO = patientService.findByIdAndDel(patient);
        //1、检验手机号码是否有存在账号,
        BasePatientDO familyPatient = patientService.findByMobileAndDel(familyMobile);
        Long time = 1000*60*60*Long.valueOf(qrCodeFailurTime);
        if(familyPatient==null){
            //2、没有存在账号的,预注册一个账号,调用预注册接口
            Map<String,Object> map = patientService.bespeakRegist(familyMobile,time);
            if(Integer.valueOf(map.get("code")+"")==1){
                familyPatient = (BasePatientDO)map.get("patient");
            }else{
                throw new Exception(map.get("message")+"");
            }
        }
        //3、生成申请绑定的记录
@ -125,8 +132,8 @@ public class MyFamilyService {
            messageDO.setSenderName(patientDO.getName());
            messageDO.setSenderPhoto(patientDO.getPhoto());
            messageDO.setTitle("家人绑定");
            messageDO.setMsgDigest("");
            messageDO.setMsgContent("");
            messageDO.setMsgDigest(null);
            messageDO.setMsgContent(null);
            messageDO.setMsgTypeCode("010801");
            messageDO.setMsgTypeName("");
            messageDO.setPlatform(platform);
@ -136,7 +143,6 @@ public class MyFamilyService {
            messageDO.setCreateTime(new Date());
            messageService.save(messageDO);
        }
        Long time = 1000*60*60*Long.valueOf(qrCodeFailurTime);
        Long failurTime = System.currentTimeMillis()+time;
        patientApplyLog.setFailureTime(new Date(failurTime));
        patientApplyLog = patientApplyLogService.save(patientApplyLog);
@ -234,15 +240,9 @@ public class MyFamilyService {
        PatientApplyLog patientApplyLog = patientApplyLogService.findById(patientApplyLogId);
        BasePatientDO apply = patientService.findByIdAndDel(patientApplyLog.getCreateUser());
        BasePatientDO family = patientService.findByIdAndDel(patientApplyLog.getFamilyMemberCode());
        Integer converRole = familyRelationTrans(patientApplyLog.getFamilyBindRole(),apply.getSex());
        if(patientApplyLog.getFailureTime().getTime()<System.currentTimeMillis()){
            map.put("key","0");
            map.put("keyName","绑定过期");
            map.put("applyPhoto",apply.getPhoto());
            map.put("familyPhoto",family.getPhoto());
            map.put("explain","您的"+role.get(converRole-1)+apply.getName()+"向您发起的绑定邀请已过期,您可以点下下方邀请绑定按钮,重新邀请绑定家人。");
            return map;
        }
        map.put("applyPhoto",apply.getPhoto());
        map.put("familyPhoto",family.getPhoto());
        patientApplyLog.setStatus(status);
        patientApplyLog.setConfirmTime(new Date());
        patientApplyLogService.save(patientApplyLog);
@ -264,8 +264,6 @@ public class MyFamilyService {
            patientFamilyMember2.setDel(1);
            patientFamilyMemberService.save(patientFamilyMember2);
        }
        map.put("key","1");
        map.put("keyName","绑定成功");
        return map;
    }
@ -278,7 +276,9 @@ public class MyFamilyService {
     * @param isAuthorize
     * @throws Exception
     */
    public void scanQRcodeConfirmApply(Integer status,String applyPatient,String familyPatient,Integer familyBindRole,Integer isAuthorize)throws Exception{
    @Transactional(rollbackFor = Exception.class)
    public Map<String,Object> scanQRcodeConfirmApply(Integer status,String applyPatient,String familyPatient,Integer familyBindRole,Integer isAuthorize)throws Exception{
        Map<String,Object> map = new HashedMap();
        if(status==3){
            BasePatientFamilyMemberDO patientFamilyMember = new BasePatientFamilyMemberDO();
            patientFamilyMember.setPatient(applyPatient);
@ -296,6 +296,11 @@ public class MyFamilyService {
            patientFamilyMember2.setDel(1);
            patientFamilyMemberService.save(patientFamilyMember2);
        }
        BasePatientDO apply = patientService.findByIdAndDel(applyPatient);
        BasePatientDO family = patientService.findByIdAndDel(familyPatient);
        map.put("applyPhoto",apply.getPhoto());
        map.put("familyPhoto",family.getPhoto());
        return map;
    }
    /**
@ -326,6 +331,15 @@ public class MyFamilyService {
        BaseMessageDO messageDO = messageService.findById(messageId);
        PatientApplyLog patientApplyLog = patientApplyLogService.findById(Integer.valueOf(messageDO.getRelationData()+""));
        Map<String,Object> map = scanQRcode(patientApplyLog.getCreateUser(),patientApplyLog.getFamilyMemberCode(),patientApplyLog.getFamilyBindRole());
        BasePatientDO apply = patientService.findByIdAndDel(patientApplyLog.getCreateUser());
        Integer converRole = familyRelationTrans(patientApplyLog.getFamilyBindRole(),apply.getSex());
        if(patientApplyLog.getFailureTime().getTime()<System.currentTimeMillis()) {
            map.put("overdue", "1");//过期
            map.put("explain", "您的" + role.get(converRole - 1) + apply.getName() + "向您发起的绑定邀请已过期");
        }else {
            map.put("overdue", "0");
        }
        map.put("patientApplyLogId",patientApplyLog.getId());
        return map;
    }

+ 1 - 1
svr/svr-patient/src/main/java/com/yihu/jw/patient/service/myFamily/PatientApplyLogService.java

@ -48,7 +48,7 @@ public class PatientApplyLogService extends BaseJpaService<PatientApplyLog, Pati
    //valid 有效
    public List<Map<String, Object>> findValidByPatient(String patient){
        String sql = "select l.* from patient_apply_for_log l where l.create_user='"+patient+"' and l.del=1 and l.status in (1,2) and l.failure_time>="+ DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss");
        String sql = "select l.* from patient_apply_for_log l where l.create_user='"+patient+"' and l.del=1 and l.status in (1,2) and l.failure_time>='"+ DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss"+"'");
        return jdbcTemplate.queryForList(sql);
    }