Browse Source

益寿缘管理总后台增加统计医生开方时长接口

cgp 4 days ago
parent
commit
882ef4a4e8

+ 28 - 0
fs-admin/src/main/java/com/fs/his/controller/FsPrescribeDurationController.java

@@ -0,0 +1,28 @@
+package com.fs.his.controller;
+
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.R;
+import com.fs.his.param.PrescribeStatParam;
+import com.fs.his.service.IFsPrescribeService;
+import com.fs.his.vo.DoctorOperateStatVO;
+import com.github.pagehelper.PageInfo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 医生开方时长Controller
+ */
+@RestController
+@RequestMapping("/his/duration")
+public class FsPrescribeDurationController extends BaseController {
+
+    @Autowired
+    private IFsPrescribeService fsPrescribeService;
+
+    //查询医生开方时长列表
+    @PostMapping("/list")
+    public R getDurationList(@RequestBody PrescribeStatParam param) {
+        PageInfo<DoctorOperateStatVO> page = fsPrescribeService.getDurationList(param);
+        return R.ok().put("data", page);
+    }
+}

+ 4 - 0
fs-doctor-app/src/main/java/com/fs/app/controller/FsPrescribeController.java

@@ -210,4 +210,8 @@ public class FsPrescribeController extends BaseController
         return toAjax(fsPrescribeService.deleteFsPrescribeByPrescribeIds(prescribeIds));
     }
 
+    /**
+     * 查询用户开方操作时长
+     * */
+
 }

+ 4 - 4
fs-service/src/main/java/com/fs/his/mapper/FsPrescribeMapper.java

@@ -2,10 +2,7 @@ package com.fs.his.mapper;
 
 import java.util.List;
 import com.fs.his.domain.FsPrescribe;
-import com.fs.his.param.FsPrescribeListDCompanyParam;
-import com.fs.his.param.FsPrescribeListDParam;
-import com.fs.his.param.FsPrescribeListUParam;
-import com.fs.his.param.FsPrescribeParam;
+import com.fs.his.param.*;
 import com.fs.his.vo.*;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
@@ -293,4 +290,7 @@ public interface FsPrescribeMapper
 
     @Select("SELECT AVG(operate_second),doctor_id FROM fs_prescribe WHERE doctor_id = #{doctorId}  ")
     Long selectDoctorAvgOperateTime(Long doctorId);
+
+    //获取医生开方操作时长统计
+    List<DoctorOperateStatVO> selectDoctorOperateStatList(PrescribeStatParam param);
 }

+ 31 - 0
fs-service/src/main/java/com/fs/his/param/PrescribeStatParam.java

@@ -0,0 +1,31 @@
+package com.fs.his.param;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class PrescribeStatParam {
+    // 医生姓名模糊搜索
+    private String doctorName;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date startTime;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date endTime;
+
+    // 科室id
+    private Long deptId;
+
+    // 医院id
+    private Long hospitalId;
+
+    // 排序方式:asc / desc
+    private String sort;
+
+    private int pageNum=1;
+
+    private int pageSize=10;
+}

+ 6 - 0
fs-service/src/main/java/com/fs/his/service/IFsPrescribeService.java

@@ -8,6 +8,7 @@ import com.fs.his.domain.FsPrescribe;
 import com.fs.his.domain.FsPrescribeDrug;
 import com.fs.his.param.*;
 import com.fs.his.vo.*;
+import com.github.pagehelper.PageInfo;
 
 /**
  * 处方Service接口
@@ -117,4 +118,9 @@ public interface IFsPrescribeService
 
     //获取医生平均操作时间
     Long selectDoctorAvgOperateTime(Long doctorId);
+
+    /**
+     * 获取医生开方操作时长列表
+     * */
+    PageInfo<DoctorOperateStatVO> getDurationList(PrescribeStatParam  param);
 }

+ 9 - 0
fs-service/src/main/java/com/fs/his/service/impl/FsPrescribeServiceImpl.java

@@ -29,6 +29,8 @@ import com.fs.im.dto.MsgDataFormatDTO;
 import com.fs.im.service.IImService;
 import com.fs.system.oss.CloudStorageService;
 import com.fs.system.oss.OSSFactory;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import com.google.zxing.WriterException;
 import org.apache.http.util.Asserts;
 import org.slf4j.Logger;
@@ -1105,4 +1107,11 @@ public class FsPrescribeServiceImpl implements IFsPrescribeService
         return fsPrescribeMapper.selectDoctorAvgOperateTime(doctorId);
     }
 
+    @Override
+    public PageInfo<DoctorOperateStatVO> getDurationList(PrescribeStatParam param) {
+        PageHelper.startPage(param.getPageNum(), param.getPageSize());
+        List<DoctorOperateStatVO> operateStatVOList = fsPrescribeMapper.selectDoctorOperateStatList(param);
+        return new PageInfo<>(operateStatVOList);
+    }
+
 }

+ 24 - 0
fs-service/src/main/java/com/fs/his/vo/DoctorOperateStatVO.java

@@ -0,0 +1,24 @@
+package com.fs.his.vo;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+@Data
+public class DoctorOperateStatVO {
+    //医生id
+    private Long doctorId;
+    //医生名称
+    private String doctorName;
+    //操作次数
+    private Long operation;
+    //部门id
+    private Long deptId;
+    //医院id
+    private Long hospitalId;
+    //平均操作时长
+    private BigDecimal avgOperateSecond;
+    //科室名称
+    private String deptName;
+    //医院名称
+    private String hospitalName;
+}

+ 48 - 0
fs-service/src/main/resources/mapper/his/FsPrescribeMapper.xml

@@ -326,4 +326,52 @@
             CASE WHEN doctor_confirm = 0 THEN 0 ELSE 1 END,
             prescribe_id desc
     </select>
+    <select id="selectDoctorOperateStatList" resultType="com.fs.his.vo.DoctorOperateStatVO">
+        SELECT
+        fp.doctor_id,
+        fd.doctor_name,
+        fd.dept_id,
+        fd.hospital_id,
+        AVG(fp.operate_second) AS avgOperateSecond,
+        COUNT(*) as operation,
+        de.dept_name,
+        ho.hospital_name
+        FROM fs_prescribe fp
+        LEFT JOIN fs_doctor fd ON fp.doctor_id = fd.doctor_id
+        LEFT JOIN fs_department de ON de.dept_id=fd.dept_id
+        LEFT JOIN fs_hospital ho ON ho.hospital_id=fd.hospital_id
+        WHERE
+        fp.start_operate_time IS NOT NULL
+        AND fp.end_operate_time IS NOT NULL
+        AND fp.operate_second IS NOT NULL
+
+        <if test="doctorName != null and doctorName != ''">
+            AND fd.doctor_name LIKE CONCAT('%', #{doctorName}, '%')
+        </if>
+        <if test="deptId != null and deptId != ''">
+            AND de.dept_id = #{deptId}
+        </if>
+        <if test="hospitalId != null and hospitalId != ''">
+            AND ho.hospital_id = #{hospitalId}
+        </if>
+        <if test="startTime != null">
+            AND fp.end_operate_time &gt;= #{startTime}
+        </if>
+        <if test="endTime != null">
+            AND fp.end_operate_time &lt;= #{endTime}
+        </if>
+
+        GROUP BY
+        fp.doctor_id,
+        fd.doctor_name,
+        fd.dept_id,
+        fd.hospital_id
+
+        ORDER BY
+        avgOperateSecond
+        <choose>
+            <when test="sort != null and sort == 'desc'">DESC</when>
+            <otherwise>ASC</otherwise>
+        </choose>
+    </select>
 </mapper>