注册用户信息添加非空判断防止空指针

This commit is contained in:
赵旭 2023-09-28 10:49:37 +08:00
parent 09430318bd
commit 34d892aa06

View File

@ -18,6 +18,7 @@ import com.xinelu.familydoctor.applet.pojo.body.PatientInfoBody;
import com.xinelu.familydoctor.applet.pojo.entity.PatientInfo;
import com.xinelu.familydoctor.applet.service.IPatientInfoService;
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;
@ -167,7 +168,7 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
public void register(PatientInfoBody body) {
// 获取当前微信绑定的居民
List<PatientInfo> 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();
@ -195,6 +196,7 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
patientInfoMapper.updatePatientInfo(patientInfo);
}
}
}
/**
* @return void