Commit 0c1c5938 authored by 向怀芳's avatar 向怀芳 🎱

1. 患者就诊卡处理

parent 4a9a15b9
......@@ -38,6 +38,7 @@ public class AppointmentController {
private HphyPatientBaseService hphyPatientBaseService;
private HpHosInfoService hosInfoService;
private HpDeptInfoService hpDeptInfoService;
private HpPatientCardService hpPatientCardService;
@ApiOperation("预约须知")
@GetMapping("/app/rule")
......@@ -146,6 +147,7 @@ public class AppointmentController {
app.setStatus(Constant.STRING_NO);
app.setEvaStatus(Constant.BYTE_NO);
hpAppointmentService.save(app);
hpPatientCardService.updateByApp(patient, order);
return new R().success(result);
}
return new R().error("预约失败!");
......
......@@ -10,12 +10,12 @@ import cn.sh.stc.sict.cloud.common.core.dto.WDUserInfo;
import cn.sh.stc.sict.cloud.common.core.util.NumberUtil;
import cn.sh.stc.sict.cloud.common.core.util.R;
import cn.sh.stc.sict.cloud.common.core.util.SsbUtil;
import cn.sh.stc.sict.cloud.common.core.util.ValidateCodeUtil;
import cn.sh.stc.sict.cloud.common.security.util.SecurityUtils;
import cn.sh.stc.sict.cloud.upms.dto.CurrentUser;
import cn.sh.stc.sict.cloud.upms.model.SysUserBase;
import cn.sh.stc.sict.theme.hphy.constant.PatientConstant;
import cn.sh.stc.sict.theme.hphy.model.HpPatientCard;
import cn.sh.stc.sict.theme.hphy.model.HphyPatientBase;
import cn.sh.stc.sict.theme.hphy.service.HpPatientCardService;
import cn.sh.stc.sict.theme.hphy.service.HphyPatientBaseService;
import cn.sh.stc.sict.theme.hphy.wd.WanDaHttpUtil;
import io.swagger.annotations.Api;
......@@ -43,6 +43,7 @@ public class HphyPatientBaseController {
private HphyPatientBaseService hphyPatientBaseService;
private StringRedisTemplate redisTemplate;
private HpPatientCardService hpPatientCardService;
/**
* 注册并关联登录信息
......@@ -129,15 +130,16 @@ public class HphyPatientBaseController {
}
// 获取患者信息
HphyPatientBase base = hphyPatientBaseService.getByOpenId(current.getOpenId());
if( ObjectUtil.isNull(base) || NumberUtil.isNullOrZero(base.getId())){
if(LoginTypeEnum.SSB.getType().equals(source)){
if (ObjectUtil.isNull(base) || NumberUtil.isNullOrZero(base.getId())) {
if (LoginTypeEnum.SSB.getType().equals(source)) {
WDUserInfo userInfo = SsbUtil.getUserInfo(token);
List<WDUserCardInfo> cardList = SsbUtil.getUserCardInfoList(token);
base = hphyPatientBaseService.saveSSbInfo(current, userInfo, cardList);
hpPatientCardService.save(base, cardList);
}
}
if( ObjectUtil.isNull(base) || NumberUtil.isNullOrZero(base.getId())){
if (ObjectUtil.isNull(base) || NumberUtil.isNullOrZero(base.getId())) {
return new R().error("患者未实名!");
}
if (StrUtil.isNotBlank(base.getGender())) {
......@@ -147,4 +149,12 @@ public class HphyPatientBaseController {
return new R(base);
}
@ApiOperation("获取患者就诊卡list")
@GetMapping("/card/list")
public R listPatientCard() {
CurrentUser current = SecurityUtils.getCurrentUser();
List<HpPatientCard> cardList = hpPatientCardService.listByUserId(current.getId());
return new R(cardList);
}
}
package cn.sh.stc.sict.theme.hphy.dao;
import cn.sh.stc.sict.theme.hphy.model.HpPatientCard;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 黄浦-患者-卡号(HpPatientCard)表数据库访问层
*
* @author F_xh
* @since 2022-07-14 11:00:02
*/
public interface HpPatientCardMapper extends BaseMapper<HpPatientCard> {
}
\ No newline at end of file
package cn.sh.stc.sict.theme.hphy.model;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* 黄浦-患者-卡号(HpPatientCard)表实体类
*
* @author F_xh
* @since 2022-07-14 11:00:02
*/
@Data
@SuppressWarnings("serial")
@EqualsAndHashCode(callSuper = true)
public class HpPatientCard extends Model<HpPatientCard> {
private String id;
private Long patientId;
private Long userId;
private String cardNo;
private String cardType;
private String hospitalId;
/**
* 获取主键值
*
* @return 主键值
*/
@Override
protected Serializable pkVal() {
return this.id;
}
}
\ No newline at end of file
package cn.sh.stc.sict.theme.hphy.service;
import cn.sh.stc.sict.cloud.common.core.dto.WDUserCardInfo;
import cn.sh.stc.sict.theme.hphy.model.HpPatientCard;
import cn.sh.stc.sict.theme.hphy.model.HphyPatientBase;
import cn.sh.stc.sict.theme.hphy.wd.OrderInfo;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* 黄浦-患者-卡号(HpPatientCard)表服务接口
*
* @author F_xh
* @since 2022-07-14 11:00:02
*/
public interface HpPatientCardService extends IService<HpPatientCard> {
void save(HphyPatientBase base, List<WDUserCardInfo> cardList);
List<HpPatientCard> listByUserId(Long userId);
void updateByApp(HphyPatientBase patient, OrderInfo order);
}
\ No newline at end of file
package cn.sh.stc.sict.theme.hphy.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import cn.sh.stc.sict.cloud.common.core.dto.WDUserCardInfo;
import cn.sh.stc.sict.theme.hphy.dao.HpPatientCardMapper;
import cn.sh.stc.sict.theme.hphy.model.HpPatientCard;
import cn.sh.stc.sict.theme.hphy.model.HphyPatientBase;
import cn.sh.stc.sict.theme.hphy.service.HpPatientCardService;
import cn.sh.stc.sict.theme.hphy.wd.OrderInfo;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 黄浦-患者-卡号(HpPatientCard)表服务实现类
*
* @author F_xh
* @since 2022-07-14 11:00:02
*/
@Service("hpPatientCardService")
public class HpPatientCardServiceImpl extends ServiceImpl<HpPatientCardMapper, HpPatientCard> implements HpPatientCardService {
@Override
public void save(HphyPatientBase base, List<WDUserCardInfo> cardList) {
if (CollUtil.isNotEmpty(cardList)) {
cardList.forEach(wdCard -> {
HpPatientCard card = BeanUtil.toBean(wdCard, HpPatientCard.class);
card.setUserId(base.getUserId());
card.setPatientId(base.getId());
this.save(card);
});
}
}
@Override
public List<HpPatientCard> listByUserId(Long userId) {
LambdaQueryWrapper<HpPatientCard> wrapper = Wrappers.lambdaQuery();
wrapper.eq(HpPatientCard::getUserId, userId);
return this.list(wrapper);
}
@Override
public void updateByApp(HphyPatientBase patient, OrderInfo order) {
if (StrUtil.isNotBlank(order.getMediCardId()) && StrUtil.isNotBlank(order.getMediCardType())) {
HpPatientCard card = new HpPatientCard();
card.setCardNo(order.getMediCardId());
card.setCardType(order.getMediCardType());
card.setUserId(patient.getUserId());
card.setPatientId(patient.getId());
LambdaQueryWrapper<HpPatientCard> wrapper = Wrappers.lambdaQuery();
wrapper.eq(HpPatientCard::getUserId, patient.getUserId())
.eq(HpPatientCard::getPatientId, patient.getId())
.eq(HpPatientCard::getCardType, order.getMediCardType());
this.saveOrUpdate(card, wrapper);
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.sh.stc.sict.theme.dao.HpPatientCardMapper">
<resultMap type="cn.sh.stc.sict.theme.model.HpPatientCard" id="HpPatientCardMap">
<result property="id" column="id"/>
<result property="patientId" column="patient_id"/>
<result property="userId" column="user_id"/>
<result property="cardNo" column="card_no"/>
<result property="cardType" column="card_type"/>
<result property="hospitalId" column="hospital_id"/>
</resultMap>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment