From be0b34f5ccc4727faee4c9e9763dd6bdecf30f6c Mon Sep 17 00:00:00 2001 From: gaozhaochen Date: Wed, 19 Jul 2023 17:16:35 +0800 Subject: [PATCH] =?UTF-8?q?add:=20=E5=90=91=E4=B8=87=E8=BE=BE=E6=8F=90?= =?UTF-8?q?=E4=BE=9B=E5=AF=BC=E8=AF=8A=E6=8C=87=E6=A0=87=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/HpStatisticsController.java | 31 ++++++++++-- .../theme/hphy/dao/HpStatisticsMapper.java | 10 ++++ .../dao/HpThirdInterfaceStatusMapper.java | 38 ++++++++++++++ .../hphy/model/HpThirdInterfaceStatus.java | 44 +++++++++++++++++ .../hphy/service/HpStatisticsService.java | 13 +++++ .../HpThirdInterfaceStatusService.java | 19 +++++++ .../service/impl/HpStatisticsServiceImpl.java | 12 +++++ .../HpThirdInterfaceStatusServiceImpl.java | 23 +++++++++ .../hphy/vo/HealthManagementStatisticVO.java | 37 ++++++++++++++ .../mapper/hphy/HpStatisticsMapper.xml | 39 +++++++++++++++ .../hphy/HpThirdInterfaceStatusMapper.xml | 49 +++++++++++++++++++ 11 files changed, 310 insertions(+), 5 deletions(-) create mode 100644 smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/dao/HpThirdInterfaceStatusMapper.java create mode 100644 smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/model/HpThirdInterfaceStatus.java create mode 100644 smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/HpThirdInterfaceStatusService.java create mode 100644 smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/impl/HpThirdInterfaceStatusServiceImpl.java create mode 100644 smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/vo/HealthManagementStatisticVO.java create mode 100644 smart-health-modules/theme-schema/src/main/resources/mapper/hphy/HpThirdInterfaceStatusMapper.xml diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/web/HpStatisticsController.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/web/HpStatisticsController.java index be6b97e..ffc5924 100644 --- a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/web/HpStatisticsController.java +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/web/HpStatisticsController.java @@ -1,17 +1,17 @@ package cn.sh.stc.sict.theme.hphy.controller.web; import cn.sh.stc.sict.cloud.common.core.util.R; -import cn.sh.stc.sict.theme.annotation.SecurityParameter; +import cn.sh.stc.sict.cloud.common.log.annotation.SysLog; +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.common.crypto.EncryptionUtil; import cn.sh.stc.sict.theme.hphy.service.HpStatisticsService; +import cn.sh.stc.sict.theme.hphy.service.HpThirdInterfaceStatusService; 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; +import org.springframework.web.bind.annotation.*; /** * 黄埔医导统计 @@ -28,6 +28,8 @@ public class HpStatisticsController { private final HpStatisticsService hpStatisticsService; + private final HpThirdInterfaceStatusService hpThirdInterfaceStatusService; + @ApiOperation("统计用户使用情况") @GetMapping("/usage-overview") public R statisticsUsage(@RequestParam("startTime") String startTime, @@ -43,4 +45,23 @@ public class HpStatisticsController { return new R<>(EncryptionUtil.PUBLIC_KEY); } + @ApiOperation("第三方提供统计用户使用情况") + @GetMapping("/third/usage-overview") + @SysLog + public R statisticsUsage4Third(@RequestParam("startTime") String startTime, + @RequestParam("endTime") String endTime) { + CurrentUser currentUser = SecurityUtils.getCurrentUser(); + log.error("统计用户使用情况:startTime = {}, token = {}, currentUser = {}", startTime, endTime, currentUser.getName()); + return new R(hpStatisticsService.countAll4Third(startTime, endTime)); + } + + @ApiOperation("更新医疗机构对接公众号状态") + @PutMapping("/hos-org-mg-status") + @SysLog + public R updateHosOrgMgStatus(@RequestParam("hosOrgCode") String hosOrgCode, + @RequestParam("status") Integer status) { + hpThirdInterfaceStatusService.updateHosOrgStatus(hosOrgCode, status); + return new R(); + } + } diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/dao/HpStatisticsMapper.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/dao/HpStatisticsMapper.java index 99f5728..548cbce 100644 --- a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/dao/HpStatisticsMapper.java +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/dao/HpStatisticsMapper.java @@ -53,4 +53,14 @@ public interface HpStatisticsMapper { */ Map countHealthManagementCenter(); + /** + * 查询预约指标信息 + * + * @param startTime 开始时间 + * @param endTime 结束时间 + * @return + */ + List> countAll4Third(@Param("startTime") String startTime, + @Param("endTime") String endTime); + } diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/dao/HpThirdInterfaceStatusMapper.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/dao/HpThirdInterfaceStatusMapper.java new file mode 100644 index 0000000..88d64e7 --- /dev/null +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/dao/HpThirdInterfaceStatusMapper.java @@ -0,0 +1,38 @@ +package cn.sh.stc.sict.theme.hphy.dao; + +import java.util.List; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; +import cn.sh.stc.sict.theme.hphy.model.HpThirdInterfaceStatus; + +/** + * (HpThirdInterfaceStatus)表数据库访问层 + * + * @author gao + * @since 2023-07-19 14:17:01 + */ +public interface HpThirdInterfaceStatusMapper extends BaseMapper { + +/** +* 批量新增数据(MyBatis原生foreach方法) +* +* @param entities List 实例对象列表 +* @return 影响行数 +*/ +int insertBatch(@Param("entities") List entities); + +/** +* 批量新增或按主键更新数据(MyBatis原生foreach方法) +* +* @param entities List 实例对象列表 +* @return 影响行数 +* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参 +*/ +int insertOrUpdateBatch(@Param("entities") List entities); + +void updateStatusByHosCode(@Param("hosOrgCode")String hosOrgCode, + @Param("status")Integer status); + +} + diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/model/HpThirdInterfaceStatus.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/model/HpThirdInterfaceStatus.java new file mode 100644 index 0000000..8dcdaff --- /dev/null +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/model/HpThirdInterfaceStatus.java @@ -0,0 +1,44 @@ +package cn.sh.stc.sict.theme.hphy.model; + + +import com.baomidou.mybatisplus.extension.activerecord.Model; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * (HpThirdInterfaceStatus)表实体类 + * + * @author gao + * @since 2023-07-19 14:17:02 + */ +@SuppressWarnings("serial") +@Data +public class HpThirdInterfaceStatus extends Model { + + private Integer id; + //机构名称 + private String hosOrgCode; + //机构代码 + private String hosOrgName; + //对接状态(1-未对接;2-对接中;3-已对接) + private Integer interStatus; + + private String interDes; + + private Date createTime; + + private Date updateTime; + + /** + * 获取主键值 + * + * @return 主键值 + */ + @Override + protected Serializable pkVal() { + return this.id; + } + } + diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/HpStatisticsService.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/HpStatisticsService.java index 111ce17..8f3f7fd 100644 --- a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/HpStatisticsService.java +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/HpStatisticsService.java @@ -2,6 +2,9 @@ package cn.sh.stc.sict.theme.hphy.service; import cn.sh.stc.sict.theme.hphy.vo.StatisticsUsageVO; +import java.util.List; +import java.util.Map; + /** * @author gao * @date 2023/01/06 11:03 @@ -18,5 +21,15 @@ public interface HpStatisticsService { StatisticsUsageVO getUsageOverviewStatistics(String startTime, String endTime); + /** + * 统计时间内的指标信息 + * + * @param startTime 开始时间 + * @param endTime 结束时间 + * @return + */ + List> countAll4Third(String startTime, + String endTime); + } diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/HpThirdInterfaceStatusService.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/HpThirdInterfaceStatusService.java new file mode 100644 index 0000000..eae4b5e --- /dev/null +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/HpThirdInterfaceStatusService.java @@ -0,0 +1,19 @@ +package cn.sh.stc.sict.theme.hphy.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import cn.sh.stc.sict.theme.hphy.model.HpThirdInterfaceStatus; +import org.springframework.web.bind.annotation.RequestParam; + +/** + * (HpThirdInterfaceStatus)表服务接口 + * + * @author gao + * @since 2023-07-19 14:17:06 + */ +public interface HpThirdInterfaceStatusService extends IService { + + void updateHosOrgStatus(String hosOrgCode, + Integer status); + +} + diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/impl/HpStatisticsServiceImpl.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/impl/HpStatisticsServiceImpl.java index 13b95b4..73c5350 100644 --- a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/impl/HpStatisticsServiceImpl.java +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/impl/HpStatisticsServiceImpl.java @@ -52,4 +52,16 @@ public class HpStatisticsServiceImpl implements HpStatisticsService { .healthManagementCenterStatistics(hmcStatistics) .build(); } + + /** + * 统计时间内的指标信息 + * + * @param startTime 开始时间 + * @param endTime 结束时间 + * @return + */ + @Override + public List> countAll4Third(String startTime, String endTime) { + return hpStatisticsMapper.countAll4Third(startTime, endTime); + } } diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/impl/HpThirdInterfaceStatusServiceImpl.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/impl/HpThirdInterfaceStatusServiceImpl.java new file mode 100644 index 0000000..e7a88f2 --- /dev/null +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/impl/HpThirdInterfaceStatusServiceImpl.java @@ -0,0 +1,23 @@ +package cn.sh.stc.sict.theme.hphy.service.impl; + +import cn.sh.stc.sict.theme.hphy.dao.HpThirdInterfaceStatusMapper; +import cn.sh.stc.sict.theme.hphy.model.HpThirdInterfaceStatus; +import cn.sh.stc.sict.theme.hphy.service.HpThirdInterfaceStatusService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + * (HpThirdInterfaceStatus)表服务实现类 + * + * @author gao + * @since 2023-07-19 14:17:09 + */ +@Service("hpThirdInterfaceStatusService") +public class HpThirdInterfaceStatusServiceImpl extends ServiceImpl implements HpThirdInterfaceStatusService { + + @Override + public void updateHosOrgStatus(String hosOrgCode, Integer status) { + this.baseMapper.updateStatusByHosCode(hosOrgCode, status); + } +} + diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/vo/HealthManagementStatisticVO.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/vo/HealthManagementStatisticVO.java new file mode 100644 index 0000000..95a9f2d --- /dev/null +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/vo/HealthManagementStatisticVO.java @@ -0,0 +1,37 @@ +package cn.sh.stc.sict.theme.hphy.vo; + +import lombok.Data; + +/** + * 卫管中心统计结果数据 + * + * @author gao + * @date 2023/07/19 10:27 + */ +@Data +public class HealthManagementStatisticVO { + + /** + * 机构编码 + */ + private String hospitalCode; + + /** + * 机构名称 + */ + private String hospitalName; + + /** + * 导诊数 + */ + private String consultationCount; + + /** + * 对接状态 + * 1-未对接 + * 2-对接中 + * 3-已对接 + */ + private Byte status; + +} diff --git a/smart-health-modules/theme-schema/src/main/resources/mapper/hphy/HpStatisticsMapper.xml b/smart-health-modules/theme-schema/src/main/resources/mapper/hphy/HpStatisticsMapper.xml index abfb111..7fccc9a 100644 --- a/smart-health-modules/theme-schema/src/main/resources/mapper/hphy/HpStatisticsMapper.xml +++ b/smart-health-modules/theme-schema/src/main/resources/mapper/hphy/HpStatisticsMapper.xml @@ -71,4 +71,43 @@ WHERE title = '预约' AND create_by like '%wx24c55f38b535cd96%' + + \ No newline at end of file diff --git a/smart-health-modules/theme-schema/src/main/resources/mapper/hphy/HpThirdInterfaceStatusMapper.xml b/smart-health-modules/theme-schema/src/main/resources/mapper/hphy/HpThirdInterfaceStatusMapper.xml new file mode 100644 index 0000000..0284c8b --- /dev/null +++ b/smart-health-modules/theme-schema/src/main/resources/mapper/hphy/HpThirdInterfaceStatusMapper.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + insert into hp_third_interface_status(hos_org_code, hos_org_name, inter_status, inter_des, create_time, update_time) + values + + (#{entity.hosOrgCode}, #{entity.hosOrgName}, #{entity.interStatus}, #{entity.interDes}, #{entity.createTime}, #{entity.updateTime}) + + + + + insert into hp_third_interface_status(hos_org_code, hos_org_name, inter_status, inter_des, create_time, update_time) + values + + (#{entity.hosOrgCode}, #{entity.hosOrgName}, #{entity.interStatus}, #{entity.interDes}, #{entity.createTime}, #{entity.updateTime}) + + on duplicate key update + hos_org_code = values(hos_org_code) , hos_org_name = values(hos_org_name) , inter_status = values(inter_status) , inter_des = values(inter_des) , create_time = values(create_time) , update_time = values(update_time) + + + UPDATE hp_third_interface_status set inter_status = #{status} + + + ,inter_des = '未对接' + + + ,inter_des = '正在对接' + + + ,inter_des = '已对接' + + + WHERE hos_org_code = #{hosOrgCode} + + + -- 2.22.0