修改注册接口实现

This commit is contained in:
mengkuiliang 2023-09-28 13:44:54 +08:00
parent 75ef1415ad
commit 60ac53e173

View File

@ -99,11 +99,11 @@ public class ResidentPatientInfoServiceImpl implements IResidentPatientInfoServi
}
/**
* @return java.lang.String
* @Author mengkuiliang
* @Description 获取微信手机号
* @Date 2023-09-26 026 11:42
* @Param [code]
* @return java.lang.String
**/
@Override
public JSONObject getPhone(String code) {
@ -126,7 +126,7 @@ public class ResidentPatientInfoServiceImpl implements IResidentPatientInfoServi
}
//获取手机号 https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/user-info/phone-number/getPhoneNumber.html
String url = "https://api.weixin.qq.com/wxa/business/getuserphonenumber"+ "?access_token=" + accessToken;
String url = "https://api.weixin.qq.com/wxa/business/getuserphonenumber" + "?access_token=" + accessToken;
JSONObject params = new JSONObject();
params.put("code", code);
SslUtils.ignoreSsl();
@ -135,7 +135,7 @@ public class ResidentPatientInfoServiceImpl implements IResidentPatientInfoServi
return null;
}
log.info("获取小程序手机号 : {}", result.toJSONString());
if(result.getInteger("errcode") != 0) {
if (result.getInteger("errcode") != 0) {
return null;
}
return result;
@ -166,38 +166,9 @@ 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<PatientInfo> list = residentPatientInfoMapper.getList(body.getOpenid(), body.getCityCode());
PatientInfo patientInfo = residentPatientInfoMapper.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());
residentPatientInfoMapper.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);
residentPatientInfoMapper.updatePatientInfo(patientInfo);
=======
List<PatientInfo> list = patientInfoMapper.getList(body.getOpenid(), body.getCityCode());
if (ObjectUtils.isNotEmpty(body.getCardNo())) {
PatientInfo patientInfo = patientInfoMapper.isRegisterByCardNo(body.getCardNo());
PatientInfo patientInfo = residentPatientInfoMapper.isRegisterByCardNo(body.getCardNo());
if (patientInfo == null) {
PatientInfo entity = new PatientInfo();
BeanUtils.copyBeanProp(entity, body);
@ -206,7 +177,7 @@ public class ResidentPatientInfoServiceImpl implements IResidentPatientInfoServi
entity.setIsChecked((list == null || list.size() == 0) ? "1" : "0");
entity.setCreateTime(new Date());
entity.setCreateBy(body.getCardNo());
patientInfoMapper.insertPatientInfo(entity);
residentPatientInfoMapper.insertPatientInfo(entity);
} else {
if (!StringUtils.isBlank(patientInfo.getOpenid())) {
throw new ServiceException("该身份证号已被注册");
@ -221,9 +192,8 @@ public class ResidentPatientInfoServiceImpl implements IResidentPatientInfoServi
patientInfo.setUpdateBy(body.getCardNo());
patientInfo.setHeadPictureUrl(body.getHeadPictureUrl());
patientInfo.setDelFlag(0);
patientInfoMapper.updatePatientInfo(patientInfo);
residentPatientInfoMapper.updatePatientInfo(patientInfo);
}
>>>>>>> 34d892aa069ef8de8aee23ae0e5653a942d69476:xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/PatientInfoServiceImpl.java
}
}
@ -312,11 +282,11 @@ public class ResidentPatientInfoServiceImpl implements IResidentPatientInfoServi
}
/**
* @return com.xinelu.familydoctor.applet.pojo.entity.PatientInfo
* @Author mengkuiliang
* @Description 获取注册信息-根据身份证号
* @Date 2023-09-27 027 15:13
* @Param [cardNo]
* @return com.xinelu.familydoctor.applet.pojo.entity.PatientInfo
**/
@Override
public PatientInfo getByCardNo(String cardNo) {