|
@ -102,7 +102,7 @@ public class MyFamilyService {
|
|
|
BasePatientDO patientDO = patientService.findByIdAndDel(patient);
|
|
|
//1、检验手机号码是否有存在账号,
|
|
|
BasePatientDO familyPatient = patientService.findByMobileAndDel(familyMobile);
|
|
|
Long time = 1000*60*60*Long.valueOf(qrCodeFailurTime);
|
|
|
Long time = 1000*60*60*24*Long.valueOf(qrCodeFailurTime);
|
|
|
if(familyPatient==null){
|
|
|
//2、没有存在账号的,预注册一个账号,调用预注册接口
|
|
|
Map<String,Object> map = patientService.bespeakRegist(familyMobile,time);
|
|
@ -120,10 +120,14 @@ public class MyFamilyService {
|
|
|
patientApplyLog.setFamilyMemberName(familyPatient.getName());
|
|
|
patientApplyLog.setFamilyMemberCode(familyPatient.getId());
|
|
|
patientApplyLog.setDel(1);
|
|
|
patientApplyLog.setStatus(1);
|
|
|
patientApplyLog.setCreateTime(new Date());
|
|
|
patientApplyLog.setCreateUser(familyPatient.getId());
|
|
|
patientApplyLog.setCreateUser(patientDO.getId());
|
|
|
patientApplyLog.setCreateUserName(patientDO.getName());
|
|
|
patientApplyLog.setFamilyBindRole(familyBindRole);
|
|
|
Long failurTime = System.currentTimeMillis()+time;
|
|
|
patientApplyLog.setFailureTime(new Date(failurTime));
|
|
|
patientApplyLog = patientApplyLogService.save(patientApplyLog);
|
|
|
//4、发送绑定家人的系统消息
|
|
|
BaseMessageDO messageDO = new BaseMessageDO();
|
|
|
messageDO.setReceiver(familyPatient.getId());
|
|
@ -132,8 +136,8 @@ public class MyFamilyService {
|
|
|
messageDO.setSenderName(patientDO.getName());
|
|
|
messageDO.setSenderPhoto(patientDO.getPhoto());
|
|
|
messageDO.setTitle("家人绑定");
|
|
|
messageDO.setMsgDigest(null);
|
|
|
messageDO.setMsgContent(null);
|
|
|
messageDO.setMsgDigest("");
|
|
|
messageDO.setMsgContent("");
|
|
|
messageDO.setMsgTypeCode("010801");
|
|
|
messageDO.setMsgTypeName("");
|
|
|
messageDO.setPlatform(platform);
|
|
@ -141,11 +145,14 @@ public class MyFamilyService {
|
|
|
messageDO.setReadonly(0);
|
|
|
messageDO.setDel("1");
|
|
|
messageDO.setCreateTime(new Date());
|
|
|
messageDO.setRelationData(patientApplyLog.getId()+"");
|
|
|
messageService.save(messageDO);
|
|
|
}else{
|
|
|
|
|
|
Long failurTime = System.currentTimeMillis()+time;
|
|
|
patientApplyLog.setFailureTime(new Date(failurTime));
|
|
|
patientApplyLog = patientApplyLogService.save(patientApplyLog);
|
|
|
}
|
|
|
Long failurTime = System.currentTimeMillis()+time;
|
|
|
patientApplyLog.setFailureTime(new Date(failurTime));
|
|
|
patientApplyLog = patientApplyLogService.save(patientApplyLog);
|
|
|
|
|
|
// PatientApplyLog patientApplyLog = createFamilyQrCode(request,familyPatient,wechatId,patient,familyBindRole);
|
|
|
|
|
@ -418,11 +425,12 @@ public class MyFamilyService {
|
|
|
BasePatientDO familyMember = patientService.findByIdAndDel(one.getFamilyMember());
|
|
|
map.put("photo",familyMember.getPhoto());//头像
|
|
|
map.put("name",familyMember.getName());//姓名
|
|
|
map.put("roleName",role.get(one.getFamilyRelation()+1));//角色名称
|
|
|
map.put("roleName",role.get(one.getFamilyRelation()-1));//角色名称
|
|
|
map.put("mobile",familyMember.getMobile());//手机号码
|
|
|
map.put("isAuthorize",one.getIsAuthorize());//0:未授权,1:已授权
|
|
|
map.put("familyMemberId",one.getId());
|
|
|
map.put("patientId",familyMember.getId());
|
|
|
map.put("familyPatientId",familyMember.getId());
|
|
|
map.put("patientId",patient);
|
|
|
map.put("type",1);
|
|
|
resultList.add(map);
|
|
|
}
|
|
@ -433,15 +441,20 @@ public class MyFamilyService {
|
|
|
BasePatientDO familyMember = patientService.findByIdAndDel(one.get("family_member_code")+"");
|
|
|
map.put("photo",familyMember.getPhoto());//头像
|
|
|
map.put("name",familyMember.getName());//姓名
|
|
|
map.put("roleName",role.get(Integer.valueOf(one.get("family_bind_role")+"")+1));//角色名称
|
|
|
map.put("roleName",role.get(Integer.valueOf(one.get("family_bind_role")+"")-1));//角色名称
|
|
|
map.put("mobile",familyMember.getMobile());//手机号码
|
|
|
//有效期
|
|
|
Date failurTime = (Date)one.get("failure_time");
|
|
|
Long l = failurTime.getTime()-System.currentTimeMillis();
|
|
|
Long day24 = 1000*60*60*24L;
|
|
|
map.put("day",l/day24);
|
|
|
if(l%day24>0){
|
|
|
map.put("day",(l/day24)+1);
|
|
|
}else{
|
|
|
map.put("day",l/day24);
|
|
|
}
|
|
|
map.put("patientApplyId",one.get("id"));
|
|
|
map.put("patientId",familyMember.getId());
|
|
|
map.put("familyPatientId",familyMember.getId());
|
|
|
map.put("patientId",patient);
|
|
|
map.put("type",2);
|
|
|
resultList.add(map);
|
|
|
}
|
|
@ -452,7 +465,7 @@ public class MyFamilyService {
|
|
|
BasePatientDO familyMember = patientService.findByIdAndDel(one.get("family_member_code")+"");
|
|
|
map.put("photo",familyMember.getPhoto());//头像
|
|
|
map.put("name",familyMember.getName());//姓名
|
|
|
map.put("roleName",role.get(Integer.valueOf(one.get("family_bind_role")+"")+1));//角色名称
|
|
|
map.put("roleName",role.get(Integer.valueOf(one.get("family_bind_role")+"")-1));//角色名称
|
|
|
map.put("mobile",familyMember.getMobile());//手机号码
|
|
|
Integer status = null;
|
|
|
if("1".equals(one.get("status")+"")||"2".equals(one.get("status")+"")){
|
|
@ -462,6 +475,8 @@ public class MyFamilyService {
|
|
|
}
|
|
|
map.put("status",one.get("status"));//状态
|
|
|
map.put("statusName",getStatusName(status));//状态名称;
|
|
|
map.put("familyPatientId",familyMember.getId());
|
|
|
map.put("patientId",patient);
|
|
|
map.put("type",3);
|
|
|
resultList.add(map);
|
|
|
}
|
|
@ -521,6 +536,32 @@ public class MyFamilyService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 解除绑定
|
|
|
* @param familyMemberId
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void cancelBindFamily(String familyMemberId) throws Exception{
|
|
|
int i = patientFamilyMemberService.cancelBindFamily(familyMemberId);
|
|
|
if(i<0){
|
|
|
throw new Exception("update data failur !");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 更新授权
|
|
|
* @param familyMemberId
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void updateAuthorizeById(Integer isAuthorize,String familyMemberId) throws Exception{
|
|
|
int i = patientFamilyMemberService.updateAuthorizeById(isAuthorize,familyMemberId);
|
|
|
if(i<0){
|
|
|
throw new Exception("update data failur !");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 家庭关系转换
|