|  | @ -9,6 +9,7 @@ import com.yihu.jw.message.service.MessageService;
 | 
	
		
			
				|  |  | import com.yihu.jw.patient.service.BasePatientMedicardCardService;
 | 
	
		
			
				|  |  | import com.yihu.jw.patient.service.personal_Info.PatientService;
 | 
	
		
			
				|  |  | import com.yihu.jw.patient.service.servicepackage.PackageService;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.common.IdCardUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.date.DateUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.wechat.service.WeChatQrcodeService;
 | 
	
		
			
				|  |  | import org.apache.commons.collections.map.HashedMap;
 | 
	
	
		
			
				|  | @ -68,22 +69,11 @@ public class MyFamilyService {
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         List<BasePatientFamilyMemberDO> list = patientFamilyMemberService.getByPatientAndFamilyRelation(patient,null);
 | 
	
		
			
				|  |  |         list.addAll(patientFamilyMemberService.getByFamilyMemberAndRelation(patient,null));
 | 
	
		
			
				|  |  |         for(BasePatientFamilyMemberDO one:list){
 | 
	
		
			
				|  |  |             Integer relation = one.getFamilyRelation();
 | 
	
		
			
				|  |  |             if(one.getFamilyMember().equals(patient)){//需要关系转换
 | 
	
		
			
				|  |  |                 BasePatientDO p = patientService.findByIdAndDel(patient);
 | 
	
		
			
				|  |  |                 relation = familyRelationTrans(one.getFamilyRelation(),p.getSex());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if(relation==10){continue;}
 | 
	
		
			
				|  |  |             Map<String,Object> relationMap = map.get(relation.toString());
 | 
	
		
			
				|  |  |             relationMap.put("isBinding",1);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         List<BasePatientFamilyMemberDO> childrenList = patientFamilyMemberService.getByPatientAndFamilyRelation(patient,10);
 | 
	
		
			
				|  |  |         childrenList.addAll(patientFamilyMemberService.getByFamilyMemberAndRelation(patient,2,3));
 | 
	
		
			
				|  |  |         if(childrenList.size()==2){
 | 
	
		
			
				|  |  |             map.get("10").put("isBinding",1);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         Collection<Map<String,Object>> valueCollection = map.values();
 | 
	
		
			
				|  |  |         List<Map<String,Object>> valueList = new LinkedList<>(valueCollection);
 | 
	
		
			
				|  |  |         return valueList;
 | 
	
	
		
			
				|  | @ -97,7 +87,7 @@ public class MyFamilyService {
 | 
	
		
			
				|  |  |      * @throws Exception
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  |     public Map<String,Object> bindingMyFamily( String patient, String familyMobile, Integer platform,Integer familyBindRole) throws Exception{
 | 
	
		
			
				|  |  |     public Map<String,Object> bindingMyFamily( String patient, String familyMobile, Integer platform,Integer familyBindRole,String familyName) throws Exception{
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         BasePatientDO patientDO = patientService.findByIdAndDel(patient);
 | 
	
		
			
				|  |  |         //1、检验手机号码是否有存在账号,
 | 
	
	
		
			
				|  | @ -105,7 +95,7 @@ public class MyFamilyService {
 | 
	
		
			
				|  |  |         Long time = 1000*60*60*24*Long.valueOf(qrCodeFailurTime);
 | 
	
		
			
				|  |  |         if(familyPatient==null){
 | 
	
		
			
				|  |  |             //2、没有存在账号的,预注册一个账号,调用预注册接口
 | 
	
		
			
				|  |  |             Map<String,Object> map = patientService.bespeakRegist(familyMobile,time);
 | 
	
		
			
				|  |  |             Map<String,Object> map = patientService.bespeakRegist(familyMobile,familyName,time);
 | 
	
		
			
				|  |  |             if(Integer.valueOf(map.get("code")+"")==1){
 | 
	
		
			
				|  |  |                 familyPatient = (BasePatientDO)map.get("patient");
 | 
	
		
			
				|  |  |             }else{
 | 
	
	
		
			
				|  | @ -181,13 +171,20 @@ public class MyFamilyService {
 | 
	
		
			
				|  |  |      * @param familyBindRole 1"配偶",2"父亲",3"母亲",4"公公",5"婆婆",6"岳父",7"岳母",8"女婿",9"儿媳",10"子女"
 | 
	
		
			
				|  |  |      * @param isAdult 0未成年人 1成年人
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public Map<String,Object> signBindFamily( String patient, String familyMobile, Integer platform,Integer familyBindRole,Integer isAdult) throws Exception{
 | 
	
		
			
				|  |  |     public Map<String,Object> signBindFamily( String patient, String familyMobile, Integer platform,Integer familyBindRole,Integer isAdult,String familyName) throws Exception{
 | 
	
		
			
				|  |  |         if(isAdult==1){
 | 
	
		
			
				|  |  |             Map<String,Object> p = bindingMyFamily(patient, familyMobile, platform,familyBindRole);
 | 
	
		
			
				|  |  |             Map<String,Object> p = bindingMyFamily(patient, familyMobile, platform,familyBindRole,familyName);
 | 
	
		
			
				|  |  |             return p;
 | 
	
		
			
				|  |  |         }else if(isAdult==0){
 | 
	
		
			
				|  |  |             //注册一个没有手机号码的用户信息
 | 
	
		
			
				|  |  |             BasePatientDO familyPatient = null;
 | 
	
		
			
				|  |  |             BasePatientDO familyPatient = new BasePatientDO();
 | 
	
		
			
				|  |  |             familyPatient.setLocked(0);
 | 
	
		
			
				|  |  |             familyPatient.setEnabled(1);
 | 
	
		
			
				|  |  |             familyPatient.setDel("0");
 | 
	
		
			
				|  |  |             familyPatient.setLoginFailureCount(0);
 | 
	
		
			
				|  |  |             familyPatient.setPatientStatus("1");
 | 
	
		
			
				|  |  |             familyPatient.setName(familyName);
 | 
	
		
			
				|  |  |             familyPatient = patientService.save(familyPatient);
 | 
	
		
			
				|  |  |             //生成绑定信息
 | 
	
		
			
				|  |  |             BasePatientFamilyMemberDO patientFamilyMember = new BasePatientFamilyMemberDO();
 | 
	
		
			
				|  |  |             patientFamilyMember.setPatient(patient);
 | 
	
	
		
			
				|  | @ -196,6 +193,15 @@ public class MyFamilyService {
 | 
	
		
			
				|  |  |             patientFamilyMember.setIsAuthorize(1);//0:未授权,1:已授权
 | 
	
		
			
				|  |  |             patientFamilyMember.setDel(1);
 | 
	
		
			
				|  |  |             patientFamilyMemberService.save(patientFamilyMember);
 | 
	
		
			
				|  |  | //            //生成家人绑定信息
 | 
	
		
			
				|  |  | //            BasePatientFamilyMemberDO patientFamilyMember2 = new BasePatientFamilyMemberDO();
 | 
	
		
			
				|  |  | //            patientFamilyMember2.setPatient(familyPatient.getId());
 | 
	
		
			
				|  |  | //            patientFamilyMember2.setFamilyMember(familyPatient.getName());
 | 
	
		
			
				|  |  | //            BasePatientDO createUser = patientService.findByIdAndDel(patient);
 | 
	
		
			
				|  |  | //            patientFamilyMember2.setFamilyRelation(familyRelationTrans(familyBindRole,createUser.getSex()));
 | 
	
		
			
				|  |  | //            patientFamilyMember2.setIsAuthorize(1);
 | 
	
		
			
				|  |  | //            patientFamilyMember2.setDel(1);
 | 
	
		
			
				|  |  | //            patientFamilyMemberService.save(patientFamilyMember2);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return null;
 | 
	
		
			
				|  |  |     }
 | 
	
	
		
			
				|  | @ -267,7 +273,7 @@ public class MyFamilyService {
 | 
	
		
			
				|  |  |                 patientFamilyMemberService.save(patientFamilyMember);
 | 
	
		
			
				|  |  |                 BasePatientFamilyMemberDO patientFamilyMember2 = new BasePatientFamilyMemberDO();
 | 
	
		
			
				|  |  |                 patientFamilyMember2.setPatient(patientApplyLog.getFamilyMemberCode());
 | 
	
		
			
				|  |  |                 patientFamilyMember2.setFamilyMember(patientApplyLog.getFamilyMemberName());
 | 
	
		
			
				|  |  |                 patientFamilyMember2.setFamilyMember(patientApplyLog.getCreateUser());
 | 
	
		
			
				|  |  |                 BasePatientDO createUser = patientService.findByIdAndDel(patientApplyLog.getCreateUser());
 | 
	
		
			
				|  |  |                 patientFamilyMember2.setFamilyRelation(familyRelationTrans(patientApplyLog.getFamilyBindRole(),createUser.getSex()));
 | 
	
		
			
				|  |  |                 patientFamilyMember2.setIsAuthorize(isAuthorize);
 | 
	
	
		
			
				|  | @ -407,7 +413,7 @@ public class MyFamilyService {
 | 
	
		
			
				|  |  |                 map2.put("principalNum","");//社保卡号
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             map2.put("mobile",basePatientDO.getMobile());//手机号码
 | 
	
		
			
				|  |  |             if(StringUtils.isEmpty(packageId)){
 | 
	
		
			
				|  |  |             if(!StringUtils.isEmpty(packageId)){
 | 
	
		
			
				|  |  |                 if(packageService.findPatientSignExist(basePatientDO.getId(),packageId)){
 | 
	
		
			
				|  |  |                     map2.put("isPackage",1);
 | 
	
		
			
				|  |  |                 }else{
 | 
	
	
		
			
				|  | @ -567,6 +573,19 @@ public class MyFamilyService {
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 根据身份判断是否未成年
 | 
	
		
			
				|  |  |      * @param idcard
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public Integer nonageByIdcard(String idcard){
 | 
	
		
			
				|  |  |         Integer age = IdCardUtil.getAgeForIdcard(idcard);
 | 
	
		
			
				|  |  |         if(age>18){
 | 
	
		
			
				|  |  |             return 1;
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             return 0;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 家庭关系转换
 |