Преглед изворни кода

湘雅全院临床质控使用统计-内页

chengyao пре 3 година
родитељ
комит
472a678a6b

+ 3 - 0
doc/037.20211117_2.1.3/qc_initv2.1.3.sql

@@ -0,0 +1,3 @@
+
+use `qc`;
+-- 执行前请看注意事项!

+ 1 - 0
src/main/java/com/diagbot/config/ResourceServerConfigurer.java

@@ -265,6 +265,7 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/qc/medCheckInfo/getDataEdit").permitAll()
                 .antMatchers("/qc/medCheckInfo/saveDataEdit").permitAll()
                 .antMatchers("/qc/analysis/getQcClick").permitAll()
+                .antMatchers("/qc/analysis/getQcClickInnerPage").permitAll()
                 .antMatchers("/**").authenticated();
         //                .antMatchers("/**").permitAll();
     }

+ 1 - 0
src/main/java/com/diagbot/config/security/UrlAccessDecisionManager.java

@@ -309,6 +309,7 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/qc/dataEdit/getDataEdit", request)
                 || matchers("/qc/dataEdit/saveDataEdit", request)
                 || matchers("/qc/analysis/getQcClick", request)
+                || matchers("/qc/analysis/getQcClickInnerPage", request)
                 || matchers("/", request)) {
             return true;
         }

+ 5 - 4
src/main/java/com/diagbot/dto/GetQcClickDTO.java

@@ -16,16 +16,17 @@ import java.io.Serializable;
 @Getter
 @Setter
 public class GetQcClickDTO implements Serializable {
-    /**
-     * 科室名称
-     */
-    private String deptName;
 
     /**
      * 科室id
      */
     private String deptId;
 
+    /**
+     * 科室名称
+     */
+    private String deptName;
+
     /**
      * 点击次数
      */

+ 41 - 0
src/main/java/com/diagbot/dto/GetQcClickInnerPageDTO.java

@@ -0,0 +1,41 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+
+/**
+ * @Description:
+ * @author: cy
+ * @time: 2020/9/4 14:59
+ */
+@Getter
+@Setter
+public class GetQcClickInnerPageDTO implements Serializable {
+    /**
+     * 科室id
+     */
+    private String deptId;
+
+
+    /**
+     * 科室名称
+     */
+    private String deptName;
+
+    /**
+     * 医师id
+     */
+    private String doctorId;
+
+    /**
+     * 医师名称
+     */
+    private String doctorName;
+
+    /**
+     * 点击次数
+     */
+    private Integer clickNum;
+}

+ 31 - 1
src/main/java/com/diagbot/facade/DataAnalysisFacade.java

@@ -1,10 +1,16 @@
 package com.diagbot.facade;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.dto.GetQcClickDTO;
+import com.diagbot.dto.GetQcClickInnerPageDTO;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.MedClickInfoServiceImpl;
+import com.diagbot.util.DateUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.util.SysUserUtils;
+import com.diagbot.vo.GetQcClickInnerPageVO;
 import com.diagbot.vo.GetQcClickVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
@@ -24,7 +30,7 @@ public class DataAnalysisFacade {
     private MedClickInfoServiceImpl medClickInfoService;
 
     public List<GetQcClickDTO> getQcClick(GetQcClickVO getQcClickVO) {
-        getQcClickVO.setHospitalId(Long.valueOf(SysUserUtils.getCurrentHospitalID()));
+        clickPageSet(getQcClickVO);
         List<GetQcClickDTO> records = medClickInfoService.getBaseMapper().getQcClick(getQcClickVO);
         //没有科室过滤时增加全院数据
         if (StringUtil.isBlank(getQcClickVO.getDeptName()) || getQcClickVO.getDeptName().equals("全院")) {
@@ -36,6 +42,12 @@ public class DataAnalysisFacade {
         return records;
     }
 
+    public IPage<GetQcClickInnerPageDTO> getQcClickInnerPage(GetQcClickInnerPageVO getQcClickInnerPageVO) {
+        clickInnerPageSet(getQcClickInnerPageVO);
+        IPage<GetQcClickInnerPageDTO> records = medClickInfoService.getBaseMapper().getQcClickInnerPage(getQcClickInnerPageVO);
+        return records;
+    }
+
     /**
      * 增加全院记录
      *
@@ -60,4 +72,22 @@ public class DataAnalysisFacade {
         item.setClickNum(clickTol);
         return item;
     }
+
+    private void clickPageSet(GetQcClickVO getQcClickVO) {
+        //入参验证
+        if (DateUtil.after(DateUtil.parseDateTime(getQcClickVO.getStartDate()),DateUtil.parseDateTime(getQcClickVO.getEndDate()))){
+            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "开始时间必须小于结束时间!");
+        }
+        getQcClickVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
+    }
+
+    private void clickInnerPageSet(GetQcClickInnerPageVO getQcClickInnerPageVO) {
+        //入参验证
+        if (DateUtil.after(DateUtil.parseDateTime(getQcClickInnerPageVO.getStartDate()),DateUtil.parseDateTime(getQcClickInnerPageVO.getEndDate()))){
+            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "开始时间必须小于结束时间!");
+        }
+        getQcClickInnerPageVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
+    }
+
+
 }

+ 4 - 0
src/main/java/com/diagbot/mapper/MedClickInfoMapper.java

@@ -1,8 +1,11 @@
 package com.diagbot.mapper;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.dto.GetQcClickDTO;
+import com.diagbot.dto.GetQcClickInnerPageDTO;
 import com.diagbot.entity.MedClickInfo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.vo.GetQcClickInnerPageVO;
 import com.diagbot.vo.GetQcClickVO;
 
 import java.util.List;
@@ -17,4 +20,5 @@ import java.util.List;
  */
 public interface MedClickInfoMapper extends BaseMapper<MedClickInfo> {
     public List<GetQcClickDTO> getQcClick(GetQcClickVO getQcClickVO);
+    public IPage<GetQcClickInnerPageDTO> getQcClickInnerPage(GetQcClickInnerPageVO getQcClickInnerPageVO);
 }

+ 52 - 0
src/main/java/com/diagbot/vo/GetQcClickInnerPageVO.java

@@ -0,0 +1,52 @@
+package com.diagbot.vo;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @Description:
+ * @author: cy
+ * @time: 2020/9/4 14:59
+ */
+@Getter
+@Setter
+public class GetQcClickInnerPageVO extends Page {
+    /**
+     * 医院id
+     */
+    @ApiModelProperty(hidden = true)
+    private Long hospitalId;
+
+    /**
+     * 科室id
+     */
+    private String deptId;
+
+    /**
+     * 科室名称
+     */
+    private String deptName;
+
+    /**
+     * 医师id
+     */
+    private String doctorId;
+
+    /**
+     * 医师名称
+     */
+    private String doctorName;
+
+    @NotNull(message = "请输入起始时间")
+    @DateTimeFormat(pattern = "yyyy-MM-dd  HH:mm:ss")
+    private String startDate;
+    @DateTimeFormat(pattern = "yyyy-MM-dd  HH:mm:ss")
+    @NotNull(message = "请输入截止时间")
+    private String endDate;
+
+}

+ 4 - 4
src/main/java/com/diagbot/vo/GetQcClickVO.java

@@ -26,14 +26,14 @@ public class GetQcClickVO{
     private Long hospitalId;
 
     /**
-     * 科室名称
+     * 科室id
      */
-    private String deptName;
+    private String deptId;
 
     /**
-     * 科室id
+     * 科室名称
      */
-    private String deptId;
+    private String deptName;
 
     /**
      * 排序(升序)

+ 18 - 0
src/main/java/com/diagbot/web/DataAnalysisController.java

@@ -1,10 +1,14 @@
 package com.diagbot.web;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.annotation.SysLogger;
 import com.diagbot.dto.GetQcClickDTO;
+import com.diagbot.dto.GetQcClickInnerPageDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.facade.DataAnalysisFacade;
+import com.diagbot.vo.GetQcClickInnerPageVO;
 import com.diagbot.vo.GetQcClickVO;
+import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -21,6 +25,7 @@ import java.util.List;
  * @time: 2021/11/16 18:28
  */
 @RestController
+@Api(value = "数据分析相关API", tags = { "数据分析相关API" })
 @RequestMapping("/qc/analysis")
 public class DataAnalysisController {
 
@@ -39,4 +44,17 @@ public class DataAnalysisController {
     public RespDTO<List<GetQcClickDTO>> getQcClick(@RequestBody @Valid GetQcClickVO getQcClickVO) {
         return RespDTO.onSuc(dataAnalysisFacade.getQcClick(getQcClickVO));
     }
+
+    /**
+     * 临床质控使用统计-内页
+     *
+     * @param getQcClickInnerPageVO
+     * @return
+     */
+    @ApiOperation(value = "临床质控使用统计-内页[by:cy]")
+    @PostMapping("/getQcClickInnerPage")
+    @SysLogger("getQcClickInnerPage")
+    public RespDTO<IPage<GetQcClickInnerPageDTO>> getQcClickInnerPage(@RequestBody @Valid GetQcClickInnerPageVO getQcClickInnerPageVO) {
+        return RespDTO.onSuc(dataAnalysisFacade.getQcClickInnerPage(getQcClickInnerPageVO));
+    }
 }

+ 48 - 3
src/main/resources/mapper/MedClickInfoMapper.xml

@@ -51,9 +51,7 @@
         group by
         a.dept_id,
         a.dept_name
-        order by
-        a.dept_id,
-        a.dept_name)t
+        )t
         <if test="asc == 'clickNum'">
             order by t.clickNum
         </if>
@@ -61,4 +59,51 @@
             order by t.clickNum desc
         </if>
     </select>
+
+    <select id="getQcClickInnerPage" resultType="com.diagbot.dto.GetQcClickInnerPageDTO">
+        select
+        t.deptId,
+        t.deptName,
+        t.doctorId,
+        t.doctorName,
+        t.clickNum
+        from(
+        SELECT
+        a.dept_id as deptId,
+        a.dept_name as deptName,
+        a.doctor_id AS doctorId,
+        a.doctor_name AS doctorName,
+        count(*) as clickNum
+        FROM
+        med_click_info a
+        where
+        a.is_deleted = 'N'
+        <if test="hospitalId != null">
+            and a.hospital_id = #{hospitalId}
+        </if>
+        <if test="deptName != null and deptName != ''">
+            and a.dept_name =#{deptName}
+        </if>
+        <if test="deptId != null and deptId != ''">
+            and a.dept_id= #{deptId}
+        </if>
+        <if test="doctorId != null and doctorId != ''">
+            and a.doctor_id like CONCAT('%',#{doctorId},'%')
+        </if>
+        <if test="doctorName != null and doctorName != ''">
+            and a.doctor_name like CONCAT('%',#{doctorName},'%')
+        </if>
+        <if test="startDate != null">
+            <![CDATA[ and a.gmt_create >= #{startDate}]]>
+        </if>
+        <if test="endDate != null">
+            <![CDATA[ and a.gmt_create < #{endDate}]]>
+        </if>
+        group by
+        a.dept_id,
+        a.dept_name,
+        a.doctor_id,
+        a.doctor_name
+       )t
+    </select>
 </mapper>