| 
															
																@ -1,6 +1,5 @@ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																package com.yihu.jw.patient.service.myFamily; 
															 | 
															
															 | 
															
																package com.yihu.jw.patient.service.myFamily; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.alibaba.fastjson.JSONObject; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.entity.base.message.BaseMessageDO; 
															 | 
															
															 | 
															
																import com.yihu.jw.entity.base.message.BaseMessageDO; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.entity.base.patient.BasePatientDO; 
															 | 
															
															 | 
															
																import com.yihu.jw.entity.base.patient.BasePatientDO; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.entity.base.patient.BasePatientFamilyMemberDO; 
															 | 
															
															 | 
															
																import com.yihu.jw.entity.base.patient.BasePatientFamilyMemberDO; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -9,6 +8,7 @@ import com.yihu.jw.entity.myFamily.PatientApplyLog; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.message.service.MessageService; 
															 | 
															
															 | 
															
																import com.yihu.jw.message.service.MessageService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.patient.service.BasePatientMedicardCardService; 
															 | 
															
															 | 
															
																import com.yihu.jw.patient.service.BasePatientMedicardCardService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.patient.service.personal_Info.PatientService; 
															 | 
															
															 | 
															
																import com.yihu.jw.patient.service.personal_Info.PatientService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import com.yihu.jw.patient.service.servicepackage.PackageService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.wechat.service.WeChatQrcodeService; 
															 | 
															
															 | 
															
																import com.yihu.jw.wechat.service.WeChatQrcodeService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import org.apache.commons.collections.map.HashedMap; 
															 | 
															
															 | 
															
																import org.apache.commons.collections.map.HashedMap; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import org.apache.commons.collections.map.LinkedMap; 
															 | 
															
															 | 
															
																import org.apache.commons.collections.map.LinkedMap; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -41,14 +41,16 @@ public class MyFamilyService { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    private PatientApplyLogService patientApplyLogService; 
															 | 
															
															 | 
															
																    private PatientApplyLogService patientApplyLogService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    @Autowired 
															 | 
															
															 | 
															
																    @Autowired 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    private BasePatientMedicardCardService  patientMedicareCardService; 
															 | 
															
															 | 
															
																    private BasePatientMedicardCardService  patientMedicareCardService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    @Autowired 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    private PackageService packageService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    LinkedList<String> role = new LinkedList<>(Arrays.asList("配偶","父亲","母亲","公公","婆婆","岳父","岳母","女婿","儿媳","子女")); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    public List<Map<String,Object>> getMyFamilyBindingRole(String patient) throws Exception{ 
															 | 
															
															 | 
															
																    public List<Map<String,Object>> getMyFamilyBindingRole(String patient) throws Exception{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        //获取用户的信息,根据完善信息获取男女 
															 | 
															
															 | 
															
																        //获取用户的信息,根据完善信息获取男女 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        BasePatientDO patientDO = patientService.findByIdAndDel(patient); 
															 | 
															
															 | 
															
																        BasePatientDO patientDO = patientService.findByIdAndDel(patient); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        Integer sex = patientDO.getSex(); 
															 | 
															
															 | 
															
																        Integer sex = patientDO.getSex(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        LinkedList<String> role = new LinkedList<>(Arrays.asList("配偶","父亲","母亲","公公","婆婆","岳父","岳母","女婿","儿媳","子女")); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        Map<String,Map<String,Object>> map = new LinkedMap(); 
															 | 
															
															 | 
															
																        Map<String,Map<String,Object>> map = new LinkedMap(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        for(int i =0;i<role.size();i++){ 
															 | 
															
															 | 
															
																        for(int i =0;i<role.size();i++){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            Map<String,Object> m = new LinkedMap(); 
															 | 
															
															 | 
															
																            Map<String,Object> m = new LinkedMap(); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -115,7 +117,8 @@ public class MyFamilyService { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        messageDO.setReceiver(familyPatient.getId()); 
															 | 
															
															 | 
															
																        messageDO.setReceiver(familyPatient.getId()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        messageDO.setReceiverName(familyPatient.getName()); 
															 | 
															
															 | 
															
																        messageDO.setReceiverName(familyPatient.getName()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        messageDO.setSender(patient); 
															 | 
															
															 | 
															
																        messageDO.setSender(patient); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        messageDO.setType(1); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        messageDO.setFailureTime(patientApplyLog.getFailureTime()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        messageDO.setSenderName(patientDO.getName()); 
															 | 
															
															 | 
															
																        messageDO.setSenderName(patientDO.getName()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        messageDO.setSenderPhoto(patientDO.getPhoto()); 
															 | 
															
															 | 
															
																        messageDO.setSenderPhoto(patientDO.getPhoto()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        messageDO.setTitle("家人绑定"); 
															 | 
															
															 | 
															
																        messageDO.setTitle("家人绑定"); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -132,6 +135,36 @@ public class MyFamilyService { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        return patientApplyLog; 
															 | 
															
															 | 
															
																        return patientApplyLog; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    } 
															 | 
															
															 | 
															
																    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    /** 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * 签约绑定家人 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * @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{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        if(isAdult==1){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            PatientApplyLog p = bindingMyFamily(request,wechatId, saasId,patient, familyMobile, platform,familyBindRole); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            return p; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        }else if(isAdult==0){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            //注册一个没有手机号码的用户信息 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            BasePatientDO familyPatient = null; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            //生成绑定信息 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            BasePatientFamilyMemberDO patientFamilyMember = new BasePatientFamilyMemberDO(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            patientFamilyMember.setPatient(patient); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            patientFamilyMember.setFamilyMember(familyPatient.getId()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            patientFamilyMember.setFamilyRelation(familyBindRole); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            patientFamilyMember.setIsAuthorize(1);//0:未授权,1:已授权 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            patientFamilyMember.setDel(1); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            patientFamilyMemberService.save(patientFamilyMember); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        return null; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    /** 
															 | 
															
															 | 
															
																    /** 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * 生成绑定家人的二维码 
															 | 
															
															 | 
															
																     * 生成绑定家人的二维码 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @param request 
															 | 
															
															 | 
															
																     * @param request 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -172,6 +205,7 @@ public class MyFamilyService { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @param remindType 
															 | 
															
															 | 
															
																     * @param remindType 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @throws Exception 
															 | 
															
															 | 
															
																     * @throws Exception 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     */ 
															 | 
															
															 | 
															
																     */ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    @Transactional(rollbackFor = Exception.class) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    public void remindMyFamily(Integer patientApplyLogId,Integer remindType) throws Exception{ 
															 | 
															
															 | 
															
																    public void remindMyFamily(Integer patientApplyLogId,Integer remindType) throws Exception{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        int i = patientApplyLogService.updateRemindTypeById(remindType,patientApplyLogId); 
															 | 
															
															 | 
															
																        int i = patientApplyLogService.updateRemindTypeById(remindType,patientApplyLogId); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if(i<0){ 
															 | 
															
															 | 
															
																        if(i<0){ 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -181,25 +215,12 @@ public class MyFamilyService { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    /** 
															 | 
															
															 | 
															
																    /** 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * 家人确认绑定 
															 | 
															
															 | 
															
																     * 家人确认绑定 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @param messageId 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @param patientApplyLogId 
															 | 
															
															 | 
															
																     * @param patientApplyLogId 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @param status 1、添加家人(默认),2、邀请登录,3、通过,4、拒绝 
															 | 
															
															 | 
															
																     * @param status 1、添加家人(默认),2、邀请登录,3、通过,4、拒绝 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     */ 
															 | 
															
															 | 
															
																     */ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    @Transactional(rollbackFor = Exception.class) 
															 | 
															
															 | 
															
																    @Transactional(rollbackFor = Exception.class) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    public void confirmApply(Integer messageId,Integer patientApplyLogId,Integer status,Integer isAuthorize){ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    public void confirmApply(Integer patientApplyLogId,Integer status,Integer isAuthorize){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        BaseMessageDO messageDO = null; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if(messageId!=null){ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            messageDO = messageService.findById(messageId); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if(messageDO!=null&&patientApplyLogId==null){ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            String json = messageDO.getRelationData(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            JSONObject jsonObject = JSONObject.parseObject(json); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            patientApplyLogId = (Integer)jsonObject.get("patientApplyLogId"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            messageDO.setReadState(1); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            messageDO.setReadTime(new Date()); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            messageService.save(messageDO); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        PatientApplyLog patientApplyLog = patientApplyLogService.findById(patientApplyLogId); 
															 | 
															
															 | 
															
																        PatientApplyLog patientApplyLog = patientApplyLogService.findById(patientApplyLogId); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        patientApplyLog.setStatus(status); 
															 | 
															
															 | 
															
																        patientApplyLog.setStatus(status); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -224,7 +245,7 @@ public class MyFamilyService { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @return 
															 | 
															
															 | 
															
																     * @return 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @throws Exception 
															 | 
															
															 | 
															
																     * @throws Exception 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     */ 
															 | 
															
															 | 
															
																     */ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    public List<Map<String,Object>> getBindingList(String patient) throws Exception{ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    public List<Map<String,Object>> getBindingList(String patient,String packageId) throws Exception{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        List<Map<String,Object>> resultList = new LinkedList<>(); 
															 | 
															
															 | 
															
																        List<Map<String,Object>> resultList = new LinkedList<>(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        List<BasePatientFamilyMemberDO> list = patientFamilyMemberService.getByPatientAndFamilyMember(patient); 
															 | 
															
															 | 
															
																        List<BasePatientFamilyMemberDO> list = patientFamilyMemberService.getByPatientAndFamilyMember(patient); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        String patientTemp = null; 
															 | 
															
															 | 
															
																        String patientTemp = null; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -244,6 +265,14 @@ public class MyFamilyService { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            map.put("principalNum","");//社保卡号 
															 | 
															
															 | 
															
																            map.put("principalNum","");//社保卡号 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        map.put("mobile",basePatientDO.getMobile());//手机号码 
															 | 
															
															 | 
															
																        map.put("mobile",basePatientDO.getMobile());//手机号码 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        if(StringUtils.isEmpty(packageId)){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            if(packageService.findPatientSignExist(patient,packageId)){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                map.put("isPackage",1); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            }else{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                map.put("isPackage",0); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        resultList.add(map); 
															 | 
															
															 | 
															
																        resultList.add(map); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        //家人 
															 | 
															
															 | 
															
																        //家人 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        for(BasePatientFamilyMemberDO one:list){ 
															 | 
															
															 | 
															
																        for(BasePatientFamilyMemberDO one:list){ 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -267,11 +296,100 @@ public class MyFamilyService { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                map2.put("principalNum","");//社保卡号 
															 | 
															
															 | 
															
																                map2.put("principalNum","");//社保卡号 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            } 
															 | 
															
															 | 
															
																            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            map2.put("mobile",basePatientDO.getMobile());//手机号码 
															 | 
															
															 | 
															
																            map2.put("mobile",basePatientDO.getMobile());//手机号码 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            if(StringUtils.isEmpty(packageId)){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                if(packageService.findPatientSignExist(patient,packageId)){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    map2.put("isPackage",1); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                }else{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    map2.put("isPackage",0); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            resultList.add(map2); 
															 | 
															
															 | 
															
																            resultList.add(map2); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        return resultList; 
															 | 
															
															 | 
															
																        return resultList; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    } 
															 | 
															
															 | 
															
																    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    public void myFamilyBindList(String patient) throws Exception{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        //已绑定的 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        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())){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                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("mobile",familyMember.getMobile());//手机号码 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                map.put("isAuthorize",one.getIsAuthorize());//0:未授权,1:已授权 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                map.put("familyMemberId",one.getId()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                map.put("patientId",familyMember.getId()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                map.put("type",1); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            }else{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                Integer familyRelation = familyRelationTrans(one.getFamilyRelation(),patientDO.getSex()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                BasePatientDO familyMember = patientService.findByIdAndDel(one.getPatient()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                map.put("photo",familyMember.getPhoto());//头像 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                map.put("name",familyMember.getName());//姓名 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                map.put("roleName",role.get(familyRelation+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("type",1); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            resultList.add(map); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        //已邀请的 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//        patientApplyLogService. 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        //已取消的 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    /** 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * 有效的申请绑定消息 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * @param patient 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     */ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    @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>> result = new ArrayList<>(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        PatientApplyLog patientApplyLog = null; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        for(BaseMessageDO one:msgList){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            Map<String,Object> map = new HashedMap(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            String o = one.getRelationData(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            patientApplyLog = patientApplyLogService.findById(Integer.valueOf(o)); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            Integer bindRole = patientApplyLog.getFamilyBindRole(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            String createUser = patientApplyLog.getCreateUser();//申请人code 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            BasePatientDO patientDO = patientService.findByIdAndDel(patient);//被绑定人 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            BasePatientDO createPatient = patientService.findByIdAndDel(createUser);//绑定人 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            Integer converRole = familyRelationTrans(bindRole,createPatient.getSex());//转换后的角色 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            map.put("patientApplyLogId",one.getId()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            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); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        return result; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    /** 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * 取消申请绑定家人 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * @param patientApplyLogId 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * @throws Exception 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     */ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    @Transactional(rollbackFor = Exception.class) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    public void cancelApply(Integer patientApplyLogId) throws Exception{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        int i= patientApplyLogService.updateStatusById(5, patientApplyLogId); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        if(i<0){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            throw new Exception("update data failur !"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    /** 
															 | 
															
															 | 
															
																    /** 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * 家庭关系转换 
															 | 
															
															 | 
															
																     * 家庭关系转换 
															 |