Merge remote-tracking branch 'origin/jihan_0920_护理服务、商城、积分兑换、在线问诊功能分支' into jihan_0920_护理服务、商城、积分兑换、在线问诊功能分支
This commit is contained in:
commit
3c39f44dc1
@ -39,5 +39,9 @@
|
|||||||
<groupId>com.xinelu</groupId>
|
<groupId>com.xinelu</groupId>
|
||||||
<artifactId>xinelu-nurse-manage</artifactId>
|
<artifactId>xinelu-nurse-manage</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.xinelu</groupId>
|
||||||
|
<artifactId>xinelu-nurse-applet</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
package com.xinelu.familydoctor.applet.service.impl;
|
package com.xinelu.familydoctor.applet.service.impl;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.xinelu.applet.dto.appletlogin.AppletUserInfoDTO;
|
||||||
import com.xinelu.common.config.AppletChatConfig;
|
import com.xinelu.common.config.AppletChatConfig;
|
||||||
import com.xinelu.common.entity.AppletPhoneVO;
|
import com.xinelu.common.entity.AppletPhoneVO;
|
||||||
import com.xinelu.common.exception.ServiceException;
|
import com.xinelu.common.exception.ServiceException;
|
||||||
@ -18,11 +20,14 @@ import com.xinelu.familydoctor.applet.pojo.body.PatientInfoBody;
|
|||||||
import com.xinelu.familydoctor.applet.pojo.entity.PatientInfo;
|
import com.xinelu.familydoctor.applet.pojo.entity.PatientInfo;
|
||||||
import com.xinelu.familydoctor.applet.service.IResidentPatientInfoService;
|
import com.xinelu.familydoctor.applet.service.IResidentPatientInfoService;
|
||||||
import com.xinelu.familydoctor.applet.utils.AppletAccessTokenUtils;
|
import com.xinelu.familydoctor.applet.utils.AppletAccessTokenUtils;
|
||||||
|
import com.xinelu.manage.domain.receiveAddressInfo.ReceiveAddressInfo;
|
||||||
|
import com.xinelu.manage.mapper.receiveAddressInfo.ReceiveAddressInfoMapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
@ -46,6 +51,9 @@ public class ResidentPatientInfoServiceImpl implements IResidentPatientInfoServi
|
|||||||
private AppletAccessTokenUtils appletAccessTokenUtils;
|
private AppletAccessTokenUtils appletAccessTokenUtils;
|
||||||
@Resource
|
@Resource
|
||||||
private RedisTemplate<String, Object> redisTemplate;
|
private RedisTemplate<String, Object> redisTemplate;
|
||||||
|
@Resource
|
||||||
|
private ReceiveAddressInfoMapper receiveAddressInfoMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return com.xinelu.familydoctor.applet.pojo.entity.PatientInfo
|
* @return com.xinelu.familydoctor.applet.pojo.entity.PatientInfo
|
||||||
* @Author mengkuiliang
|
* @Author mengkuiliang
|
||||||
@ -148,11 +156,13 @@ public class ResidentPatientInfoServiceImpl implements IResidentPatientInfoServi
|
|||||||
* @Param [body]
|
* @Param [body]
|
||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void register(PatientInfoBody body) {
|
public void register(PatientInfoBody body) {
|
||||||
if (ObjectUtils.isNotEmpty(body.getCardNo())) {
|
if (ObjectUtils.isNotEmpty(body.getCardNo())) {
|
||||||
|
PatientInfo patientInfo;
|
||||||
// 修改
|
// 修改
|
||||||
if(!StringUtils.isBlank(body.getPatientCode())) {
|
if(!StringUtils.isBlank(body.getPatientCode())) {
|
||||||
PatientInfo patientInfo = residentPatientInfoMapper.getPatientInfoByPatientCode(body.getPatientCode());
|
patientInfo = residentPatientInfoMapper.getPatientInfoByPatientCode(body.getPatientCode());
|
||||||
if (ObjectUtils.isNotEmpty(patientInfo)) {
|
if (ObjectUtils.isNotEmpty(patientInfo)) {
|
||||||
BeanUtils.copyBeanProp(patientInfo, body);
|
BeanUtils.copyBeanProp(patientInfo, body);
|
||||||
if (body.getDiseaseList() != null) {
|
if (body.getDiseaseList() != null) {
|
||||||
@ -160,12 +170,12 @@ public class ResidentPatientInfoServiceImpl implements IResidentPatientInfoServi
|
|||||||
}
|
}
|
||||||
patientInfo.setLoginFlag(Long.valueOf(1));
|
patientInfo.setLoginFlag(Long.valueOf(1));
|
||||||
updatePatientInfo(patientInfo);
|
updatePatientInfo(patientInfo);
|
||||||
// 注册
|
|
||||||
}
|
}
|
||||||
|
// 注册
|
||||||
} else {
|
} else {
|
||||||
// 获取当前微信绑定的居民
|
// 获取当前微信绑定的居民
|
||||||
List<PatientInfo> list = residentPatientInfoMapper.getList(body.getOpenid(), body.getCityCode());
|
List<PatientInfo> list = residentPatientInfoMapper.getList(body.getOpenid(), body.getCityCode());
|
||||||
PatientInfo patientInfo = residentPatientInfoMapper.isRegisterByCardNo(body.getCardNo());
|
patientInfo = residentPatientInfoMapper.isRegisterByCardNo(body.getCardNo());
|
||||||
if (patientInfo == null) {
|
if (patientInfo == null) {
|
||||||
PatientInfo entity = new PatientInfo();
|
PatientInfo entity = new PatientInfo();
|
||||||
BeanUtils.copyBeanProp(entity, body);
|
BeanUtils.copyBeanProp(entity, body);
|
||||||
@ -179,6 +189,10 @@ public class ResidentPatientInfoServiceImpl implements IResidentPatientInfoServi
|
|||||||
entity.setCreateBy(body.getCardNo());
|
entity.setCreateBy(body.getCardNo());
|
||||||
entity.setLoginFlag(Long.valueOf(1));
|
entity.setLoginFlag(Long.valueOf(1));
|
||||||
residentPatientInfoMapper.insertPatientInfo(entity);
|
residentPatientInfoMapper.insertPatientInfo(entity);
|
||||||
|
|
||||||
|
// 新增的话重新查询居民信息获取patientId
|
||||||
|
patientInfo = residentPatientInfoMapper.getPatientInfoByPatientCode(entity.getPatientCode());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (!StringUtils.isBlank(patientInfo.getOpenid())) {
|
if (!StringUtils.isBlank(patientInfo.getOpenid())) {
|
||||||
throw new ServiceException("该身份证号已被注册");
|
throw new ServiceException("该身份证号已被注册");
|
||||||
@ -200,6 +214,34 @@ public class ResidentPatientInfoServiceImpl implements IResidentPatientInfoServi
|
|||||||
residentPatientInfoMapper.updatePatientInfo(patientInfo);
|
residentPatientInfoMapper.updatePatientInfo(patientInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(patientInfo != null) {
|
||||||
|
// 记录收货地址信息
|
||||||
|
this.insertReceiveAddress(patientInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 新增收货人地址信息 */
|
||||||
|
private void insertReceiveAddress(PatientInfo patientInfo) {
|
||||||
|
//判断当前收货地址信息是否存在
|
||||||
|
int receiveCount = receiveAddressInfoMapper.getReceiveAddressInfo(patientInfo.getId(), patientInfo.getPatientName(), patientInfo.getPhone(), patientInfo.getAddress());
|
||||||
|
if (receiveCount > 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//添加收货人地址信息
|
||||||
|
ReceiveAddressInfo receiveAddressInfo = new ReceiveAddressInfo();
|
||||||
|
receiveAddressInfo.setReceiveAddress(patientInfo.getAddress());
|
||||||
|
receiveAddressInfo.setReceivePhone(patientInfo.getPhone());
|
||||||
|
receiveAddressInfo.setAreaCode(patientInfo.getAreaCode());
|
||||||
|
receiveAddressInfo.setPatientId(patientInfo.getId());
|
||||||
|
receiveAddressInfo.setReceiveName(patientInfo.getPatientName());
|
||||||
|
receiveAddressInfo.setOpenid(patientInfo.getOpenid());
|
||||||
|
receiveAddressInfo.setUnionid(patientInfo.getUnionid());
|
||||||
|
receiveAddressInfo.setCreateTime(LocalDateTime.now());
|
||||||
|
receiveAddressInfo.setCreateBy(patientInfo.getCardNo());
|
||||||
|
int insertReceiveAddressInfo = receiveAddressInfoMapper.insertReceiveAddressInfo(receiveAddressInfo);
|
||||||
|
if (insertReceiveAddressInfo <= 0) {
|
||||||
|
throw new ServiceException("修改收货人地址信息失败,请联系管理员!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user