|  | @ -261,29 +261,31 @@ public class ContactsService {
 | 
	
		
			
				|  |  |             list = sosContactsDao.findByPatientAndDel(patient,1);
 | 
	
		
			
				|  |  |             Integer seqid=1;
 | 
	
		
			
				|  |  |             if (list.size()>=2){
 | 
	
		
			
				|  |  |                 result.put(ResponseContant.resultFlag,ResponseContant.fail);
 | 
	
		
			
				|  |  |                 result.put(ResponseContant.resultMsg,"该用户紧急联系人已上线");
 | 
	
		
			
				|  |  |                 List<String> sosContacts =list.stream().map(PatientSosContactsDO::getSosPhone).collect(Collectors.toList());
 | 
	
		
			
				|  |  |                 if (!sosContacts.contains(num)){
 | 
	
		
			
				|  |  |                     result.put(ResponseContant.resultFlag,ResponseContant.fail);
 | 
	
		
			
				|  |  |                     result.put(ResponseContant.resultMsg,"该用户紧急联系人已上限");
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 return result;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             else {
 | 
	
		
			
				|  |  |                 if (list.size()>0){
 | 
	
		
			
				|  |  |                     seqid = list.get(0).getPhoneSeqid();
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 PatientSosContactsDO contactsDO = new PatientSosContactsDO();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 list = sosContactsDao.findByPatientAndDel(patient,0);
 | 
	
		
			
				|  |  |                 if (list.size()>0) {
 | 
	
		
			
				|  |  |                     contactsDO =list.get(0);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 else {
 | 
	
		
			
				|  |  |                 PatientSosContactsDO contactsDO = sosContactsDao.findByPatientAndSosPhone(patient,num);
 | 
	
		
			
				|  |  |                 if(null==contactsDO){
 | 
	
		
			
				|  |  |                     contactsDO = new PatientSosContactsDO();
 | 
	
		
			
				|  |  |                     contactsDO.setDel(1);
 | 
	
		
			
				|  |  |                     contactsDO.setPatient(patient);
 | 
	
		
			
				|  |  |                     contactsDO.setSosName(name);
 | 
	
		
			
				|  |  |                     contactsDO.setSosPhone(num);
 | 
	
		
			
				|  |  |                     contactsDO.setRelation(Integer.parseInt(relation));
 | 
	
		
			
				|  |  |                     contactsDO.setPhoneSeqid(1==seqid?2:1);
 | 
	
		
			
				|  |  |                     contactsDO.setSuccessFlag(0);
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     contactsDO.setDel(1);
 | 
	
		
			
				|  |  |                     contactsDO.setSuccessFlag(0);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 contactsDO.setDel(1);
 | 
	
		
			
				|  |  |                 contactsDO.setPatient(patient);
 | 
	
		
			
				|  |  |                 contactsDO.setSosName(name);
 | 
	
		
			
				|  |  |                 contactsDO.setSosPhone(num);
 | 
	
		
			
				|  |  |                 contactsDO.setRelation(Integer.parseInt(relation));
 | 
	
		
			
				|  |  |                 contactsDO.setSuccessFlag(0);
 | 
	
		
			
				|  |  |                 sosContactsDao.save(contactsDO);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 |