|
|
|
@ -23,7 +23,6 @@ import digital.laboratory.platform.entrustment.service.EntrustmentIdentification |
|
|
|
|
import digital.laboratory.platform.entrustment.service.EntrustmentService; |
|
|
|
|
import digital.laboratory.platform.entrustment.vo.DetectionRateVO; |
|
|
|
|
import digital.laboratory.platform.entrustment.vo.EntrustMaterialCheckoutResultVO; |
|
|
|
|
import digital.laboratory.platform.entrustment.vo.EntrustmentIdentificationMaterialVO; |
|
|
|
|
import digital.laboratory.platform.sys.entity.Area; |
|
|
|
|
import digital.laboratory.platform.sys.entity.DrugLite; |
|
|
|
|
import org.apache.poi.ss.usermodel.*; |
|
|
|
@ -361,9 +360,6 @@ public class EntrustMaterialCheckoutResultServiceImpl extends ServiceImpl<Entrus |
|
|
|
|
return typeName; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
/** |
|
|
|
|
* 获取指定年份的所有毒品类型列表(去重并排序) |
|
|
|
|
* <p> |
|
|
|
@ -371,25 +367,20 @@ public class EntrustMaterialCheckoutResultServiceImpl extends ServiceImpl<Entrus |
|
|
|
|
* 并返回一个去重且按字典序排序的毒品类型列表。 |
|
|
|
|
* |
|
|
|
|
* @param year 年份,若为 null 则默认使用当前年份 |
|
|
|
|
* @param orgId |
|
|
|
|
* @return 包含所有毒品类型的列表,列表中的毒品类型名称已去重并排序 |
|
|
|
|
* |
|
|
|
|
* @see EntrustMaterialCheckoutResult 委托材料检验结果实体类,包含定性结果字段 |
|
|
|
|
* @see DrugLite 药品轻量级实体类,包含药品名称字段 |
|
|
|
|
* @see DrugLiteConvert 工具类,用于将定性结果转换为毒品轻量级实体列表 |
|
|
|
|
*/ |
|
|
|
|
public List<String> getResultType(Integer year) { |
|
|
|
|
@Override |
|
|
|
|
public List<String> getResultType(Integer year, String orgId) { |
|
|
|
|
// 根据年份构建查询起始时间
|
|
|
|
|
LocalDateTime startTime = null; |
|
|
|
|
if (year != null) { |
|
|
|
|
// 如果年份不为空,使用指定年份的1月1日 00:00:00
|
|
|
|
|
startTime = LocalDateTime.of(year, 1, 1, 0, 0); |
|
|
|
|
} else { |
|
|
|
|
// 如果年份为空,默认使用当前年份的1月1日 00:00:00
|
|
|
|
|
startTime = LocalDateTime.of(LocalDateTime.now().getYear(), 1, 1, 0, 0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
LocalDateTime startTime = getStartTime(year); |
|
|
|
|
List<String> entrustIdList = getEntrustIdListByOrgId(orgId); |
|
|
|
|
// 查询所有非空且不为空的定性结果,且创建时间大于等于起始时间
|
|
|
|
|
List<EntrustMaterialCheckoutResult> list = this.list(Wrappers.<EntrustMaterialCheckoutResult>lambdaQuery() |
|
|
|
|
.in(CollUtil.isNotEmpty(entrustIdList), EntrustMaterialCheckoutResult::getEntrustId, entrustIdList) |
|
|
|
|
.ne(EntrustMaterialCheckoutResult::getQualitativeResult, "") // 排除空字符串
|
|
|
|
|
.isNotNull(EntrustMaterialCheckoutResult::getQualitativeResult) // 排除空值
|
|
|
|
|
.ge(EntrustMaterialCheckoutResult::getCreateTime, startTime)); // 创建时间大于等于起始时间
|
|
|
|
@ -418,16 +409,8 @@ public class EntrustMaterialCheckoutResultServiceImpl extends ServiceImpl<Entrus |
|
|
|
|
return typeList; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public DetectionRateVO getDetectionRateByMaterial(Integer year) { |
|
|
|
|
// 获取所有毒品类型列表
|
|
|
|
|
List<String> resultType = this.getResultType(year); |
|
|
|
|
// 用于存储毒品名称及其检出占比的映射表
|
|
|
|
|
DetectionRateVO vo = new DetectionRateVO(); |
|
|
|
|
ArrayList<String> nameList = new ArrayList<>(); |
|
|
|
|
ArrayList<String> percentList = new ArrayList<>(); |
|
|
|
|
// 根据年份构建查询起始时间
|
|
|
|
|
// 获取开始时间
|
|
|
|
|
private LocalDateTime getStartTime(Integer year) { |
|
|
|
|
LocalDateTime startTime = null; |
|
|
|
|
if (year != null) { |
|
|
|
|
// 如果年份不为空,使用指定年份的1月1日 00:00:00
|
|
|
|
@ -436,9 +419,34 @@ public class EntrustMaterialCheckoutResultServiceImpl extends ServiceImpl<Entrus |
|
|
|
|
// 如果年份为空,默认使用当前年份的1月1日 00:00:00
|
|
|
|
|
startTime = LocalDateTime.of(LocalDateTime.now().getYear(), 1, 1, 0, 0); |
|
|
|
|
} |
|
|
|
|
return startTime; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 根据机构id获取委托id
|
|
|
|
|
private List<String> getEntrustIdListByOrgId(String orgId) { |
|
|
|
|
if (StrUtil.isBlank(orgId)) { |
|
|
|
|
return Collections.emptyList(); |
|
|
|
|
} |
|
|
|
|
List<Entrustment> entrustmentList = entrustmentService.list(Wrappers.<Entrustment>lambdaQuery().eq(Entrustment::getClientOrgId, orgId)); |
|
|
|
|
return entrustmentList.stream().map(Entrustment::getId).collect(Collectors.toList()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public DetectionRateVO getDetectionRateByMaterial(Integer year, String orgId) { |
|
|
|
|
// 获取所有毒品类型列表
|
|
|
|
|
List<String> resultType = this.getResultType(year, orgId); |
|
|
|
|
// 用于存储毒品名称及其检出占比的映射表
|
|
|
|
|
DetectionRateVO vo = new DetectionRateVO(); |
|
|
|
|
ArrayList<String> nameList = new ArrayList<>(); |
|
|
|
|
ArrayList<String> percentList = new ArrayList<>(); |
|
|
|
|
// 根据年份构建查询起始时间
|
|
|
|
|
LocalDateTime startTime = getStartTime(year); |
|
|
|
|
List<String> entrustIdList = getEntrustIdListByOrgId(orgId); |
|
|
|
|
|
|
|
|
|
// 查询所有非空且不为空的定性结果,且创建时间大于等于起始时间
|
|
|
|
|
List<EntrustmentIdentificationMaterial> materialList = entrustmentIdentificationMaterialService.list(Wrappers.<EntrustmentIdentificationMaterial>lambdaQuery() |
|
|
|
|
.in(CollUtil.isNotEmpty(entrustIdList), EntrustmentIdentificationMaterial::getEntrustmentId, entrustIdList) |
|
|
|
|
.ge(EntrustmentIdentificationMaterial::getAcceptTime, startTime) |
|
|
|
|
.eq(EntrustmentIdentificationMaterial::getAcceptPassed, 1)); |
|
|
|
|
|
|
|
|
|