|
@ -93,14 +93,13 @@ public class MyFamilyService {
|
|
|
* 一键绑定
|
|
|
* @param request
|
|
|
* @param wechatId
|
|
|
* @param saasId
|
|
|
* @param patient
|
|
|
* @param familyMobile
|
|
|
* @param platform
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public PatientApplyLog bindingMyFamily(HttpServletRequest request,String wechatId, String saasId, String patient, String familyMobile, Integer platform,Integer familyBindRole) throws Exception{
|
|
|
public PatientApplyLog bindingMyFamily(HttpServletRequest request,String wechatId, String patient, String familyMobile, Integer platform,Integer familyBindRole) throws Exception{
|
|
|
|
|
|
BasePatientDO patientDO = patientService.findByIdAndDel(patient);
|
|
|
//1、检验手机号码是否有存在账号,
|
|
@ -113,7 +112,6 @@ public class MyFamilyService {
|
|
|
PatientApplyLog patientApplyLog = createFamilyQrCode(request,familyPatient,wechatId,patient,familyBindRole);
|
|
|
//4、发送绑定家人的系统消息
|
|
|
BaseMessageDO messageDO = new BaseMessageDO();
|
|
|
messageDO.setSaasId(saasId);
|
|
|
messageDO.setReceiver(familyPatient.getId());
|
|
|
messageDO.setReceiverName(familyPatient.getName());
|
|
|
messageDO.setSender(patient);
|
|
@ -139,16 +137,15 @@ public class MyFamilyService {
|
|
|
* 签约绑定家人
|
|
|
* @param request
|
|
|
* @param wechatId
|
|
|
* @param saasId
|
|
|
* @param patient
|
|
|
* @param familyMobile
|
|
|
* @param platform
|
|
|
* @param familyBindRole 1"配偶",2"父亲",3"母亲",4"公公",5"婆婆",6"岳父",7"岳母",8"女婿",9"儿媳",10"子女"
|
|
|
* @param isAdult 0未成年人 1成年人
|
|
|
*/
|
|
|
public PatientApplyLog signBindFamily(HttpServletRequest request,String wechatId, String saasId, String patient, String familyMobile, Integer platform,Integer familyBindRole,Integer isAdult) throws Exception{
|
|
|
public PatientApplyLog signBindFamily(HttpServletRequest request,String wechatId, String patient, String familyMobile, Integer platform,Integer familyBindRole,Integer isAdult) throws Exception{
|
|
|
if(isAdult==1){
|
|
|
PatientApplyLog p = bindingMyFamily(request,wechatId, saasId,patient, familyMobile, platform,familyBindRole);
|
|
|
PatientApplyLog p = bindingMyFamily(request,wechatId,patient, familyMobile, platform,familyBindRole);
|
|
|
return p;
|
|
|
}else if(isAdult==0){
|
|
|
//注册一个没有手机号码的用户信息
|
|
@ -265,7 +262,7 @@ public class MyFamilyService {
|
|
|
map.put("principalNum","");//社保卡号
|
|
|
}
|
|
|
map.put("mobile",basePatientDO.getMobile());//手机号码
|
|
|
if(StringUtils.isEmpty(packageId)){
|
|
|
if(!StringUtils.isEmpty(packageId)){
|
|
|
if(packageService.findPatientSignExist(patient,packageId)){
|
|
|
map.put("isPackage",1);
|
|
|
}else{
|
|
@ -309,11 +306,11 @@ public class MyFamilyService {
|
|
|
return resultList;
|
|
|
}
|
|
|
|
|
|
public void myFamilyBindList(String patient) throws Exception{
|
|
|
public List<Map<String,Object>> myFamilyBindList(String patient) throws Exception{
|
|
|
List<Map<String,Object>> resultList = new LinkedList<>();
|
|
|
//已绑定的
|
|
|
List<BasePatientFamilyMemberDO> bindList = patientFamilyMemberService.getByPatientAndFamilyMember(patient);
|
|
|
BasePatientDO patientDO = patientService.findByIdAndDel(patient);//绑定人
|
|
|
List<Map<String,Object>> resultList = new ArrayList<>();
|
|
|
for(BasePatientFamilyMemberDO one:bindList){
|
|
|
Map<String,Object> map = new HashedMap();
|
|
|
if(patient.equals(one.getPatient())){
|
|
@ -341,8 +338,45 @@ public class MyFamilyService {
|
|
|
resultList.add(map);
|
|
|
}
|
|
|
//已邀请的
|
|
|
// patientApplyLogService.
|
|
|
List<Map<String, Object>> validList = patientApplyLogService.findValidByPatient(patient);
|
|
|
for(Map<String, Object> one:validList){
|
|
|
Map<String,Object> map = new HashedMap();
|
|
|
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("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);
|
|
|
map.put("patientApplyId",one.get("id"));
|
|
|
map.put("patientId",familyMember.getId());
|
|
|
map.put("type",2);
|
|
|
resultList.add(map);
|
|
|
}
|
|
|
//已取消的
|
|
|
List<Map<String, Object>> invalidList = patientApplyLogService.findInvalidByPatient(patient);
|
|
|
for(Map<String, Object> one:invalidList){
|
|
|
Map<String,Object> map = new HashedMap();
|
|
|
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("mobile",familyMember.getMobile());//手机号码
|
|
|
Integer status = null;
|
|
|
if("1".equals(one.get("status")+"")||"2".equals(one.get("status")+"")){
|
|
|
status = 5;
|
|
|
}else if("4".equals(one.get("status")+"")||"5".equals(one.get("status")+"")){
|
|
|
status = Integer.valueOf(one.get("status")+"");
|
|
|
}
|
|
|
map.put("status",one.get("status"));//状态
|
|
|
map.put("statusName",getStatusName(status));//状态名称;
|
|
|
map.put("type",3);
|
|
|
resultList.add(map);
|
|
|
}
|
|
|
return resultList;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@ -351,13 +385,13 @@ public class MyFamilyService {
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public List<Map<String,Object>> applyMessageList(String patient) throws Exception{
|
|
|
List<BaseMessageDO> msgList = messageService.applyMessageList(patient, new Date(), "010801");
|
|
|
List<Map<String, Object>> msgList = messageService.applyMessageList(patient, new Date(), "010801");
|
|
|
List<Map<String,Object>> result = new ArrayList<>();
|
|
|
PatientApplyLog patientApplyLog = null;
|
|
|
for(BaseMessageDO one:msgList){
|
|
|
for(Map<String, Object> one:msgList){
|
|
|
Map<String,Object> map = new HashedMap();
|
|
|
String o = one.getRelationData();
|
|
|
patientApplyLog = patientApplyLogService.findById(Integer.valueOf(o));
|
|
|
String relationData = one.get("relation_data")+"";
|
|
|
patientApplyLog = patientApplyLogService.findById(Integer.valueOf(relationData));
|
|
|
Integer bindRole = patientApplyLog.getFamilyBindRole();
|
|
|
String createUser = patientApplyLog.getCreateUser();//申请人code
|
|
|
|
|
@ -365,14 +399,15 @@ public class MyFamilyService {
|
|
|
BasePatientDO createPatient = patientService.findByIdAndDel(createUser);//绑定人
|
|
|
Integer converRole = familyRelationTrans(bindRole,createPatient.getSex());//转换后的角色
|
|
|
|
|
|
map.put("patientApplyLogId",one.getId());
|
|
|
map.put("patientApplyLogId",relationData);
|
|
|
map.put("patientPhoto",patientDO.getPhoto());
|
|
|
map.put("applyPatientPhoto",createPatient.getPhoto());
|
|
|
map.put("explain","您的"+role.get(converRole-1)+createPatient.getName()+"邀请您绑定家人账号");
|
|
|
result.add(map);
|
|
|
one.setReadonly(1);
|
|
|
one.setReadTime(new Date());
|
|
|
messageService.save(one);
|
|
|
BaseMessageDO msg = messageService.findById(Integer.valueOf(one.get("id")+""));
|
|
|
msg.setReadonly(1);
|
|
|
msg.setReadTime(new Date());
|
|
|
messageService.save(msg);
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
@ -442,4 +477,16 @@ public class MyFamilyService {
|
|
|
return relationTrans;
|
|
|
}
|
|
|
|
|
|
public String getStatusName(Integer status){
|
|
|
String statusName ="";
|
|
|
switch (status){
|
|
|
case 1:statusName="已邀请";break;
|
|
|
case 2:statusName="已邀请";break;
|
|
|
case 3:statusName="已通过";break;
|
|
|
case 4:statusName="已拒绝";break;
|
|
|
case 5:statusName="已取消";break;
|
|
|
}
|
|
|
return statusName;
|
|
|
}
|
|
|
|
|
|
}
|