|
@ -259,32 +259,30 @@ public class ContactsService {
|
|
|
}
|
|
|
if (1==operType){//新增联系人
|
|
|
list = sosContactsDao.findByPatientAndDel(patient,1);
|
|
|
Integer seqid=1;
|
|
|
Integer seqid=0;
|
|
|
if (list.size()>=2){
|
|
|
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;
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
else {
|
|
|
if (list.size()>0){
|
|
|
seqid = list.get(0).getPhoneSeqid();
|
|
|
}
|
|
|
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));
|
|
|
if (list.size()>0){
|
|
|
seqid = list.get(0).getPhoneSeqid();
|
|
|
}
|
|
|
PatientSosContactsDO contactsDO = sosContactsDao.findByPatientAndSosPhone(patient,num);
|
|
|
if(null==contactsDO){
|
|
|
contactsDO = new PatientSosContactsDO();
|
|
|
contactsDO.setPhoneSeqid(1==seqid?2:1);
|
|
|
contactsDO.setSuccessFlag(0);
|
|
|
sosContactsDao.save(contactsDO);
|
|
|
}
|
|
|
contactsDO.setDel(1);
|
|
|
contactsDO.setPatient(patient);
|
|
|
contactsDO.setSosName(name);
|
|
|
contactsDO.setSosPhone(num);
|
|
|
contactsDO.setRelation(Integer.parseInt(relation));
|
|
|
contactsDO.setSuccessFlag(0);
|
|
|
sosContactsDao.save(contactsDO);
|
|
|
}
|
|
|
result.put(ResponseContant.resultFlag,ResponseContant.success);
|
|
|
result.put(ResponseContant.resultMsg,"修改成功");
|