diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentPatientInfoServiceImpl.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentPatientInfoServiceImpl.java index e37fee3..0f6bb47 100644 --- a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentPatientInfoServiceImpl.java +++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentPatientInfoServiceImpl.java @@ -17,6 +17,7 @@ import com.xinelu.familydoctor.applet.pojo.body.PatientInfoBody; import com.xinelu.familydoctor.applet.pojo.entity.PatientInfo; import com.xinelu.familydoctor.applet.service.IResidentPatientInfoService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -165,6 +166,7 @@ public class ResidentPatientInfoServiceImpl implements IResidentPatientInfoServi @Override public void register(PatientInfoBody body) { // 获取当前微信绑定的居民 +<<<<<<< HEAD:xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentPatientInfoServiceImpl.java List list = residentPatientInfoMapper.getList(body.getOpenid(), body.getCityCode()); PatientInfo patientInfo = residentPatientInfoMapper.isRegisterByCardNo(body.getCardNo()); @@ -192,6 +194,36 @@ public class ResidentPatientInfoServiceImpl implements IResidentPatientInfoServi patientInfo.setHeadPictureUrl(body.getHeadPictureUrl()); patientInfo.setDelFlag(0); residentPatientInfoMapper.updatePatientInfo(patientInfo); +======= + List list = patientInfoMapper.getList(body.getOpenid(), body.getCityCode()); + if (ObjectUtils.isNotEmpty(body.getCardNo())) { + PatientInfo patientInfo = patientInfoMapper.isRegisterByCardNo(body.getCardNo()); + if (patientInfo == null) { + PatientInfo entity = new PatientInfo(); + BeanUtils.copyBeanProp(entity, body); + entity.setPatientCode(IdUtils.fastSimpleUUID()); + entity.setBindingTime(new Date()); + entity.setIsChecked((list == null || list.size() == 0) ? "1" : "0"); + entity.setCreateTime(new Date()); + entity.setCreateBy(body.getCardNo()); + patientInfoMapper.insertPatientInfo(entity); + } else { + if (!StringUtils.isBlank(patientInfo.getOpenid())) { + throw new ServiceException("该身份证号已被注册"); + } + patientInfo.setIsChecked((list == null || list.size() == 0) ? "1" : "0"); + patientInfo.setOpenid(body.getOpenid()); + patientInfo.setUnionid(body.getUnionid()); + patientInfo.setPatientName(body.getPatientName()); + patientInfo.setPhone(body.getPhone()); + patientInfo.setAddress(body.getAddress()); + patientInfo.setUpdateTime(new Date()); + patientInfo.setUpdateBy(body.getCardNo()); + patientInfo.setHeadPictureUrl(body.getHeadPictureUrl()); + patientInfo.setDelFlag(0); + patientInfoMapper.updatePatientInfo(patientInfo); + } +>>>>>>> 34d892aa069ef8de8aee23ae0e5653a942d69476:xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/PatientInfoServiceImpl.java } }