master
zhuqing 2 years ago
parent 45d3d8389f
commit 63f89de96a

@ -0,0 +1,68 @@
package com.ruoyi.web.controller.pc;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.TPatient;
import com.ruoyi.system.domain.resp.PlatformDayPlanResp;
import com.ruoyi.system.domain.resp.WeekMonthPersonCountResp;
import com.ruoyi.system.service.ITRecordService;
import com.ruoyi.system.service.impl.PlatformService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* @Author zhuqing
* @Date 2022/8/9
*
*/
@RestController
@RequestMapping("/platform")
@Api("工作台")
public class PlatformController {
@Autowired
private PlatformService platformService;
@ApiOperation("工作台-设备统计")
@PostMapping("/equCount")
public AjaxResult equCount(
@ApiParam(name = "hospitalId",value = "医院id",required = false) @RequestParam(required = false) Long hospitalId,
@ApiParam(name = "doctorId",value = "医生id",required = false) @RequestParam(required = false) Long doctorId){
Map<String, Integer> stringIntegerMap = platformService.equCount(hospitalId, doctorId);
return AjaxResult.success(stringIntegerMap);
}
@ApiOperation("工作台-今日就诊计划")
@PostMapping("/dayPlan")
public AjaxResult dayPlan(
@ApiParam(name = "hospitalId",value = "医院id",required = false) @RequestParam(required = false) Long hospitalId,
@ApiParam(name = "doctorId",value = "医生id",required = false) @RequestParam(required = false) Long doctorId){
List<PlatformDayPlanResp> platformDayPlanResps = platformService.dayPlan(hospitalId, doctorId);
return AjaxResult.success(platformDayPlanResps);
}
@ApiOperation("工作台-就诊人数统计")
@PostMapping("/weekMonthPersonCount")
public AjaxResult weekMonthPersonCount(
@ApiParam(name = "hospitalId",value = "医院id",required = false) @RequestParam(required = false) Long hospitalId,
@ApiParam(name = "doctorId",value = "医生id",required = false) @RequestParam(required = false) Long doctorId,
@ApiParam(name = "weekMonth",value = "周月的区分 1-周 2-月",required = false) @RequestParam(required = false) Long weekMonth){
List<WeekMonthPersonCountResp> weekMonthPersonCountResps = platformService.weekMonthPersonCount(hospitalId, doctorId,weekMonth);
return AjaxResult.success(weekMonthPersonCountResps);
}
@ApiOperation("工作台-患者年龄统计")
@PostMapping("/ageCount")
public AjaxResult ageCount(
@ApiParam(name = "hospitalId",value = "医院id",required = false) @RequestParam(required = false) Long hospitalId,
@ApiParam(name = "doctorId",value = "医生id",required = false) @RequestParam(required = false) Long doctorId){
List<TPatient> tPatients = platformService.ageCount(hospitalId,doctorId);
return AjaxResult.success(tPatients);
}
}

@ -0,0 +1,52 @@
package com.ruoyi.system.domain.resp;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
* @Author zhuqing
* @Date 2022/8/9
*/
@ApiModel(value = "PlatformDayPlanResp", description = "工作台今日就诊计划反参实体")
public class PlatformDayPlanResp {
/** 医院 */
@ApiModelProperty("name")
private String name;
/** 状态0预约 1就诊 */
@ApiModelProperty("状态0预约 1就诊")
private String status;
/** 创建时间 */
@JsonFormat(pattern = "HH:mm")
@ApiModelProperty("创建时间")
private Date createTime;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}

@ -0,0 +1,40 @@
package com.ruoyi.system.domain.resp;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
* @Author zhuqing
* @Date 2022/8/9
*/
@ApiModel(value = "WeekMonthPersonCountResp", description = "工作台今日就诊计划反参实体")
public class WeekMonthPersonCountResp {
/** 医院 */
@ApiModelProperty("count")
private int count;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("创建时间")
private Date createTime;
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}

@ -3,10 +3,15 @@ package com.ruoyi.system.mapper;
import java.util.List; import java.util.List;
import com.ruoyi.system.domain.TPatientHospitalDoctor; import com.ruoyi.system.domain.TPatientHospitalDoctor;
import com.ruoyi.system.domain.TPatient;
import com.ruoyi.system.domain.TRecord; import com.ruoyi.system.domain.TRecord;
import com.ruoyi.system.domain.req.TRecordResultReq; import com.ruoyi.system.domain.req.TRecordResultReq;
import com.ruoyi.system.domain.resp.PlatformDayPlanResp;
import com.ruoyi.system.domain.resp.TRecordResp; import com.ruoyi.system.domain.resp.TRecordResp;
import com.ruoyi.system.domain.resp.WeekMonthPersonCountResp;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/** /**
* Mapper * Mapper
@ -17,6 +22,46 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface TRecordMapper public interface TRecordMapper
{ {
/**
* --------------------------------------------------------------------
*/
/**
*
* @param hospitalId
* @param doctorId
* @return
*/
int selectEquCount(@Param("hospitalId") Long hospitalId,
@Param("doctorId")Long doctorId,
@Param("status")String status,
@Param("month")Long month,
@Param("week")Long week,
@Param("day")Long day);
/**
*
* @param hospitalId
* @param doctorId
* @return
*/
List<PlatformDayPlanResp> dayPlan(@Param("hospitalId") Long hospitalId,
@Param("doctorId")Long doctorId);
/**
* 1- 2-
* @param hospitalId
* @param doctorId
* @param weekMonth
* @return
*/
List<WeekMonthPersonCountResp> weekMonthPersonCount(@Param("hospitalId")Long hospitalId,
@Param("doctorId")Long doctorId,
@Param("weekMonth")Long weekMonth);
List<TPatient> ageCount(@Param("hospitalId")Long hospitalId,
@Param("doctorId")Long doctorId);
/** /**
* *
* *

@ -0,0 +1,72 @@
package com.ruoyi.system.service.impl;
import com.ruoyi.system.domain.TPatient;
import com.ruoyi.system.domain.resp.PlatformDayPlanResp;
import com.ruoyi.system.domain.resp.WeekMonthPersonCountResp;
import com.ruoyi.system.mapper.TRecordMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Author zhuqing
* @Date 2022/8/9
*/
@Component
public class PlatformService {
@Autowired
private TRecordMapper tRecordMapper;
/**
*
* @param hospitalId
* @param doctorId
* @return
*/
public Map<String, Integer> equCount(Long hospitalId, Long doctorId) {
//就诊总数
int all = tRecordMapper.selectEquCount(hospitalId, doctorId, "1", null, null,null);
//本月总数
int month = tRecordMapper.selectEquCount(hospitalId, doctorId, "1", 1L, null,null);
//本周总数
int week = tRecordMapper.selectEquCount(hospitalId, doctorId, "1", null, 1L,null);
//今日预约
int day = tRecordMapper.selectEquCount(hospitalId, doctorId, "0", null, null,1L);
Map<String, Integer> map = new HashMap<String, Integer>(){{
put("all",all);
put("month",month);
put("week",week);
put("day",day);
}};
return map;
}
/**
*
* @param hospitalId
* @param doctorId
* @return
*/
public List<PlatformDayPlanResp> dayPlan(Long hospitalId, Long doctorId) {
return tRecordMapper.dayPlan(hospitalId, doctorId);
}
/**
* /
* @param hospitalId
* @param doctorId
* @param weekMonth
* @return
*/
public List<WeekMonthPersonCountResp> weekMonthPersonCount(Long hospitalId, Long doctorId,Long weekMonth) {
return tRecordMapper.weekMonthPersonCount(hospitalId, doctorId,weekMonth);
}
public List<TPatient> ageCount(Long hospitalId, Long doctorId) {
return tRecordMapper.ageCount(hospitalId, doctorId);
}
}

@ -85,6 +85,60 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN t_patient tp ON tr.patient_id = tp.id LEFT JOIN t_patient tp ON tr.patient_id = tp.id
</sql> </sql>
<!--====================工作台相关接口=====================-->
<select id="selectEquCount" resultType="int">
select count(*) from t_record
<where>
1 = 1
<if test="doctorId != null "> and doctor_id = #{doctorId}</if>
<if test="hospitalId != null "> and hospital_id = #{hospitalId}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="month != null ">
and DATE_FORMAT(create_time,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m')
</if>
<if test="week != null ">
and YEARWEEK(date_format(create_time,'%Y-%m-%d'),1) = YEARWEEK(now(),1)
</if>
<if test="day != null ">
and TO_DAYS(create_time) = TO_DAYS(NOW())
</if>
</where>
</select>
<select id="dayPlan" resultType="com.ruoyi.system.domain.resp.PlatformDayPlanResp">
select
a.create_time as createTime,
if(a.status = '0','预约','就诊') as status,
b.name
from t_record a LEFT JOIN t_patient b on a.patient_id = b.id
where TO_DAYS(a.create_time) = TO_DAYS(NOW())
<if test="doctorId != null "> and a.doctor_id = #{doctorId}</if>
<if test="hospitalId != null "> and a.hospital_id = #{hospitalId}</if>
ORDER BY a.create_time desc
limit 5
</select>
<select id="weekMonthPersonCount" resultType="com.ruoyi.system.domain.resp.WeekMonthPersonCountResp">
select date_format(create_time, '%Y-%m-%d') createTime, count(*) count
from
<if test="weekMonth == 1 || weekMonth == null">
(select * from t_record where DATE_SUB(CURDATE(), INTERVAL 7 DAY) &lt;= date(create_time)) X
</if>
<if test="weekMonth == 2">
(select * from t_record where DATE_SUB(CURDATE(), INTERVAL 30 DAY) &lt;= date(create_time)) X
</if>
where 1 = 1
<if test="doctorId != null "> and X.doctor_id = #{doctorId}</if>
<if test="hospitalId != null "> and X.hospital_id = #{hospitalId}</if>
group by date_format(X.create_time, '%Y-%m-%d');
</select>
<select id="ageCount" resultType="com.ruoyi.system.domain.TPatient">
</select>
<!--====================工作台相关接口=====================-->
<select id="selectTRecordList" parameterType="TRecord" resultMap="TRecordResult"> <select id="selectTRecordList" parameterType="TRecord" resultMap="TRecordResult">
<include refid="selectTRecordVo"/> <include refid="selectTRecordVo"/>
<where> <where>

Loading…
Cancel
Save