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 be6b97ed392d246c13cc84b09938a5b69bb22e33..ffc592439333e282e0435ed67cc7e2c80ddb9fbd 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 99f5728cd5132affca83d53b007c2f9a795e77f6..548cbce695cbc831be99b8e507913005f364f42a 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 0000000000000000000000000000000000000000..88d64e751f5613f4cad023be6e09f2e60dd004e0 --- /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 0000000000000000000000000000000000000000..8dcdaffd2e818e7775477046aca4dde7d38e0923 --- /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 111ce17b9885c095f86b7eb6fac3c21ce1cd724e..8f3f7fd4f12f02cc28fee54a1e28e7fae55a2040 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 0000000000000000000000000000000000000000..eae4b5eb27165a7f622a023c53423770f52a7ab2 --- /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 13b95b467aed3da1bf1e11b3f28a4acecb1800bc..73c53507de0c5ba7856388bc9454012bd0d502e2 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 0000000000000000000000000000000000000000..e7a88f2829ff7ca00ac60ffea01246d622849a3e --- /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 0000000000000000000000000000000000000000..95a9f2d432447b6c6288b857aa4b72e8a9254e93 --- /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 abfb1110767c3426097897a7861f07fe5293ba0e..7fccc9a29c386bff8f8233168af504272cc0e4f9 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 0000000000000000000000000000000000000000..0284c8b8d9d9c35cea84ff17b4bf8ab9b9db00cf --- /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} + + +