From 4e9a8dfb75a7fa4690f9c4fb3a5f9834d45fdea4 Mon Sep 17 00:00:00 2001 From: fshenye <512914587@qq.com> Date: Mon, 10 Oct 2022 17:11:23 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E8=A7=A3=E5=86=B3CORS=E8=B7=A8=E5=9F=9F?= =?UTF-8?q?=E9=97=AE=E9=A2=98=202.=20=E5=AF=BC=E5=8C=BB=E6=8E=A8=E8=8D=90?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9F=A5=E8=AF=A2=E6=9D=A1=E4=BB=B6=203.=20?= =?UTF-8?q?=E9=A2=84=E7=BA=A6=E8=AE=B0=E5=BD=95=E6=B7=BB=E5=8A=A0=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=9D=A1=E4=BB=B6=EF=BC=8C=E5=88=97=E8=A1=A8=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=AD=97=E6=AE=B5=204.=20=E6=96=B0=E5=A2=9E=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E4=B8=AA=E4=BA=BA=E5=8E=86=E5=8F=B2=E5=8C=BB=E7=94=9F?= =?UTF-8?q?list=205.=20=E6=96=B0=E5=A2=9E=E5=AE=B6=E5=BA=AD=E6=88=90?= =?UTF-8?q?=E5=91=98=E7=AE=A1=E7=90=86=E6=8E=A5=E5=8F=A3=EF=BC=9A=E5=88=97?= =?UTF-8?q?=E8=A1=A8=EF=BC=8C=E6=96=B0=E5=A2=9E=EF=BC=8C=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gateway/config/GlobalCorsConfig.java | 18 ++- .../mobile/HpAppointmentEvaController.java | 1 + .../controller/mobile/HpHzjlController.java | 31 +++++- .../theme/hpgp/model/HpAppointmentEva.java | 1 + .../theme/hpgp/service/HpHzjlService.java | 3 + .../hpgp/service/impl/HpHzjlServiceImpl.java | 27 +++++ .../mp/HphyPatientBaseController.java | 18 ++- .../mp/HphyPatientRelationController.java | 104 ++++++++++++++++++ .../hphy/controller/web/AppEvaController.java | 39 +++++++ .../controller/web/GuideRecordController.java | 8 +- .../web/HpAppointmentController.java | 16 ++- .../web/HphyGuideMatchController.java | 14 ++- .../hphy/dao/HphyPatientRelationMapper.java | 19 ++++ .../sict/theme/hphy/model/HphyGuideMatch.java | 22 ++-- .../theme/hphy/model/HphyPatientRelation.java | 45 ++++++++ .../hphy/service/HphyPatientBaseService.java | 6 + .../service/HphyPatientRelationService.java | 18 +++ .../impl/HphyPatientBaseServiceImpl.java | 44 +++++++- .../impl/HphyPatientRelationServiceImpl.java | 28 +++++ .../theme/hphy/vo/PatientRelationDTO.java | 11 ++ .../sict/theme/hphy/vo/PatientRelationVO.java | 11 ++ .../src/main/resources/bootstrap-dev.yml | 1 + .../mapper/hphy/HphyPatientRelationMapper.xml | 53 +++++++++ 23 files changed, 509 insertions(+), 29 deletions(-) create mode 100644 smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/mp/HphyPatientRelationController.java create mode 100644 smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/web/AppEvaController.java create mode 100644 smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/dao/HphyPatientRelationMapper.java create mode 100644 smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/model/HphyPatientRelation.java create mode 100644 smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/HphyPatientRelationService.java create mode 100644 smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/impl/HphyPatientRelationServiceImpl.java create mode 100644 smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/vo/PatientRelationDTO.java create mode 100644 smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/vo/PatientRelationVO.java create mode 100644 smart-health-modules/theme-schema/src/main/resources/mapper/hphy/HphyPatientRelationMapper.xml diff --git a/cloud-common/cloud-common-gateway/src/main/java/cn/sh/stc/sict/cloud/common/gateway/config/GlobalCorsConfig.java b/cloud-common/cloud-common-gateway/src/main/java/cn/sh/stc/sict/cloud/common/gateway/config/GlobalCorsConfig.java index cf10b79..b8b14a6 100644 --- a/cloud-common/cloud-common-gateway/src/main/java/cn/sh/stc/sict/cloud/common/gateway/config/GlobalCorsConfig.java +++ b/cloud-common/cloud-common-gateway/src/main/java/cn/sh/stc/sict/cloud/common/gateway/config/GlobalCorsConfig.java @@ -13,6 +13,9 @@ import org.springframework.web.server.WebFilter; import org.springframework.web.server.WebFilterChain; import reactor.core.publisher.Mono; +import java.util.HashSet; +import java.util.Set; + /** * @Description * @Author @@ -26,7 +29,14 @@ public class GlobalCorsConfig { */ private static final String ALLOWED_HEADERS = "x-requested-with, authorization, Content-Type, Authorization, credential, X-XSRF-TOKEN,token,username,client,access-token"; private static final String ALLOWED_METHODS = "*"; - private static final String ALLOWED_ORIGIN = "https://inno.sh-sict.com/, https://hy.hpwjsns.org.cn/"; + private static final Set ALLOWED_ORIGINS = new HashSet(){{ + add("https://inno.sh-sict.com"); + add("https://hy.hpwjsns.org.cn"); + add("http://localhost:12998"); + add("http://127.0.0.1:12998"); + add("http://sict-gateway:12998"); + add("http://192.168.31.140:12998"); + }}; private static final String ALLOWED_Expose = "*"; private static final String MAX_AGE = "18000L"; @@ -37,7 +47,11 @@ public class GlobalCorsConfig { if (CorsUtils.isCorsRequest(request)) { ServerHttpResponse response = ctx.getResponse(); HttpHeaders headers = response.getHeaders(); - headers.add("Access-Control-Allow-Origin", ALLOWED_ORIGIN); + if(ALLOWED_ORIGINS.contains(request.getHeaders().getOrigin())){ + headers.add("Access-Control-Allow-Origin", request.getHeaders().getOrigin()); + }else{ + headers.add("Access-Control-Allow-Origin", "https://hy.hpwjsns.org.cn"); + } headers.add("Access-Control-Allow-Methods", ALLOWED_METHODS); headers.add("Access-Control-Max-Age", MAX_AGE); headers.add("Access-Control-Allow-Headers", ALLOWED_HEADERS); diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hpgp/controller/mobile/HpAppointmentEvaController.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hpgp/controller/mobile/HpAppointmentEvaController.java index 8009cba..a0a1879 100644 --- a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hpgp/controller/mobile/HpAppointmentEvaController.java +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hpgp/controller/mobile/HpAppointmentEvaController.java @@ -74,6 +74,7 @@ public class HpAppointmentEvaController { } CurrentUser current = SecurityUtils.getCurrentUser(); eva.setUserId(current.getId()); + eva.setPatientName(app.getPatientName()); eva.setHospCode(app.getHosOrgCode()); eva.setHospName(app.getHosOrgName()); eva.setDeptCode(app.getDeptCode()); diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hpgp/controller/mobile/HpHzjlController.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hpgp/controller/mobile/HpHzjlController.java index 61a6ed0..a581f81 100644 --- a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hpgp/controller/mobile/HpHzjlController.java +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hpgp/controller/mobile/HpHzjlController.java @@ -1,13 +1,13 @@ package cn.sh.stc.sict.theme.hpgp.controller.mobile; - import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONUtil; import cn.sh.stc.sict.cloud.common.security.util.SecurityUtils; import cn.sh.stc.sict.cloud.upms.dto.CurrentUser; import cn.sh.stc.sict.theme.hpgp.model.HpgpBusyIdlePrediction; +import cn.sh.stc.sict.theme.hphy.model.HpDocInfo; import cn.sh.stc.sict.theme.hphy.model.HphyPatientBase; import cn.sh.stc.sict.theme.hphy.service.HphyPatientBaseService; import lombok.AllArgsConstructor; @@ -34,7 +34,7 @@ import java.util.List; @Slf4j @RestController @AllArgsConstructor -@Api(tags = "患者就诊记录") +@Api(tags = "[C]患者就诊记录") @RequestMapping("/hpHzjl") public class HpHzjlController { /** @@ -43,20 +43,39 @@ public class HpHzjlController { private final HpHzjlService hpHzjlService; private final HphyPatientBaseService hphyPatientBaseService; + @ApiOperation("历史科室 list") @GetMapping("/history/dept/list") - public R historyDeptList(){ + public R historyDeptList() { + CurrentUser current = SecurityUtils.getCurrentUser(); + if (ObjectUtil.isEmpty(current) || StrUtil.isBlank(current.getOpenId())) { + log.error("current = {}", JSONUtil.toJsonStr(current)); + return new R().error("当前的登录人信息异常"); + } + HphyPatientBase patient = hphyPatientBaseService.getByOpenId(current.getOpenId()); + if (ObjectUtil.isEmpty(patient) || StrUtil.isBlank(patient.getCertId())) { + log.error("patient = {}", JSONUtil.toJsonStr(patient)); + return new R().error("患者信息异常!"); + } + List result = hpHzjlService.listByCertId(patient.getCertId()); + + return new R(result); + } + + @ApiOperation("历史医生 list") + @GetMapping("/history/doctor/list") + public R historyDoctorList() { CurrentUser current = SecurityUtils.getCurrentUser(); - if(ObjectUtil.isEmpty(current)|| StrUtil.isBlank(current.getOpenId())){ + if (ObjectUtil.isEmpty(current) || StrUtil.isBlank(current.getOpenId())) { log.error("current = {}", JSONUtil.toJsonStr(current)); return new R().error("当前的登录人信息异常"); } HphyPatientBase patient = hphyPatientBaseService.getByOpenId(current.getOpenId()); - if(ObjectUtil.isEmpty(patient)||StrUtil.isBlank(patient.getCertId())){ + if (ObjectUtil.isEmpty(patient) || StrUtil.isBlank(patient.getCertId())) { log.error("patient = {}", JSONUtil.toJsonStr(patient)); return new R().error("患者信息异常!"); } - List result = hpHzjlService.listByCertId(patient.getCertId()); + List result = hpHzjlService.listDoctorByCertId(patient.getCertId()); return new R(result); } } diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hpgp/model/HpAppointmentEva.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hpgp/model/HpAppointmentEva.java index cf85266..581b956 100644 --- a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hpgp/model/HpAppointmentEva.java +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hpgp/model/HpAppointmentEva.java @@ -23,6 +23,7 @@ public class HpAppointmentEva extends Model { private Long id; private Long userId; private Long patientId; + private String patientName; private Long appId; private String hospCode; private String hospName; diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hpgp/service/HpHzjlService.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hpgp/service/HpHzjlService.java index 66faeec..2f256bc 100644 --- a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hpgp/service/HpHzjlService.java +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hpgp/service/HpHzjlService.java @@ -1,6 +1,7 @@ package cn.sh.stc.sict.theme.hpgp.service; import cn.sh.stc.sict.theme.hpgp.model.HpgpBusyIdlePrediction; +import cn.sh.stc.sict.theme.hphy.model.HpDocInfo; import com.baomidou.mybatisplus.extension.service.IService; import cn.sh.stc.sict.theme.hpgp.model.HpHzjl; @@ -15,4 +16,6 @@ import java.util.List; public interface HpHzjlService extends IService { List listByCertId(String certId); + + List listDoctorByCertId(String certId); } diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hpgp/service/impl/HpHzjlServiceImpl.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hpgp/service/impl/HpHzjlServiceImpl.java index db0da6c..66a59bb 100644 --- a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hpgp/service/impl/HpHzjlServiceImpl.java +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hpgp/service/impl/HpHzjlServiceImpl.java @@ -8,6 +8,9 @@ import cn.sh.stc.sict.theme.hpgp.model.HpgpBusyIdlePrediction; import cn.sh.stc.sict.theme.hpgp.model.HpgpDepartmentRank; import cn.sh.stc.sict.theme.hpgp.service.HpgpBusyIdlePredictionService; import cn.sh.stc.sict.theme.hpgp.service.HpgpDepartmentRankService; +import cn.sh.stc.sict.theme.hphy.model.HpDocInfo; +import cn.sh.stc.sict.theme.hphy.model.HphyDoctor; +import cn.sh.stc.sict.theme.hphy.service.HpDocInfoService; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -32,6 +35,7 @@ public class HpHzjlServiceImpl extends ServiceImpl impleme private final HpgpDepartmentRankService hpgpDepartmentRankService; private final HpgpBusyIdlePredictionService hpgpBusyIdlePredictionService; + private final HpDocInfoService hpDocInfoService; /** * 根据身份证号查找最后三次不同科室就诊记录,并计算忙闲 @@ -75,4 +79,27 @@ public class HpHzjlServiceImpl extends ServiceImpl impleme return result; } + + @Override + public List listDoctorByCertId(String certId) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); + wrapper.eq(HpHzjl::getZjhm, certId) + .groupBy(HpHzjl::getYljgdm, HpHzjl::getJzksbm, HpHzjl::getZzysgh) + .orderByDesc(HpHzjl::getJzksrq) + .last("limit 10"); + List recordList = this.list(wrapper); + List doctorList = new ArrayList<>(); + if (CollUtil.isNotEmpty(recordList)) { + recordList.forEach(r -> { + LambdaQueryWrapper dw = Wrappers.lambdaQuery(); + dw.eq(HpDocInfo::getHosOrgCode, r.getYljgdm()) + .eq(HpDocInfo::getResourceCode, r.getZzysgh()) + .eq(HpDocInfo::getResourceName, r.getZzysxm()) + .last("limit 1"); + HpDocInfo one = hpDocInfoService.getOne(dw); + doctorList.add(one); + }); + } + return doctorList; + } } 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 bc603b8..200fd21 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 @@ -58,8 +58,12 @@ public class HphyPatientBaseController { @PostMapping("/register") public R register(@RequestBody HphyPatientBase patient) { CurrentUser current = SecurityUtils.getCurrentUser(); - HphyPatientBase base = hphyPatientBaseService.getByOpenId(current.getOpenId()); + HphyPatientBase base = hphyPatientBaseService.getCurrentBase(); patient.setOpenId(current.getOpenId()); + // 根据手机号去重 + if (base == null || NumberUtil.isNullOrZero(base.getId())) { + base = hphyPatientBaseService.getByPhone(current.getPhone(), true); + } if (base != null && NumberUtil.isNotNullOrZero(base.getId())) { patient.setId(base.getId()); @@ -78,7 +82,6 @@ public class HphyPatientBaseController { patient.setAge(String.valueOf(IdcardUtil.getAgeByIdCard(patient.getCertId()))); patient.setGender(IdcardUtil.getGenderByIdCard(patient.getCertId()) == 1 ? "男" : "女"); // 手机号redis验证 - // 根据手机号去重 // 获取家庭医生签约信息 try { String familyDocHos = WanDaHttpUtil.getContractInfo(patient.getCertId()); @@ -137,7 +140,16 @@ public class HphyPatientBaseController { } // 获取患者信息 HphyPatientBase base = hphyPatientBaseService.getByOpenId(current.getOpenId()); - log.error("third-party.base1 = {}", JSONUtil.toJsonStr(base)); + // 根据手机号去重 + if (ObjectUtil.isNull(base) || NumberUtil.isNullOrZero(base.getId())) { + base = hphyPatientBaseService.getByPhone(current.getPhone(), true); + if(NumberUtil.isNotNullOrZero(base.getId())){ + HphyPatientBase update = new HphyPatientBase(); + update.setOpenId(current.getOpenId()); + update.setId(base.getId()); + hphyPatientBaseService.updateById(update); + } + } if (ObjectUtil.isNull(base) || NumberUtil.isNullOrZero(base.getId())) { if (LoginTypeEnum.SSB.getType().equals(source)) { WDUserInfo userInfo = SsbUtil.getUserInfo(token); diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/mp/HphyPatientRelationController.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/mp/HphyPatientRelationController.java new file mode 100644 index 0000000..93f2f1f --- /dev/null +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/mp/HphyPatientRelationController.java @@ -0,0 +1,104 @@ +package cn.sh.stc.sict.theme.hphy.controller.mp; + + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +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.security.util.SecurityUtils; +import cn.sh.stc.sict.cloud.upms.dto.CurrentUser; +import cn.sh.stc.sict.theme.hphy.model.HphyPatientBase; +import cn.sh.stc.sict.theme.hphy.model.HphyPatientRelation; +import cn.sh.stc.sict.theme.hphy.service.HphyPatientBaseService; +import cn.sh.stc.sict.theme.hphy.service.HphyPatientRelationService; +import cn.sh.stc.sict.theme.hphy.vo.PatientRelationDTO; +import cn.sh.stc.sict.theme.hphy.vo.PatientRelationVO; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +import java.io.Serializable; +import java.util.List; + +/** + * 患者-家庭成员关系表(HphyPatientRelation)表控制层 + * + * @author F_xh + * @since 2022-10-10 14:41:04 + */ +@Slf4j +@RestController +@AllArgsConstructor +@Api(tags = "[C]患者-家庭成员关系表") +@RequestMapping("/hphyPatientRelation") +public class HphyPatientRelationController { + /** + * 服务对象 + */ + private final HphyPatientRelationService hphyPatientRelationService; + private final HphyPatientBaseService hphyPatientBaseService; + + + @ApiOperation("获取自己的家庭成员") + @GetMapping("/list") + public R list() { + CurrentUser current = SecurityUtils.getCurrentUser(); + HphyPatientBase base = hphyPatientBaseService.getByOpenId(current.getOpenId()); + if (ObjectUtil.isNull(base) || NumberUtil.isNullOrZero(base.getId())) { + return new R(); + } + List result = hphyPatientRelationService.listPatientRelation(base.getId()); + + return new R(result); + } + + @ApiOperation("新增家庭成员") + @PostMapping + @Transactional(rollbackFor = Exception.class) + public R insert(@RequestBody PatientRelationDTO dto) { + HphyPatientBase base = hphyPatientBaseService.getCurrentBase(); + if (ObjectUtil.isNull(base) || NumberUtil.isNullOrZero(base.getId())) { + return new R().error("当前登陆人信息异常"); + } + if (StrUtil.isBlank(dto.getPatient().getName())) { + return new R().error("姓名不可为空!"); + } + if (StrUtil.isBlank(dto.getPatient().getCertId())) { + return new R().error("身份证号不可为空!"); + } + if (StrUtil.isBlank(dto.getRelation().getRelationName())) { + return new R().error("关系不可为空!"); + } + if (StrUtil.isBlank(dto.getPatient().getPhone())) { + return new R().error("手机号不可为空!"); + } + hphyPatientBaseService.savePatient(dto.getPatient()); + dto.getRelation().setSourcePatientId(base.getId()); + dto.getRelation().setTargetPatientId(dto.getPatient().getId()); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); + wrapper.and(i -> i.eq(HphyPatientRelation::getSourcePatientId, base.getId()).eq(HphyPatientRelation::getTargetPatientId, dto.getPatient().getId())) + .or().and(i -> i.eq(HphyPatientRelation::getSourcePatientId, dto.getPatient().getId()).eq(HphyPatientRelation::getTargetPatientId, base.getId())); + + hphyPatientRelationService.saveOrUpdate(dto.getRelation(), wrapper); + return new R(); + } + + @ApiOperation("删除关系") + @DeleteMapping("/{relationId}") + public R delete(@PathVariable Long relationId) { + HphyPatientRelation relation = hphyPatientRelationService.getById(relationId); + if (ObjectUtil.isNull(relation) || NumberUtil.isNullOrZero(relation.getId())) { + return new R().error("未找到待删除项!"); + } + hphyPatientRelationService.removeById(relationId); + return new R(); + } + +} \ No newline at end of file diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/web/AppEvaController.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/web/AppEvaController.java new file mode 100644 index 0000000..3a5f547 --- /dev/null +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/web/AppEvaController.java @@ -0,0 +1,39 @@ +package cn.sh.stc.sict.theme.hphy.controller.web; + +import cn.hutool.core.util.StrUtil; +import cn.sh.stc.sict.cloud.common.core.util.R; +import cn.sh.stc.sict.theme.hpgp.model.HpAppointmentEva; +import cn.sh.stc.sict.theme.hpgp.service.HpAppointmentEvaService; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +@Slf4j +@RestController +@AllArgsConstructor +@Api(tags = "[B]预约评价") +@RequestMapping("/app/eva") +public class AppEvaController { + private final HpAppointmentEvaService hpAppointmentEvaService; + + @ApiOperation("分页") + @GetMapping("/page") + public R hasEavedPage(Page page, HpAppointmentEva eva) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); + wrapper.like(StrUtil.isNotBlank(eva.getPatientName()), HpAppointmentEva::getPatientName, eva.getPatientName()) + .like(StrUtil.isNotBlank(eva.getHospName()), HpAppointmentEva::getHospName, eva.getHospName()) + .like(StrUtil.isNotBlank(eva.getDeptName()), HpAppointmentEva::getDeptName, eva.getDeptName()) + .like(StrUtil.isNotBlank(eva.getDoctorName()), HpAppointmentEva::getDoctorName, eva.getDoctorName()) + .orderByDesc(HpAppointmentEva::getCreateTime); + + return new R(hpAppointmentEvaService.page(page, wrapper)); + } +} diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/web/GuideRecordController.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/web/GuideRecordController.java index d573a2d..35c34ff 100644 --- a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/web/GuideRecordController.java +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/web/GuideRecordController.java @@ -35,10 +35,16 @@ public class GuideRecordController { @ApiOperation("分页查询") @GetMapping("/page") - public R page(Page page, String patientName, String disease){ + public R page(Page page, + String patientName, + String disease, + String hospName, + String deptName, + String doctorName){ LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.like(StrUtil.isNotBlank(patientName), HphyGuideRecord::getPatientName, patientName) .like(StrUtil.isNotBlank(disease), HphyGuideRecord::getDisease, disease) + // .like(StrUtil.isNotBlank(hospName), HphyGuideRecord) .orderByDesc(HphyGuideRecord::getUpdateTime, HphyGuideRecord::getCreateTime); page = hphyGuideRecordService.page(page, wrapper); diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/web/HpAppointmentController.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/web/HpAppointmentController.java index dd76863..cd2a6d7 100644 --- a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/web/HpAppointmentController.java +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/web/HpAppointmentController.java @@ -37,9 +37,15 @@ public class HpAppointmentController extends ApiController { @ApiOperation("分页查询 - 预约记录") @GetMapping("/app/page") public R appPage(Page page, - @RequestParam(value = "name", required = false) String name) { + @RequestParam(value = "name", required = false) String name, + @RequestParam(value = "hospName", required = false) String hospName, + @RequestParam(value = "deptName", required = false) String deptName, + @RequestParam(value = "doctorName", required = false) String doctorName) { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.like(StrUtil.isNotBlank(name), HpAppointment::getPatientName, name) + .like(StrUtil.isNotBlank(hospName), HpAppointment::getHosOrgName, hospName) + .like(StrUtil.isNotBlank(doctorName), HpAppointment::getDoctorName, doctorName) + .like(StrUtil.isNotBlank(deptName), HpAppointment::getDeptName, deptName) .orderByDesc(HpAppointment::getCreateTime); page = hpAppointmentService.page(page, wrapper); @@ -49,10 +55,16 @@ public class HpAppointmentController extends ApiController { @ApiOperation("分页查询 - 取消预约记录") @GetMapping("/cancel/page") public R cancelPage(Page page, - @RequestParam(value = "name", required = false) String name) { + @RequestParam(value = "name", required = false) String name, + @RequestParam(value = "hospName", required = false) String hospName, + @RequestParam(value = "deptName", required = false) String deptName, + @RequestParam(value = "doctorName", required = false) String doctorName) { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.eq(HpAppointment::getStatus, Constant.BYTE_YES) .like(StrUtil.isNotBlank(name), HpAppointment::getPatientName, name) + .like(StrUtil.isNotBlank(hospName), HpAppointment::getHosOrgName, hospName) + .like(StrUtil.isNotBlank(doctorName), HpAppointment::getDoctorName, doctorName) + .like(StrUtil.isNotBlank(deptName), HpAppointment::getDeptName, deptName) .orderByDesc(HpAppointment::getCreateTime); page = hpAppointmentService.page(page, wrapper); diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/web/HphyGuideMatchController.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/web/HphyGuideMatchController.java index bfd7388..c70fdfd 100644 --- a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/web/HphyGuideMatchController.java +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/web/HphyGuideMatchController.java @@ -1,9 +1,11 @@ package cn.sh.stc.sict.theme.hphy.controller.web; +import cn.hutool.core.util.StrUtil; import cn.sh.stc.sict.cloud.common.core.util.R; import cn.sh.stc.sict.theme.hphy.model.HphyGuideMatch; import cn.sh.stc.sict.theme.hphy.service.HphyGuideMatchService; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.annotations.Api; @@ -34,13 +36,19 @@ public class HphyGuideMatchController { * 分页查询 * * @param page 分页对象 - * @param hphyGuideMatch 导医推荐记录 * @return */ @ApiOperation("分页查询 导医推荐记录") @GetMapping("/page") - public R getHphyGuideMatchPage(Page page, HphyGuideMatch hphyGuideMatch) { - page = hphyGuideMatchService.page(page, Wrappers.query(hphyGuideMatch)); + public R getHphyGuideMatchPage(Page page, HphyGuideMatch guide) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); + wrapper.like(StrUtil.isNotBlank(guide.getPatientName()), HphyGuideMatch::getPatientName, guide.getPatientName()) + .like(StrUtil.isNotBlank(guide.getHospName()), HphyGuideMatch::getHospName, guide.getHospName()) + .like(StrUtil.isNotBlank(guide.getDeptName()), HphyGuideMatch::getDeptName, guide.getDeptName()) + .like(StrUtil.isNotBlank(guide.getDoctorName()), HphyGuideMatch::getDoctorName, guide.getDoctorName()) + .orderByDesc(HphyGuideMatch::getCreateTime); + + page = hphyGuideMatchService.page(page, wrapper); return new R(page); } } diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/dao/HphyPatientRelationMapper.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/dao/HphyPatientRelationMapper.java new file mode 100644 index 0000000..436b049 --- /dev/null +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/dao/HphyPatientRelationMapper.java @@ -0,0 +1,19 @@ +package cn.sh.stc.sict.theme.hphy.dao; + +import cn.sh.stc.sict.theme.hphy.model.HphyPatientRelation; +import cn.sh.stc.sict.theme.hphy.vo.PatientRelationVO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 患者-家庭成员关系表(HphyPatientRelation)表数据库访问层 + * + * @author F_xh + * @since 2022-10-10 14:41:03 + */ +public interface HphyPatientRelationMapper extends BaseMapper { + + List listPatientRelation(@Param("patientId") Long patientId); +} \ No newline at end of file diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/model/HphyGuideMatch.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/model/HphyGuideMatch.java index 59cdfd9..e8c26c4 100644 --- a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/model/HphyGuideMatch.java +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/model/HphyGuideMatch.java @@ -28,57 +28,57 @@ public class HphyGuideMatch extends Model { * id */ @TableId - @ApiModelProperty(hidden = false, value = "id") + @ApiModelProperty(value = "id") private Long id; /** * 患者id */ - @ApiModelProperty(hidden = false, value = "患者id") + @ApiModelProperty(value = "患者id") private Long patientId; /** * 患者name */ - @ApiModelProperty(hidden = false, value = "患者name") + @ApiModelProperty(value = "患者name") private String patientName; /** * 导医id */ - @ApiModelProperty(hidden = false, value = "导医id") + @ApiModelProperty(value = "导医id") private Long guideId; /** * 医院id */ - @ApiModelProperty(hidden = false, value = "医院id") + @ApiModelProperty(value = "医院id") private String hospId; /** * 医院name */ - @ApiModelProperty(hidden = false, value = "医院name") + @ApiModelProperty(value = "医院name") private String hospName; /** * 科室id */ - @ApiModelProperty(hidden = false, value = "科室id") + @ApiModelProperty(value = "科室id") private String deptId; /** * 科室name */ - @ApiModelProperty(hidden = false, value = "科室name") + @ApiModelProperty(value = "科室name") private String deptName; /** * 医生id */ - @ApiModelProperty(hidden = false, value = "医生id") + @ApiModelProperty(value = "医生id") private String doctorId; /** * 医生name */ - @ApiModelProperty(hidden = false, value = "医生name") + @ApiModelProperty(value = "医生name") private String doctorName; /** * 匹配度(%) */ - @ApiModelProperty(hidden = false, value = "匹配度(%)") + @ApiModelProperty(value = "匹配度(%)") private String matchScore; /** * 创建时间 diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/model/HphyPatientRelation.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/model/HphyPatientRelation.java new file mode 100644 index 0000000..af5c2fa --- /dev/null +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/model/HphyPatientRelation.java @@ -0,0 +1,45 @@ +package cn.sh.stc.sict.theme.hphy.model; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.util.Date; + +/** + * 患者-家庭成员关系表(HphyPatientRelation)表实体类 + * + * @author F_xh + * @since 2022-10-10 14:41:03 + */ +@Data +@SuppressWarnings("serial") +@EqualsAndHashCode(callSuper = true) +public class HphyPatientRelation extends Model { + private Long id; + private Long sourcePatientId; + private Long targetPatientId; + private String relationCode; + private String relationName; + @TableField(fill = FieldFill.INSERT) + private Date createTime; + @TableField(fill = FieldFill.INSERT) + private String createUserName; + @TableField(fill = FieldFill.UPDATE) + private Date updateTime; + @TableField(fill = FieldFill.INSERT) + private String updateUserName; + + /** + * 获取主键值 + * + * @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/HphyPatientBaseService.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/HphyPatientBaseService.java index 32a776d..4f0b9ba 100644 --- a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/HphyPatientBaseService.java +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/HphyPatientBaseService.java @@ -17,6 +17,12 @@ import java.util.List; public interface HphyPatientBaseService extends IService { HphyPatientBase getByOpenId(String openId); + HphyPatientBase getByPhone(String phone, Boolean flag); + HphyPatientBase saveSSbInfo(CurrentUser current, WDUserInfo userInfo, List cardList); + + void savePatient(HphyPatientBase patient); + + HphyPatientBase getCurrentBase(); } diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/HphyPatientRelationService.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/HphyPatientRelationService.java new file mode 100644 index 0000000..faf8438 --- /dev/null +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/HphyPatientRelationService.java @@ -0,0 +1,18 @@ +package cn.sh.stc.sict.theme.hphy.service; + +import cn.sh.stc.sict.theme.hphy.model.HphyPatientRelation; +import cn.sh.stc.sict.theme.hphy.vo.PatientRelationVO; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + * 患者-家庭成员关系表(HphyPatientRelation)表服务接口 + * + * @author F_xh + * @since 2022-10-10 14:41:04 + */ +public interface HphyPatientRelationService extends IService { + + List listPatientRelation(Long patientId); +} \ 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/HphyPatientBaseServiceImpl.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/impl/HphyPatientBaseServiceImpl.java index edcc41b..7973dd2 100644 --- a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/impl/HphyPatientBaseServiceImpl.java +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/impl/HphyPatientBaseServiceImpl.java @@ -6,6 +6,8 @@ import cn.hutool.core.util.ObjectUtil; import cn.sh.stc.sict.cloud.common.core.constant.Constant; import cn.sh.stc.sict.cloud.common.core.dto.WDUserCardInfo; 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.security.util.SecurityUtils; import cn.sh.stc.sict.cloud.upms.dto.CurrentUser; import cn.sh.stc.sict.theme.hphy.dao.HphyPatientBaseMapper; import cn.sh.stc.sict.theme.hphy.model.HphyPatientBase; @@ -32,6 +34,17 @@ public class HphyPatientBaseServiceImpl extends ServiceImpl wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(HphyPatientBase::getPhone, phone) + .isNull(flag, HphyPatientBase::getOpenId) + .orderByDesc(HphyPatientBase::getUpdateTime) + .last("limit 1"); + + return this.getOne(wrapper); + } + @Override public HphyPatientBase saveSSbInfo(CurrentUser current, WDUserInfo userInfo, List cardList) { if (ObjectUtil.isNotNull(userInfo)) { @@ -44,7 +57,7 @@ public class HphyPatientBaseServiceImpl extends ServiceImpl wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(HphyPatientBase::getCertId, certId) + .orderByDesc(HphyPatientBase::getUpdateTime) + .last("limit 1"); + + return this.getOne(wrapper); + } + + @Override + public HphyPatientBase getCurrentBase() { + CurrentUser current = SecurityUtils.getCurrentUser(); + return this.getByOpenId(current.getOpenId()); + } } diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/impl/HphyPatientRelationServiceImpl.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/impl/HphyPatientRelationServiceImpl.java new file mode 100644 index 0000000..1c9e844 --- /dev/null +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/impl/HphyPatientRelationServiceImpl.java @@ -0,0 +1,28 @@ +package cn.sh.stc.sict.theme.hphy.service.impl; + +import cn.sh.stc.sict.theme.hphy.dao.HphyPatientRelationMapper; +import cn.sh.stc.sict.theme.hphy.model.HphyPatientRelation; +import cn.sh.stc.sict.theme.hphy.service.HphyPatientRelationService; +import cn.sh.stc.sict.theme.hphy.vo.PatientRelationVO; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.AllArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 患者-家庭成员关系表(HphyPatientRelation)表服务实现类 + * + * @author F_xh + * @since 2022-10-10 14:41:04 + */ +@AllArgsConstructor +@Service("hphyPatientRelationService") +public class HphyPatientRelationServiceImpl extends ServiceImpl implements HphyPatientRelationService { + private final HphyPatientRelationMapper hphyPatientRelationMapper; + + @Override + public List listPatientRelation(Long patientId) { + return hphyPatientRelationMapper.listPatientRelation(patientId); + } +} \ No newline at end of file diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/vo/PatientRelationDTO.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/vo/PatientRelationDTO.java new file mode 100644 index 0000000..fbb2215 --- /dev/null +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/vo/PatientRelationDTO.java @@ -0,0 +1,11 @@ +package cn.sh.stc.sict.theme.hphy.vo; + +import cn.sh.stc.sict.theme.hphy.model.HphyPatientBase; +import cn.sh.stc.sict.theme.hphy.model.HphyPatientRelation; +import lombok.Data; + +@Data +public class PatientRelationDTO { + private HphyPatientRelation relation; + private HphyPatientBase patient; +} diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/vo/PatientRelationVO.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/vo/PatientRelationVO.java new file mode 100644 index 0000000..e7279e0 --- /dev/null +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/vo/PatientRelationVO.java @@ -0,0 +1,11 @@ +package cn.sh.stc.sict.theme.hphy.vo; + +import cn.sh.stc.sict.theme.hphy.model.HphyPatientBase; +import lombok.Data; + +@Data +public class PatientRelationVO extends HphyPatientBase { + private Long relationId; + private String relationCode; + private String relationName; +} diff --git a/smart-health-modules/theme-schema/src/main/resources/bootstrap-dev.yml b/smart-health-modules/theme-schema/src/main/resources/bootstrap-dev.yml index 0ac9f31..331dddc 100644 --- a/smart-health-modules/theme-schema/src/main/resources/bootstrap-dev.yml +++ b/smart-health-modules/theme-schema/src/main/resources/bootstrap-dev.yml @@ -20,3 +20,4 @@ spring: logging: level: cn.sh.stc.sict.theme.hpgp.dao: DEBUG + cn.sh.stc.sict.theme.hphy.dao: DEBUG diff --git a/smart-health-modules/theme-schema/src/main/resources/mapper/hphy/HphyPatientRelationMapper.xml b/smart-health-modules/theme-schema/src/main/resources/mapper/hphy/HphyPatientRelationMapper.xml new file mode 100644 index 0000000..9b8485c --- /dev/null +++ b/smart-health-modules/theme-schema/src/main/resources/mapper/hphy/HphyPatientRelationMapper.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file -- 2.22.0