diff --git a/doc/贵阳禁毒送检受理委托新增需求文档.md b/doc/贵阳禁毒送检受理委托新增需求文档.md index 1a7f745..133abff 100644 --- a/doc/贵阳禁毒送检受理委托新增需求文档.md +++ b/doc/贵阳禁毒送检受理委托新增需求文档.md @@ -283,8 +283,6 @@ DESC LIMIT 1; ![](assets/2024-12-23-11-14-56-image.png) - - ## 20241223-2 填报委托时的页面,还是需要在检材重量这一块满足他们的填写需求(100 以下保留两位小数,100以上保留一位小数)。 ### 1 解决方案 @@ -295,8 +293,12 @@ DESC LIMIT 1; ![](assets/2024-12-23-14-40-37-image.png) - - 用法 ![](assets/2024-12-23-14-41-27-image.png) + + + + + +## 20250102 在受理页面添加可以录入检材检出结果的功能 diff --git a/src/main/java/digital/laboratory/platform/entrustment/dto/CheckoutResultExcelDTO.java b/src/main/java/digital/laboratory/platform/entrustment/dto/CheckoutResultExcelDTO.java index 798be5e..64c8c24 100644 --- a/src/main/java/digital/laboratory/platform/entrustment/dto/CheckoutResultExcelDTO.java +++ b/src/main/java/digital/laboratory/platform/entrustment/dto/CheckoutResultExcelDTO.java @@ -14,15 +14,15 @@ import java.util.List; public class CheckoutResultExcelDTO { @ApiModelProperty("序号") - @ExcelProperty("序号") + @ExcelProperty(value = "序号", index = 0) private Integer order; @ApiModelProperty("送检日期") - @ExcelProperty("送检日期") + @ExcelProperty(value = "送检日期", index = 1) private String deliverTime; @ApiModelProperty("送检单位") - @ExcelProperty("送检单位") + @ExcelProperty(value = "送检单位", index = 2) private String clientOrgName; @ApiModelProperty("检材采集地-省") @@ -34,38 +34,38 @@ public class CheckoutResultExcelDTO { private String cityCollectPlace; @ApiModelProperty(value="受理编号") - @ExcelProperty("受理编号") + @ExcelProperty(value = "受理编号", index = 5) private String acceptNo; @ApiModelProperty(value = "委托检材顺序号,由系统根据录入顺序生成") - @ExcelProperty("检材编号") + @ExcelProperty(value = "检材编号", index = 6) private Integer orderNo; @ApiModelProperty(value = "检材类别名称:继承所取物证的类别或从物证类别选择") - @ExcelProperty("检材类型") + @ExcelProperty(value = "检材类型", index = 7) private String typeName; @ApiModelProperty(value = "检材颜色:继承所取物证颜色或手动填入") - @ExcelProperty("检材颜色") + @ExcelProperty(value = "检材颜色", index = 8) private String color; @ApiModelProperty(value = "检材性状名称:继承所取物证性状或从物证性状类别选择") - @ExcelProperty("检材形态") + @ExcelProperty(value = "检材形态", index = 9) private String formName; @ApiModelProperty("定性结果") - @ExcelProperty("定性结果") + @ExcelProperty(value = "定性结果", index = 10) private String qualitativeResult; @ApiModelProperty("定量结果") - @ExcelProperty("定量结果") + @ExcelProperty(value = "定量结果", index = 11) private String quantitativeResult; @ApiModelProperty("其他鉴定结果") - @ExcelProperty("其他鉴定结果") + @ExcelProperty(value = "其他鉴定结果", index = 12) private String otherResult; @ApiModelProperty("备注") - @ExcelProperty("备注") + @ExcelProperty(value = "备注", index = 13) private String remark; } diff --git a/src/main/java/digital/laboratory/platform/entrustment/service/impl/EntrustMaterialCheckoutResultServiceImpl.java b/src/main/java/digital/laboratory/platform/entrustment/service/impl/EntrustMaterialCheckoutResultServiceImpl.java index fd628fb..a0fde5b 100644 --- a/src/main/java/digital/laboratory/platform/entrustment/service/impl/EntrustMaterialCheckoutResultServiceImpl.java +++ b/src/main/java/digital/laboratory/platform/entrustment/service/impl/EntrustMaterialCheckoutResultServiceImpl.java @@ -2,6 +2,8 @@ package digital.laboratory.platform.entrustment.service.impl; import cn.hutool.core.collection.CollUtil; import cn.idev.excel.FastExcel; +import cn.idev.excel.write.metadata.style.WriteCellStyle; +import cn.idev.excel.write.style.HorizontalCellStyleStrategy; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import digital.laboratory.platform.common.core.exception.CheckedException; @@ -20,6 +22,8 @@ import digital.laboratory.platform.entrustment.service.EntrustmentIdentification import digital.laboratory.platform.entrustment.service.EntrustmentService; import digital.laboratory.platform.sys.entity.Area; import digital.laboratory.platform.sys.entity.DrugLite; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -119,12 +123,97 @@ public class EntrustMaterialCheckoutResultServiceImpl extends ServiceImpl checkoutResultExcelDTOS) throws IOException { + Workbook workbook = new XSSFWorkbook(); + Sheet sheet = workbook.createSheet(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); + // 表头导入 + List head = buildExcelHead(); + // 算上表头的行数 + int rowCount = checkoutResultExcelDTOS.size() + 1; + for (int i = 0; i < rowCount; i++) { + if (i == 0) { + Row row = sheet.createRow(i); + for (int j = 0; j < head.size(); j++) { + row.createCell(j).setCellValue(head.get(j)); + } + } else { + // 开始写入具体数据内容 + Row row = sheet.createRow(i); + CheckoutResultExcelDTO excelDTO = checkoutResultExcelDTOS.get(i - 1); + row.createCell(0).setCellValue(excelDTO.getOrder()); + row.createCell(1).setCellValue(excelDTO.getDeliverTime()); + row.createCell(2).setCellValue(excelDTO.getClientOrgName()); + row.createCell(3).setCellValue(excelDTO.getProvinceCollectPlace()); + row.createCell(4).setCellValue(excelDTO.getCityCollectPlace()); + row.createCell(5).setCellValue(excelDTO.getAcceptNo()); + row.createCell(6).setCellValue(excelDTO.getOrderNo()); + row.createCell(7).setCellValue(excelDTO.getTypeName()); + row.createCell(8).setCellValue(excelDTO.getColor()); + row.createCell(9).setCellValue(excelDTO.getFormName()); + row.createCell(10).setCellValue(excelDTO.getQualitativeResult()); + row.createCell(11).setCellValue(excelDTO.getQuantitativeResult()); + row.createCell(12).setCellValue(excelDTO.getOtherResult()); + row.createCell(13).setCellValue(excelDTO.getRemark()); + } + } + // 输出到流 + workbook.write(response.getOutputStream()); + } + + private List buildExcelHead() { + List headList = new ArrayList<>(); + headList.add("序号"); + headList.add("送检日期"); + headList.add("送检单位"); + headList.add("检材采集地"); + headList.add("检材采集地"); + headList.add("受理编号"); + headList.add("检材编号"); + headList.add("检材类型"); + headList.add("检材颜色"); + + headList.add("检材形态"); + headList.add("定性结果"); + headList.add("定量结果"); + headList.add("其他鉴定结果"); + headList.add("备注"); + return headList; } /**