소스 검색

feat:
导出评价数据

18339543638 2 년 전
부모
커밋
3cb0ef38f0

+ 11 - 0
nb-core/src/main/java/com/nb/core/utils/ExcelUtil.java

@@ -2,6 +2,7 @@ package com.nb.core.utils;
 
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.io.IoUtil;
 import cn.hutool.core.util.IdUtil;
 import cn.hutool.extra.spring.SpringUtil;
 import com.alibaba.excel.EasyExcel;
@@ -9,6 +10,9 @@ import com.nb.core.AppProperties;
 import com.nb.core.enums.BizEnum;
 import lombok.extern.slf4j.Slf4j;
 
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
 import java.util.List;
 
 /**
@@ -33,4 +37,11 @@ public class ExcelUtil {
         return filepath;
     }
 
+    public static void exportResponse(HttpServletResponse response, String filename, Class clazz, List list) throws IOException {
+        ServletOutputStream outputStream = response.getOutputStream();
+        response.setHeader("content-type", "application/octet-stream;charset=UTF-8");
+        response.setContentType("application/octet-stream;charset=UTF-8");
+        EasyExcel.write(outputStream, clazz).head(clazz).sheet(filename).doWrite(list);
+        IoUtil.close(outputStream);
+    }
 }

+ 14 - 1
nb-service/web-service/src/main/java/com/nb/web/service/bus/controller/BusEvaluationController.java

@@ -1,9 +1,11 @@
 package com.nb.web.service.bus.controller;
 
 import cn.dev33.satoken.annotation.SaCheckPermission;
+import cn.hutool.core.bean.BeanUtil;
 import com.baomidou.mybatisplus.core.mapper.Mapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.nb.core.exception.CustomException;
+import com.nb.core.utils.ExcelUtil;
 import com.nb.web.api.entity.BusEvaluationEntity;
 import com.nb.web.service.bus.service.LocalBusEvaluationService;
 import com.nb.web.api.feign.query.EvalQuery;
@@ -12,8 +14,8 @@ import com.nb.common.crud.controller.BaseCrudController;
 import com.nb.core.result.R;
 import com.nb.web.service.bus.service.LocalBusInfusionHistoryService;
 import com.nb.web.service.bus.service.dto.CombineEvalResult;
+import com.nb.web.service.bus.service.dto.CombineEvalResultExcelDTO;
 import com.nb.web.service.bus.service.dto.CombineQuery;
-import com.nb.web.service.bus.service.dto.CombineResult;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
@@ -23,6 +25,8 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
 import java.util.Arrays;
 import java.util.List;
 
@@ -67,6 +71,15 @@ public class BusEvaluationController extends BaseCrudController<BusEvaluationEnt
         return R.success(infusionHistoryService.pageStatsEval(query,query.getPage()));
     }
 
+    @PostMapping("/combine/export")
+    @SaCheckPermission({"*:eval:query"})
+    @ApiOperation(value = "导出(此查询中包括了所属的临床信息)",notes = "权限【*:eval:query】")
+    public void export(@RequestBody CombineQuery query, HttpServletResponse response) throws IOException {
+        List<CombineEvalResult> combineEvalResults = infusionHistoryService.queryStatsEval(query);
+        List<CombineEvalResultExcelDTO> exportResult = BeanUtil.copyToList(combineEvalResults, CombineEvalResultExcelDTO.class);
+        ExcelUtil.exportResponse(response,"评价信息",CombineEvalResultExcelDTO.class,exportResult);
+    }
+
     /**
      * 权限控制前缀
      * @return

+ 26 - 1
nb-service/web-service/src/main/java/com/nb/web/service/bus/service/dto/CombineEvalResult.java

@@ -1,11 +1,12 @@
 package com.nb.web.service.bus.service.dto;
 
 
+import com.alibaba.excel.annotation.ExcelProperty;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.math.BigDecimal;
-import java.sql.Date;
+import java.util.Date;
 
 /**
  * @author lifang
@@ -18,79 +19,103 @@ import java.sql.Date;
 public class CombineEvalResult extends CombineResult {
 
     @ApiModelProperty("评价时间")
+    @ExcelProperty("评价时间")
     private Date evalTime;
 
     @ApiModelProperty(value = "评价id")
     private String evalId;
 
     @ApiModelProperty(value = "评价人")
+    @ExcelProperty("评价人")
     private String evaluator;
 
     @ApiModelProperty(value = "静息疼痛")
+    @ExcelProperty("静息疼痛")
     private Integer statics;
 
     @ApiModelProperty(value = "活动疼痛")
+    @ExcelProperty("活动疼痛")
     private Integer activity;
 
     @ApiModelProperty(value = "镇静评分")
+    @ExcelProperty("镇静评分")
     private Integer calm;
 
     @ApiModelProperty(value = "左上肢")
+    @ExcelProperty("左上肢")
     private Integer leftArm;
 
     @ApiModelProperty(value = "左下肢")
+    @ExcelProperty("左下肢")
     private Integer leftLeg;
 
     @ApiModelProperty(value = "右上肢")
+    @ExcelProperty("右上肢")
     private Integer rightArm;
 
     @ApiModelProperty(value = "右下肢")
+    @ExcelProperty("右下肢")
     private Integer rightLeg;
 
     @ApiModelProperty(value = "恶心呕吐")
+    @ExcelProperty("恶心呕吐")
     private Integer nauseaVomit;
 
     @ApiModelProperty(value = "瘙痒")
+    @ExcelProperty("瘙痒")
     private Integer itch;
 
     @ApiModelProperty(value = "眩晕")
+    @ExcelProperty("眩晕")
     private Integer vertigo;
 
     @ApiModelProperty(value = "咽喉疼痛")
+    @ExcelProperty("咽喉疼痛")
     private Integer soreThroat;
 
     @ApiModelProperty(value = "尿潴留")
+    @ExcelProperty("尿潴留")
     private Integer uroschesis;
 
     @ApiModelProperty(value = "呼吸抑制")
+    @ExcelProperty("呼吸抑制")
     private Integer breathDepression;
 
     @ApiModelProperty(value = "声音嘶哑")
+    @ExcelProperty("声音嘶哑")
     private Integer hoarseness;
 
     @ApiModelProperty(value = "认知障碍")
+    @ExcelProperty("认知障碍")
     private Integer cognitionObstacle;
 
     @ApiModelProperty(value = "满意度")
+    @ExcelProperty("满意度")
     private Integer satisfaction;
 
 
     @ApiModelProperty(value = "收缩压")
+    @ExcelProperty("收缩压")
     private BigDecimal shrinkPressure;
 
 
     @ApiModelProperty(value = "舒张压")
+    @ExcelProperty("舒张压")
     private BigDecimal diastensPressure;
 
     @ApiModelProperty(value = "心率")
+    @ExcelProperty("心率")
     private BigDecimal heartRate;
 
     @ApiModelProperty(value = "胎心")
+    @ExcelProperty("胎心")
     private BigDecimal fetalHeartRate;
 
     @ApiModelProperty(value = "呼吸频率")
+    @ExcelProperty("呼吸频率")
     private BigDecimal breathRate;
 
     @ApiModelProperty(value = "血氧饱和度")
+    @ExcelProperty("血氧饱和度")
     private BigDecimal bloodOxygenSaturation;
 }

+ 99 - 0
nb-service/web-service/src/main/java/com/nb/web/service/bus/service/dto/CombineEvalResultExcelDTO.java

@@ -0,0 +1,99 @@
+package com.nb.web.service.bus.service.dto;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.converters.date.DateDateConverter;
+import lombok.Data;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @ClassName : CombineEvalResultExcelDTO
+ * @Description :
+ * @Author : LF
+ * @Date: 2023年08月18日
+ */
+@Data
+public class CombineEvalResultExcelDTO implements Serializable {
+    @ExcelProperty(value = "患者姓名",order = 1)
+    private String patientName;
+
+    @ExcelProperty(value = "住院号",order = 2)
+    private String patientCode;
+
+    @ExcelProperty(value = "手术名称",order = 3)
+    private String surgeryName;
+
+    @ExcelProperty(value = "评价时间",order = 4,converter = DateDateConverter.class)
+    private Date evalTime;
+
+    @ExcelProperty(value = "评价人",order = 5)
+    private String evaluator;
+
+    @ExcelProperty(value = "静息疼痛",order = 6)
+    private Integer statics;
+
+    @ExcelProperty(value = "活动疼痛",order = 7)
+    private Integer activity;
+
+    @ExcelProperty(value = "镇静评分",order = 8)
+    private Integer calm;
+
+    @ExcelProperty(value = "左上肢",order = 9)
+    private Integer leftArm;
+
+    @ExcelProperty(value = "左下肢",order = 10)
+    private Integer leftLeg;
+
+    @ExcelProperty(value = "右上肢",order = 11)
+    private Integer rightArm;
+
+    @ExcelProperty(value = "右下肢",order = 12)
+    private Integer rightLeg;
+
+    @ExcelProperty(value = "恶心呕吐",order = 13)
+    private Integer nauseaVomit;
+
+    @ExcelProperty(value = "瘙痒",order = 14)
+    private Integer itch;
+
+    @ExcelProperty(value = "眩晕",order = 15)
+    private Integer vertigo;
+
+    @ExcelProperty(value = "咽喉疼痛",order = 16)
+    private Integer soreThroat;
+
+    @ExcelProperty(value = "尿潴留",order = 17)
+    private Integer uroschesis;
+
+    @ExcelProperty(value = "呼吸抑制",order = 18)
+    private Integer breathDepression;
+
+    @ExcelProperty(value = "声音嘶哑",order = 19)
+    private Integer hoarseness;
+
+    @ExcelProperty(value = "认知障碍",order = 20)
+    private Integer cognitionObstacle;
+
+    @ExcelProperty(value = "满意度",order = 21)
+    private Integer satisfaction;
+
+    @ExcelProperty(value = "收缩压",order = 22)
+    private BigDecimal shrinkPressure;
+
+
+    @ExcelProperty(value = "舒张压",order = 23)
+    private BigDecimal diastensPressure;
+
+    @ExcelProperty(value = "心率",order = 24)
+    private BigDecimal heartRate;
+
+    @ExcelProperty(value = "胎心",order = 25)
+    private BigDecimal fetalHeartRate;
+
+    @ExcelProperty(value = "呼吸频率",order = 26)
+    private BigDecimal breathRate;
+
+    @ExcelProperty(value = "血氧饱和度",order = 27)
+    private BigDecimal bloodOxygenSaturation;
+}

+ 17 - 0
nb-service/web-service/src/main/resources/mapper/bus/BusInfusionHistoryMapper.xml

@@ -315,6 +315,22 @@
         i.id as infusion_id,
         i.last_upload_time as last_upload_time,
         i.start_time as infusion_start_time,
+        c.patient_code as patient_code,
+        c.ward as ward,
+        c.bed_no as bed_no,
+        c.surgery_name as surgery_name,
+        c.asa as asa,
+        c.patient_gender as patient_gender,
+        c.`patient_name` as patient_name,
+        c.`patient_age` as patient_age,
+        c.weight as weight,
+        c.`height` as height,
+        c.ana_doctor as ana_doctor,
+        c.ana_type as ana_type,
+        c.anal_type as anal_type,
+        c.surgery_doctor as surgery_doctor,
+        c.formula as formula,
+        c.entrust as entrust,
         e.evaluate_time as evaluate_time,
         e.statics as statics,
         e.activity as activity,
@@ -354,6 +370,7 @@
             ) as a
             on a.infusion_id = i.id
         </if>
+        order by e.evaluate_time desc
     </select>