diff --git a/src/main/java/digital/laboratory/platform/imr/controller/DrugUsageRecordController.java b/src/main/java/digital/laboratory/platform/imr/controller/DrugUsageRecordController.java index bc1deb0..4fb4e20 100644 --- a/src/main/java/digital/laboratory/platform/imr/controller/DrugUsageRecordController.java +++ b/src/main/java/digital/laboratory/platform/imr/controller/DrugUsageRecordController.java @@ -10,9 +10,12 @@ import digital.laboratory.platform.imr.convert.DrugUsageRecordConvert; import digital.laboratory.platform.imr.dto.DrugUsageRecordDTO; import digital.laboratory.platform.imr.entity.DrugMaterialInfo; import digital.laboratory.platform.imr.entity.DrugUsageRecord; +import digital.laboratory.platform.imr.enums.DrugMaterialStatus; import digital.laboratory.platform.imr.mapper.DrugMaterialInfoMapper; import digital.laboratory.platform.imr.query.DrugUsageRecordQuery; +import digital.laboratory.platform.imr.service.CommonFeignService; import digital.laboratory.platform.imr.service.DrugUsageRecordService; +import digital.laboratory.platform.imr.vo.DrugMaterialInfoVO; import digital.laboratory.platform.imr.vo.DrugUsageRecordVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiModelProperty; @@ -22,6 +25,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.validation.Valid; +import java.util.List; @RestController @RequestMapping("/drugUsageRecord") @@ -34,6 +38,9 @@ public class DrugUsageRecordController { @Resource private DrugMaterialInfoMapper drugMaterialInfoMapper; + @Resource + private CommonFeignService commonFeignService; + @ApiOperation("毒品检材领用出库") @PostMapping("/outbound") public R outbound(@RequestBody @Valid DrugUsageRecordDTO dto) { @@ -69,7 +76,13 @@ public class DrugUsageRecordController { public R details(@RequestParam("id") String id) { DrugUsageRecord drugUsageRecord = drugUsageRecordService.getById(id); DrugUsageRecordVO drugUsageRecordVO = DrugUsageRecordConvert.entityToVO(drugUsageRecord); - drugUsageRecordVO.setDrugMaterialInfoVOList(drugMaterialInfoMapper.getDrugMaterialVO(Wrappers.query().in("dm.id", drugUsageRecordVO.getDrugIds()))); + List drugMaterialInfoVOS = drugMaterialInfoMapper.getDrugMaterialVO(Wrappers.query() + .in("dm.id", drugUsageRecordVO.getDrugIds())); + drugMaterialInfoVOS.parallelStream().forEach(item -> { + item.setHandingOverOrgName(commonFeignService.remoteGetSysOrg(item.getHandingOverOrg()).getName()); + item.setStatusName(DrugMaterialStatus.fromStatus(item.getStatus()).getDesc()); + }); + drugUsageRecordVO.setDrugMaterialInfoVOList(drugMaterialInfoVOS); return R.ok(drugUsageRecordVO); } diff --git a/src/main/java/digital/laboratory/platform/imr/vo/DrugMaterialInfoVO.java b/src/main/java/digital/laboratory/platform/imr/vo/DrugMaterialInfoVO.java index 93ce01b..3f7f291 100644 --- a/src/main/java/digital/laboratory/platform/imr/vo/DrugMaterialInfoVO.java +++ b/src/main/java/digital/laboratory/platform/imr/vo/DrugMaterialInfoVO.java @@ -37,6 +37,9 @@ public class DrugMaterialInfoVO { @ApiModelProperty("柜子id") private String canineId; + @ApiModelProperty("格子id") + private String storageCellId; + @ApiModelProperty("存放位置") private String storageLocation; diff --git a/src/main/resources/mapper/DrugMaterialInfoMapper.xml b/src/main/resources/mapper/DrugMaterialInfoMapper.xml index a9aaa91..2e1022d 100644 --- a/src/main/resources/mapper/DrugMaterialInfoMapper.xml +++ b/src/main/resources/mapper/DrugMaterialInfoMapper.xml @@ -33,9 +33,10 @@ dc.case_no, dc.handing_over_org, dc.handing_over_date, - ss.id as sampleStorageId, + ss.id AS sampleStorageId, ss.storage_location, - ss.box_id as canineId + ss.box_id AS canineId, + ss.storage_cell_id FROM b_drug_material_info dm LEFT JOIN b_drug_case_info dc ON dm.case_id = dc.id LEFT JOIN b_sample_storage ss ON dm.id = ss.sample_id @@ -45,9 +46,11 @@ - OR dc.case_name LIKE CONCAT('%', #{query.keywords}, '%') + AND ( + dc.case_name LIKE CONCAT('%', #{query.keywords}, '%') OR dm.drug_name LIKE CONCAT('%', #{query.keywords}, '%') OR dm.drug_no LIKE CONCAT('%', #{query.keywords}, '%') + ) AND dc.handing_over_org = #{query.orgId} @@ -55,7 +58,7 @@ AND dm.case_id = #{query.caseId} - + AND dm.status = #{query.status}