|
@ -107,7 +107,7 @@ public class MyFamilyService {
|
|
|
}
|
|
|
}
|
|
|
//生成社保卡号
|
|
|
if(!StringUtils.isEmpty(principalNum)){
|
|
|
if(!StringUtils.isEmpty(principalNum)&&!patientMedicareCardService.existsByCodeAndDel(principalNum)){
|
|
|
PatientMedicareCardDO medicareCardDO = new PatientMedicareCardDO();
|
|
|
medicareCardDO.setCode(principalNum);
|
|
|
medicareCardDO.setParentType(PatientMedicareCardDO.ParentType.CareCard.getType());
|
|
@ -140,7 +140,12 @@ public class MyFamilyService {
|
|
|
messageDO.setSenderPhoto(patientDO.getPhoto());
|
|
|
messageDO.setTitle("家人绑定");
|
|
|
messageDO.setMsgDigest("");
|
|
|
String msgContent = familyPatient.getName()+",您好!"+patientDO.getName()+"向您发起添加家人申请,添加成功后,对方可使用您的账号,为您处理各类健康服务。";
|
|
|
String msgContent = "";
|
|
|
if(familyPatient.getName()==null){
|
|
|
msgContent = "您好!"+patientDO.getName()+"向您发起添加家人申请,添加成功后,对方可使用您的账号,为您处理各类健康服务。";
|
|
|
}else{
|
|
|
msgContent = familyPatient.getName()+",您好!"+patientDO.getName()+"向您发起添加家人申请,添加成功后,对方可使用您的账号,为您处理各类健康服务。";
|
|
|
}
|
|
|
messageDO.setMsgContent(msgContent);
|
|
|
messageDO.setMsgTypeCode("010801");
|
|
|
messageDO.setMsgTypeName("系统消息-添加家人申请");
|
|
@ -186,13 +191,28 @@ public class MyFamilyService {
|
|
|
*/
|
|
|
public Map<String,Object> signBindFamily( String patient, String familyMobile, Integer platform,Integer familyBindRole,Integer isAdult,
|
|
|
String familyName,String principalNum,String idcard) throws Exception{
|
|
|
//判断身份证号和社保卡号重复问题
|
|
|
if(patientService.existsByIdcard(idcard)){
|
|
|
throw new Exception("填写身份证已存在!");
|
|
|
}
|
|
|
if(patientMedicareCardService.existsByCodeAndDel(principalNum)){
|
|
|
throw new Exception("填写社保卡号已存在!");
|
|
|
|
|
|
BasePatientDO familyPatient2 = patientService.findByMobileAndDel(familyMobile);
|
|
|
if(familyPatient2!=null){
|
|
|
if(!idcard.equals(familyPatient2.getIdcard())){
|
|
|
throw new Exception("填写身份证有误!");
|
|
|
}
|
|
|
if(!StringUtils.isEmpty(principalNum)){
|
|
|
PatientMedicareCardDO card = patientMedicareCardService.findByTypeAndPatientCodeAndDel(PatientMedicareCardDO.Type.MedicareCard.getType(),familyPatient2.getId(),"1");
|
|
|
if(card!=null&&!principalNum.equals(card.getCode())){
|
|
|
throw new Exception("填写社保卡号有误!");
|
|
|
}
|
|
|
}
|
|
|
}else{
|
|
|
//判断身份证号和社保卡号重复问题
|
|
|
if(patientService.existsByIdcard(idcard)){
|
|
|
throw new Exception("填写身份证已存在!");
|
|
|
}
|
|
|
if(patientMedicareCardService.existsByCodeAndDel(principalNum)){
|
|
|
throw new Exception("填写社保卡号已存在!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if(isAdult==1){
|
|
|
|
|
|
Map<String,Object> p = bindingMyFamily(patient, familyMobile, platform,familyBindRole,familyName,principalNum,idcard);
|
|
@ -322,6 +342,9 @@ public class MyFamilyService {
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Map<String,Object> scanQRcodeConfirmApply(Integer status,String applyPatient,String familyPatient,Integer familyBindRole,Integer isAuthorize)throws Exception{
|
|
|
if(applyPatient.equals(familyPatient)){
|
|
|
throw new Exception("非家人操作!");
|
|
|
}
|
|
|
Map<String,Object> map = new HashedMap();
|
|
|
if(status==3){
|
|
|
BasePatientFamilyMemberDO patientFamilyMember = new BasePatientFamilyMemberDO();
|
|
@ -375,8 +398,11 @@ public class MyFamilyService {
|
|
|
}else{
|
|
|
map.put("isBinding",0);
|
|
|
}
|
|
|
|
|
|
map.put("explain","您的"+role.get(converRole-1)+apply.getName()+"邀请您绑定家人账号");
|
|
|
if(apply.getName()==null){
|
|
|
map.put("explain","您的"+role.get(converRole-1)+"邀请您绑定家人账号");
|
|
|
}else{
|
|
|
map.put("explain","您的"+role.get(converRole-1)+apply.getName()+"邀请您绑定家人账号");
|
|
|
}
|
|
|
return map;
|
|
|
}
|
|
|
|
|
@ -395,7 +421,11 @@ public class MyFamilyService {
|
|
|
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() + "向您发起的绑定邀请已过期");
|
|
|
if(apply.getName()==null){
|
|
|
map.put("explain", "您的" + role.get(converRole - 1) + "向您发起的绑定邀请已过期");
|
|
|
}else{
|
|
|
map.put("explain", "您的" + role.get(converRole - 1) + apply.getName() + "向您发起的绑定邀请已过期");
|
|
|
}
|
|
|
}else {
|
|
|
map.put("overdue", "0");
|
|
|
}
|
|
@ -451,7 +481,7 @@ public class MyFamilyService {
|
|
|
map2.put("cardTypeName","身份证");
|
|
|
map2.put("idcard",basePatientDO.getIdcard());//身份证
|
|
|
PatientMedicareCardDO patientMedicareCard = patientMedicareCardService.findByTypeAndPatientCodeAndDel(PatientMedicareCardDO.Type.MedicareCard.getType(),basePatientDO.getId(),"1");
|
|
|
if(patientMedicareCardDO!=null){
|
|
|
if(patientMedicareCard!=null){
|
|
|
|
|
|
map2.put("principalNum",patientMedicareCard.getCode());//社保卡号
|
|
|
}else{
|
|
@ -587,12 +617,16 @@ public class MyFamilyService {
|
|
|
map.put("applySex",createPatient.getSex());
|
|
|
map.put("applyPatientPhoto",createPatient.getPhoto());
|
|
|
map.put("applyPatientNonage",this.nonageByIdcard(createPatient.getIdcard()));//1成年,2未成年
|
|
|
map.put("explain","您的"+role.get(converRole-1)+createPatient.getName()+"邀请您绑定家人账号");
|
|
|
if(createPatient.getName()==null){
|
|
|
map.put("explain","您的"+role.get(converRole-1)+"邀请您绑定家人账号");
|
|
|
}else{
|
|
|
map.put("explain","您的"+role.get(converRole-1)+createPatient.getName()+"邀请您绑定家人账号");
|
|
|
}
|
|
|
result.add(map);
|
|
|
BaseMessageDO msg = messageService.findById(Integer.valueOf(one.get("id")+""));
|
|
|
msg.setReadState(1);
|
|
|
msg.setReadTime(new Date());
|
|
|
messageService.save(msg);
|
|
|
// BaseMessageDO msg = messageService.findById(Integer.valueOf(one.get("id")+""));
|
|
|
// msg.setReadState(1);
|
|
|
// msg.setReadTime(new Date());
|
|
|
// messageService.save(msg);
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
@ -612,12 +646,12 @@ public class MyFamilyService {
|
|
|
|
|
|
/**
|
|
|
* 解除绑定
|
|
|
* @param familyMemberId
|
|
|
* @param patient
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void cancelBindFamily(String familyMemberId) throws Exception{
|
|
|
int i = patientFamilyMemberService.cancelBindFamily(familyMemberId);
|
|
|
public void cancelBindFamily(String patient,String familyPatientId) throws Exception{
|
|
|
int i = patientFamilyMemberService.cancelBindFamily(patient,familyPatientId);
|
|
|
if(i<0){
|
|
|
throw new Exception("update data failur !");
|
|
|
}
|