diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/mp/AppointmentController.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/mp/AppointmentController.java index 81157a9bb98cd7b129bec40098e2470465823740..315be9d13e6953f9d40de2ad4255a7f1a4d9656e 100644 --- a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/mp/AppointmentController.java +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/mp/AppointmentController.java @@ -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("预约失败!"); diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/mp/HphyPatientBaseController.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/mp/HphyPatientBaseController.java index ea5bc4e506a29470f9ae71e631c9c9fec085fd1f..20f186cddbade1e78748f85fd2374e7f29dd7f84 100644 --- a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/mp/HphyPatientBaseController.java +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/mp/HphyPatientBaseController.java @@ -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 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 cardList = hpPatientCardService.listByUserId(current.getId()); + return new R(cardList); + } } diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/dao/HpPatientCardMapper.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/dao/HpPatientCardMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..43fb43857a3fbe92e7e414796214b304fb63c1f6 --- /dev/null +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/dao/HpPatientCardMapper.java @@ -0,0 +1,14 @@ +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 { + +} \ No newline at end of file diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/model/HpPatientCard.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/model/HpPatientCard.java new file mode 100644 index 0000000000000000000000000000000000000000..156b21174c6d3261db077eef14e3370297670cca --- /dev/null +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/model/HpPatientCard.java @@ -0,0 +1,35 @@ +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 { + 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 diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/HpPatientCardService.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/HpPatientCardService.java new file mode 100644 index 0000000000000000000000000000000000000000..d0a250d8a7add4125344c503e06f82a9f418d8e6 --- /dev/null +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/HpPatientCardService.java @@ -0,0 +1,24 @@ +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 { + + void save(HphyPatientBase base, List cardList); + + List listByUserId(Long userId); + + void updateByApp(HphyPatientBase patient, OrderInfo order); +} \ No newline at end of file diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/impl/HpPatientCardServiceImpl.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/impl/HpPatientCardServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..6da3e275e194dc3321ac43caaf9f0b25532d711e --- /dev/null +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/impl/HpPatientCardServiceImpl.java @@ -0,0 +1,63 @@ +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 implements HpPatientCardService { + + @Override + public void save(HphyPatientBase base, List 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 listByUserId(Long userId) { + LambdaQueryWrapper 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 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 diff --git a/smart-health-modules/theme-schema/src/main/resources/mapper/HpPatientCardMapper.xml b/smart-health-modules/theme-schema/src/main/resources/mapper/HpPatientCardMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..8b6297085a3dd3485abd99c44980d08137134a05 --- /dev/null +++ b/smart-health-modules/theme-schema/src/main/resources/mapper/HpPatientCardMapper.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file