|
|
|
|
@ -2,6 +2,7 @@ package digital.laboratory.platform.entrustment.service.impl; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import digital.laboratory.platform.common.core.constant.CommonConstants; |
|
|
|
|
import digital.laboratory.platform.common.core.exception.CheckedException; |
|
|
|
|
@ -35,10 +36,12 @@ import java.net.URLEncoder; |
|
|
|
|
import java.nio.charset.StandardCharsets; |
|
|
|
|
import java.time.LocalDate; |
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
import java.time.ZoneId; |
|
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
|
|
import java.time.temporal.ChronoUnit; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Locale; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.function.Function; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
@ -149,11 +152,12 @@ public class ExcelOperationServiceImpl implements ExcelOperationService { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 处理Excel数据,构建检材对象并设置相关属性 |
|
|
|
|
* @param data Excel数据列表 |
|
|
|
|
* @param entrustment 委托信息对象 |
|
|
|
|
* @param drugLiteMap 毒品名称映射表 |
|
|
|
|
* @param orderNo 检材序号起始值 |
|
|
|
|
* @param cj 案件信息对象 |
|
|
|
|
* |
|
|
|
|
* @param data Excel数据列表 |
|
|
|
|
* @param entrustment 委托信息对象 |
|
|
|
|
* @param drugLiteMap 毒品名称映射表 |
|
|
|
|
* @param orderNo 检材序号起始值 |
|
|
|
|
* @param cj 案件信息对象 |
|
|
|
|
* @param entrustmentIdentificationMaterialList 检材列表对象集合 |
|
|
|
|
*/ |
|
|
|
|
private void processExcelDataToMaterialEntity(List<Map<String, String>> data, Entrustment entrustment, Map<String, DrugLite> drugLiteMap, int orderNo, CaseEvent cj, List<EntrustmentIdentificationMaterial> entrustmentIdentificationMaterialList) { |
|
|
|
|
@ -172,12 +176,17 @@ public class ExcelOperationServiceImpl implements ExcelOperationService { |
|
|
|
|
material.setMaterialAge(Integer.valueOf(this.getAgeByIdNum(idNum))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
material.setDrawPlace(datum.get("采样单位")); |
|
|
|
|
if (StringUtils.isBlank(datum.get("提取地点"))) { |
|
|
|
|
material.setDrawPlace("贵阳市"); |
|
|
|
|
} else { |
|
|
|
|
material.setDrawPlace(datum.get("提取地点")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
material.setId(IdWorker.get32UUID().toUpperCase()); |
|
|
|
|
|
|
|
|
|
// 检测结果解析
|
|
|
|
|
ArrayList<DrugLite> matchedDrugs = new ArrayList<>(); |
|
|
|
|
String[] drugs = datum.get("检测结果").split("、"); |
|
|
|
|
String[] drugs = datum.get("曾吸毒种类").split("、"); |
|
|
|
|
if (drugs.length == 0 || (drugs.length == 1 && drugs[0].trim().isEmpty())) { |
|
|
|
|
matchedDrugs.add(drugLiteMap.get("海洛因")); |
|
|
|
|
} else { |
|
|
|
|
@ -214,7 +223,13 @@ public class ExcelOperationServiceImpl implements ExcelOperationService { |
|
|
|
|
orderNo++; |
|
|
|
|
material.setPackComplete(true); |
|
|
|
|
material.setRtSampleQuantity(0); |
|
|
|
|
material.setDrawTime(LocalDateTime.now()); |
|
|
|
|
// 定义格式化器(注意 M 和 d 不要补0)
|
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("EEE MMM dd HH:mm:ss z yyyy", Locale.ENGLISH); |
|
|
|
|
LocalDateTime drawTime = LocalDateTime.parse(datum.get("提取时间"), formatter.withZone(ZoneId.systemDefault())); |
|
|
|
|
System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); |
|
|
|
|
System.out.println("提取时间为" + drawTime); |
|
|
|
|
// 转 LocalDate
|
|
|
|
|
material.setDrawTime(drawTime); |
|
|
|
|
material.setAnalysisOption(AnalysisOptionEnums.QUALITATIVE.getCode()); |
|
|
|
|
|
|
|
|
|
entrustmentIdentificationMaterialService.setMaterialIdentificationNo(material, cj); |
|
|
|
|
@ -227,7 +242,7 @@ public class ExcelOperationServiceImpl implements ExcelOperationService { |
|
|
|
|
/** |
|
|
|
|
* 根据当前用户的机构id查询属于这个机构的委托信息 |
|
|
|
|
* |
|
|
|
|
* @param year 年份,用于筛选特定年份的委托信息 |
|
|
|
|
* @param year 年份,用于筛选特定年份的委托信息 |
|
|
|
|
* @param response |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
@ -238,7 +253,7 @@ public class ExcelOperationServiceImpl implements ExcelOperationService { |
|
|
|
|
Wrappers.<Entrustment>query() |
|
|
|
|
.eq("e.client_org_id", user.getOrgId()) |
|
|
|
|
.eq("e.status", EntrustStatusConstants.ENTRUST_STATUS_ACCEPTED.getStatus()) |
|
|
|
|
.likeRight(year != null , "e.accept_time", year) |
|
|
|
|
.likeRight(year != null, "e.accept_time", year) |
|
|
|
|
.orderByDesc("e.accept_time") |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
@ -258,7 +273,6 @@ public class ExcelOperationServiceImpl implements ExcelOperationService { |
|
|
|
|
Map<String, List<EntrustmentIdentificationMaterial>> materialGroupMap = identificationMaterials.stream().collect(Collectors.groupingBy(EntrustmentIdentificationMaterial::getEntrustmentId)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取嫌疑人信息并根据委托id分组
|
|
|
|
|
Map<String, String> suspectGroupMap = buildSuspectInfoGroupByEntrustId(entrustmentVOList); |
|
|
|
|
|
|
|
|
|
@ -344,7 +358,7 @@ public class ExcelOperationServiceImpl implements ExcelOperationService { |
|
|
|
|
|
|
|
|
|
// ====== 输出到浏览器
|
|
|
|
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
|
|
|
|
String filename = user.getOrgName() + "已受理委托信息统计" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")) + ".xlsx"; |
|
|
|
|
String filename = user.getOrgName() + "已受理委托信息统计" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")) + ".xlsx"; |
|
|
|
|
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename, StandardCharsets.UTF_8.name())); |
|
|
|
|
workbook.write(response.getOutputStream()); |
|
|
|
|
workbook.close(); |
|
|
|
|
@ -352,6 +366,7 @@ public class ExcelOperationServiceImpl implements ExcelOperationService { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 根据委托id分组,拼接嫌疑人姓名和身份证 |
|
|
|
|
* |
|
|
|
|
* @param entrustmentVOList |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
|