|
|
@ -2,7 +2,9 @@ package com.ccsens.wisdomcar.service; |
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
import cn.hutool.core.lang.Snowflake; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import com.ccsens.cloudutil.bean.tall.dto.MemberRoleDto; |
|
|
|
import com.ccsens.cloudutil.feign.TallFeignClient; |
|
|
|
import com.ccsens.util.JsonResponse; |
|
|
@ -45,6 +47,8 @@ public class PatientAndFamilyService implements IPatientAndFamilyService{ |
|
|
|
private HospitalMemberDao hospitalMemberDao; |
|
|
|
@Resource |
|
|
|
private PatientDoctorDao patientDoctorDao; |
|
|
|
@Resource |
|
|
|
private Snowflake snowflake; |
|
|
|
|
|
|
|
@Override |
|
|
|
public void updatePatientInfo(PatientAndFamilyDto.PatientInfo param) { |
|
|
@ -71,13 +75,28 @@ public class PatientAndFamilyService implements IPatientAndFamilyService{ |
|
|
|
patientFamilyExample.createCriteria().andPatientIdEqualTo(param.getId()); |
|
|
|
List<PatientFamily> patientFamilies = patientFamilyDao.selectByExample(patientFamilyExample); |
|
|
|
if (CollectionUtil.isNotEmpty(patientFamilies)){ |
|
|
|
if (ObjectUtil.isNotNull(param.getFamilyName())){ |
|
|
|
if (StrUtil.isNotBlank(param.getFamilyName())){ |
|
|
|
patientFamilies.get(0).setName(param.getFamilyName()); |
|
|
|
} |
|
|
|
if (ObjectUtil.isNotNull(param.getFamilyPhone())){ |
|
|
|
patientFamilies.get(0).setPhone(param.getFamilyPhone()); |
|
|
|
} |
|
|
|
patientFamilyDao.updateByPrimaryKeySelective(patientFamilies.get(0)); |
|
|
|
}else{ |
|
|
|
//没有查到患者信息并且传入家属信息则新建一条
|
|
|
|
if (StrUtil.isNotBlank(param.getFamilyName()) || ObjectUtil.isNotNull(param.getFamilyPhone())){ |
|
|
|
PatientFamily patientFamily = new PatientFamily(); |
|
|
|
patientFamily.setId(snowflake.nextId()); |
|
|
|
if (StrUtil.isNotBlank(param.getFamilyName())){ |
|
|
|
patientFamily.setName(param.getFamilyName()); |
|
|
|
} |
|
|
|
if (ObjectUtil.isNotNull(param.getFamilyPhone())){ |
|
|
|
patientFamily.setPhone(param.getFamilyPhone()); |
|
|
|
} |
|
|
|
patientFamily.setPatientId(param.getId()); |
|
|
|
patientFamilyDao.insertSelective(patientFamily); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}else{ |
|
|
|
throw new BaseException(Constant.PATIENT_NOT_FOUND); |
|
|
|