20250228 更新

添加根据机构查询
master
陈江保 4 months ago
parent 2fd59db0dd
commit a0122564b0
  1. 8
      src/main/java/digital/laboratory/platform/entrustment/controller/EntrustMaterialCheckoutResultController.java
  2. 19
      src/main/java/digital/laboratory/platform/entrustment/service/EntrustMaterialCheckoutResultService.java
  3. 58
      src/main/java/digital/laboratory/platform/entrustment/service/impl/EntrustMaterialCheckoutResultServiceImpl.java

@ -84,13 +84,13 @@ public class EntrustMaterialCheckoutResultController {
@ApiOperation("查询所有检出检材的毒品种类清单,并按名称进行排序") @ApiOperation("查询所有检出检材的毒品种类清单,并按名称进行排序")
@GetMapping("/getResultType") @GetMapping("/getResultType")
public R getResultType(Integer year){ public R getResultType(Integer year, String orgId){
return R.ok(entrustMaterialCheckoutResultService.getResultType(year),"查询成功!"); return R.ok(entrustMaterialCheckoutResultService.getResultType(year, orgId),"查询成功!");
} }
@ApiOperation("查询所有毒品的检出率") @ApiOperation("查询所有毒品的检出率")
@GetMapping("/getDetectionRate") @GetMapping("/getDetectionRate")
public R getDetectionRateByMaterial(Integer year){ public R getDetectionRateByMaterial(Integer year, String orgId){
return R.ok(entrustMaterialCheckoutResultService.getDetectionRateByMaterial(year),"查询成功!"); return R.ok(entrustMaterialCheckoutResultService.getDetectionRateByMaterial(year, orgId),"查询成功!");
} }
} }

@ -11,7 +11,6 @@ import digital.laboratory.platform.entrustment.vo.EntrustMaterialCheckoutResultV
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @author ChenJiangBao * @author ChenJiangBao
@ -50,7 +49,21 @@ public interface EntrustMaterialCheckoutResultService extends IService<EntrustMa
*/ */
IPage<EntrustMaterialCheckoutResultVO> voiPage(EntrustMaterialCheckoutResultQuery query); IPage<EntrustMaterialCheckoutResultVO> voiPage(EntrustMaterialCheckoutResultQuery query);
List<String> getResultType(Integer year); /**
* 查询所有检出检材的毒品种类清单并按名称进行排序
*
* @param year
* @param orgId
* @return
*/
List<String> getResultType(Integer year, String orgId);
DetectionRateVO getDetectionRateByMaterial(Integer year); /**
* 查询所有毒品的检出率
*
* @param year
* @param orgId
* @return
*/
DetectionRateVO getDetectionRateByMaterial(Integer year, String orgId);
} }

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

Loading…
Cancel
Save