1.添加毒品库中的领用出库模块
master
陈江保 3 days ago
parent 5378210b8e
commit ab35ba6ae9
  1. 17
      src/main/java/digital/laboratory/platform/imr/controller/DrugDepotsController.java
  2. 67
      src/main/java/digital/laboratory/platform/imr/controller/DrugUsageRecordController.java
  3. 46
      src/main/java/digital/laboratory/platform/imr/convert/DrugUsageRecordConvert.java
  4. 6
      src/main/java/digital/laboratory/platform/imr/dto/DrugUsageRecordDTO.java
  5. 21
      src/main/java/digital/laboratory/platform/imr/entity/DrugUsageRecord.java
  6. 1
      src/main/java/digital/laboratory/platform/imr/enums/DrugMaterialStatus.java
  7. 29
      src/main/java/digital/laboratory/platform/imr/enums/DrugUsageStatus.java
  8. 7
      src/main/java/digital/laboratory/platform/imr/interceptor/FeignOauth2RequestInterceptor.java
  9. 6
      src/main/java/digital/laboratory/platform/imr/mapper/DrugUsageRecordMapper.java
  10. 3
      src/main/java/digital/laboratory/platform/imr/query/DrugDepotsQuery.java
  11. 34
      src/main/java/digital/laboratory/platform/imr/query/DrugUsageRecordQuery.java
  12. 7
      src/main/java/digital/laboratory/platform/imr/service/CommonFeignService.java
  13. 1
      src/main/java/digital/laboratory/platform/imr/service/DrugCaseInfoService.java
  14. 8
      src/main/java/digital/laboratory/platform/imr/service/DrugMaterialInfoService.java
  15. 7
      src/main/java/digital/laboratory/platform/imr/service/DrugUsageRecordService.java
  16. 15
      src/main/java/digital/laboratory/platform/imr/service/SampleOutboundRecordService.java
  17. 31
      src/main/java/digital/laboratory/platform/imr/service/impl/CommonFeignServiceImpl.java
  18. 22
      src/main/java/digital/laboratory/platform/imr/service/impl/DrugCaseInfoServiceImpl.java
  19. 43
      src/main/java/digital/laboratory/platform/imr/service/impl/DrugMaterialInfoServiceImpl.java
  20. 113
      src/main/java/digital/laboratory/platform/imr/service/impl/DrugUsageRecordServiceImpl.java
  21. 18
      src/main/java/digital/laboratory/platform/imr/service/impl/SampleOutWarehouseApplyServiceImpl.java
  22. 11
      src/main/java/digital/laboratory/platform/imr/service/impl/SampleOutboundRecordServiceImpl.java
  23. 3
      src/main/java/digital/laboratory/platform/imr/vo/DrugMaterialInfoVO.java
  24. 63
      src/main/java/digital/laboratory/platform/imr/vo/DrugUsageRecordVO.java
  25. 6
      src/main/resources/mapper/DrugMaterialInfoMapper.xml
  26. 45
      src/main/resources/mapper/DrugUsageRecordMapper.xml

@ -7,11 +7,13 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import digital.laboratory.platform.common.core.constant.CommonConstants; import digital.laboratory.platform.common.core.constant.CommonConstants;
import digital.laboratory.platform.common.core.exception.ValidateCodeException;
import digital.laboratory.platform.common.core.util.R; import digital.laboratory.platform.common.core.util.R;
import digital.laboratory.platform.common.feign.RemoteTemplate2htmlService; import digital.laboratory.platform.common.feign.RemoteTemplate2htmlService;
import digital.laboratory.platform.common.mybatis.security.service.DLPUser; import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
import digital.laboratory.platform.imr.convert.DrugCaseInfoConvert; import digital.laboratory.platform.imr.convert.DrugCaseInfoConvert;
import digital.laboratory.platform.imr.dto.DrugDepotsDTO; import digital.laboratory.platform.imr.dto.DrugDepotsDTO;
import digital.laboratory.platform.imr.dto.DrugMaterialInfoDTO;
import digital.laboratory.platform.imr.dto.InRepositoryDTO; import digital.laboratory.platform.imr.dto.InRepositoryDTO;
import digital.laboratory.platform.imr.entity.DrugCaseInfo; import digital.laboratory.platform.imr.entity.DrugCaseInfo;
import digital.laboratory.platform.imr.entity.DrugMaterialInfo; import digital.laboratory.platform.imr.entity.DrugMaterialInfo;
@ -59,7 +61,13 @@ public class DrugDepotsController {
@ApiOperation(value = "新增毒品案件信息") @ApiOperation(value = "新增毒品案件信息")
@PostMapping("/drugCase/save") @PostMapping("/drugCase/save")
public R drugCaseSave(@RequestBody @Valid DrugDepotsDTO dto) { public R drugCaseSave(@RequestBody @Valid DrugDepotsDTO dto) {
DrugCaseInfo save = drugCaseInfoService.drugCaseSave(dto); DrugCaseInfo save = null;
try {
save = drugCaseInfoService.drugCaseSave(dto);
} catch (ValidateCodeException e) {
e.printStackTrace();
return R.failed(e.getMessage());
}
return R.ok(save); return R.ok(save);
} }
@ -70,6 +78,13 @@ public class DrugDepotsController {
return R.ok(save); return R.ok(save);
} }
@ApiOperation(value = "复制毒品检材信息")
@PostMapping("/copy")
public R copy(@RequestBody DrugMaterialInfoDTO dto) {
DrugMaterialInfoVO copy = drugMaterialInfoService.copy(dto);
return R.ok(copy);
}
@ApiOperation(value = "毒品案件信息和毒品检材信息分页接口") @ApiOperation(value = "毒品案件信息和毒品检材信息分页接口")
@PostMapping("/drugMaterial/page") @PostMapping("/drugMaterial/page")
public R<IPage<DrugMaterialInfoVO>> drugMaterialPage(@RequestBody DrugDepotsQuery query) { public R<IPage<DrugMaterialInfoVO>> drugMaterialPage(@RequestBody DrugDepotsQuery query) {

@ -1,13 +1,76 @@
package digital.laboratory.platform.imr.controller; package digital.laboratory.platform.imr.controller;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import digital.laboratory.platform.common.core.util.R;
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.mapper.DrugMaterialInfoMapper;
import digital.laboratory.platform.imr.query.DrugUsageRecordQuery;
import digital.laboratory.platform.imr.service.DrugUsageRecordService;
import digital.laboratory.platform.imr.vo.DrugUsageRecordVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping; import io.swagger.annotations.ApiModelProperty;
import org.springframework.web.bind.annotation.RestController; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
@RestController @RestController
@RequestMapping("/drugUsageRecord") @RequestMapping("/drugUsageRecord")
@Api(value = "DrugUsageRecordController", tags = "毒品检材的领用归还记录表相关接口") @Api(value = "DrugUsageRecordController", tags = "毒品检材的领用归还记录表相关接口")
public class DrugUsageRecordController { public class DrugUsageRecordController {
@Resource
private DrugUsageRecordService drugUsageRecordService;
@Resource
private DrugMaterialInfoMapper drugMaterialInfoMapper;
@ApiOperation("毒品检材领用出库")
@PostMapping("/outbound")
public R outbound(@RequestBody @Valid DrugUsageRecordDTO dto) {
boolean success = drugUsageRecordService.outbound(dto);
return R.ok(success);
}
@ApiOperation("毒品检材领用记录分页列表")
@PostMapping("/page")
public R<IPage<DrugUsageRecordVO>> page(@RequestBody DrugUsageRecordQuery query) {
String keywords = query.getKeywords();
IPage<DrugUsageRecord> page = drugUsageRecordService.page(
new Page<>(query.getCurrent(), query.getSize()),
Wrappers.<DrugUsageRecord>lambdaQuery()
.and(StrUtil.isNotBlank(keywords),
wrapper -> wrapper
.like(DrugUsageRecord::getUsageName, keywords)
.or()
.like(DrugUsageRecord::getApplicantName, keywords)
.or()
.like(DrugUsageRecord::getUsagePurpose, keywords)
)
.ge(query.getStartDate() != null, DrugUsageRecord::getUsageDate, query.getStartDate())
.le(query.getEndDate() != null, DrugUsageRecord::getUsageDate, query.getEndDate()));
IPage<DrugUsageRecordVO> voiPage = new Page<>();
BeanUtils.copyProperties(page, voiPage, "records");
voiPage.setRecords(DrugUsageRecordConvert.entityToVOList(page.getRecords()));
return R.ok(voiPage);
}
@ApiOperation("毒品检材领用记录详情")
@GetMapping("/details")
public R details(@RequestParam("id") String id) {
DrugUsageRecord drugUsageRecord = drugUsageRecordService.getById(id);
DrugUsageRecordVO drugUsageRecordVO = DrugUsageRecordConvert.entityToVO(drugUsageRecord);
drugUsageRecordVO.setDrugMaterialInfoVOList(drugMaterialInfoMapper.getDrugMaterialVO(Wrappers.<DrugMaterialInfo>query().in("dm.id", drugUsageRecordVO.getDrugIds())));
return R.ok(drugUsageRecordVO);
}
} }

@ -0,0 +1,46 @@
package digital.laboratory.platform.imr.convert;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import digital.laboratory.platform.imr.dto.DrugUsageRecordDTO;
import digital.laboratory.platform.imr.entity.DrugUsageRecord;
import digital.laboratory.platform.imr.vo.DrugUsageRecordVO;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/**
* 毒品检材的领用归还记录表相关 实体类转换
*/
public class DrugUsageRecordConvert {
public static DrugUsageRecord dtoToEntity(DrugUsageRecordDTO dto) {
if (dto == null) return null;
DrugUsageRecord drugUsageRecord = new DrugUsageRecord();
drugUsageRecord.setDrugId(dto.getDrugIds().stream().collect(Collectors.joining(",")));
drugUsageRecord.setUsageDate(dto.getUsageDate());
drugUsageRecord.setUsagePurpose(dto.getUsagePurpose());
return drugUsageRecord;
}
public static DrugUsageRecordVO entityToVO(DrugUsageRecord entity) {
if (entity == null) return null;
DrugUsageRecordVO drugUsageRecordVO = new DrugUsageRecordVO();
drugUsageRecordVO.setId(entity.getId());
drugUsageRecordVO.setDrugIds(StrUtil.split(entity.getDrugId(), StrUtil.COMMA));
drugUsageRecordVO.setUsageName(entity.getUsageName());
drugUsageRecordVO.setUsageDate(entity.getUsageDate());
drugUsageRecordVO.setUsagePurpose(entity.getUsagePurpose());
drugUsageRecordVO.setApplicant(entity.getApplicant());
drugUsageRecordVO.setApplicantName(entity.getApplicantName());
return drugUsageRecordVO;
}
public static List<DrugUsageRecordVO> entityToVOList(List<DrugUsageRecord> entityList) {
if (CollUtil.isEmpty(entityList)) return Collections.emptyList();
return entityList.stream().map(entity -> entityToVO(entity)).collect(Collectors.toList());
}
}

@ -7,7 +7,9 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
/** /**
* 毒品检材的领用归还记录表 保存DTO类 * 毒品检材的领用归还记录表 保存DTO类
@ -21,8 +23,8 @@ public class DrugUsageRecordDTO {
* 关联领用的毒品id * 关联领用的毒品id
*/ */
@ApiModelProperty("关联领用的毒品id") @ApiModelProperty("关联领用的毒品id")
@NotBlank(message = "请选择领用的检材!") @NotEmpty(message = "请选择领用的检材!")
private String drugId; private List<String> drugIds;
/** /**
* 领用时间 * 领用时间

@ -30,29 +30,30 @@ public class DrugUsageRecord extends BaseEntity {
private String drugId; private String drugId;
/** /**
* 领用申请人 * 领用物品名称
*/ */
private String applicant; private String usageName;
/** /**
* 领用时间 * 领用申请人
*/ */
private LocalDateTime usageDate; private String applicant;
/** /**
* 领用目的 * 领用申请人姓名
*/ */
private String usagePurpose; private String applicantName;
/** /**
* 归还时间 * 领用时间
*/ */
private LocalDateTime returnDate; private LocalDateTime usageDate;
/** /**
* 领用状态1 领用中 | 5 已归还 * 领用目的
*/ */
private Integer status; private String usagePurpose;
@TableField(exist = false) @TableField(exist = false)
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

@ -8,6 +8,7 @@ public enum DrugMaterialStatus {
ENTER_DRUG_INFO(0, "录入信息中"), ENTER_DRUG_INFO(0, "录入信息中"),
WAIT_INBOUND(3, "待入库"), WAIT_INBOUND(3, "待入库"),
FINISH_INBOUND(5, "已入库"), FINISH_INBOUND(5, "已入库"),
OUTBOUND(7, "已出库")
; ;
private final Integer status; private final Integer status;

@ -0,0 +1,29 @@
package digital.laboratory.platform.imr.enums;
import lombok.Getter;
@Getter
public enum DrugUsageStatus {
IN_USAGE(1, "领用中"),
FINISH_USAGE(5, "已归还"),
;
private final Integer status;
private final String desc;
DrugUsageStatus(Integer status, String desc) {
this.status = status;
this.desc = desc;
}
public static DrugUsageStatus fromStatus(Integer status) {
for (DrugUsageStatus drugUsageStatus : values()) {
if (drugUsageStatus.getStatus().equals(status)) {
return drugUsageStatus;
}
}
throw new IllegalArgumentException("No enum constant with code: " + status);
}
}

@ -2,6 +2,7 @@ package digital.laboratory.platform.imr.interceptor;
import feign.RequestInterceptor; import feign.RequestInterceptor;
import feign.RequestTemplate; import feign.RequestTemplate;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContext;
@ -14,7 +15,7 @@ import org.springframework.security.oauth2.provider.authentication.OAuth2Authent
* 目的是在业务系统中识别用户是谁, 允许或禁止用户进行对应的操作 * 目的是在业务系统中识别用户是谁, 允许或禁止用户进行对应的操作
*/ */
@Slf4j
@Configuration @Configuration
public class FeignOauth2RequestInterceptor implements RequestInterceptor { public class FeignOauth2RequestInterceptor implements RequestInterceptor {
@ -23,12 +24,12 @@ public class FeignOauth2RequestInterceptor implements RequestInterceptor {
@Override @Override
public void apply(RequestTemplate requestTemplate) { public void apply(RequestTemplate requestTemplate) {
System.out.println(String.format("dlp-repository, FeignOauth2RequestInterceptor()...")); log.info(String.format("dlp-repository, FeignOauth2RequestInterceptor()..."));
SecurityContext securityContext = SecurityContextHolder.getContext(); SecurityContext securityContext = SecurityContextHolder.getContext();
Authentication authentication = securityContext.getAuthentication(); Authentication authentication = securityContext.getAuthentication();
if (authentication != null && authentication.getDetails() instanceof OAuth2AuthenticationDetails) { if (authentication != null && authentication.getDetails() instanceof OAuth2AuthenticationDetails) {
OAuth2AuthenticationDetails details = (OAuth2AuthenticationDetails) authentication.getDetails(); OAuth2AuthenticationDetails details = (OAuth2AuthenticationDetails) authentication.getDetails();
System.out.println(String.format("FeignOauth2RequestInterceptor() Authorization, token=%s", details.getTokenValue())); log.info(String.format("FeignOauth2RequestInterceptor() Authorization, token=%s", details.getTokenValue()));
requestTemplate.header(AUTHORIZATION_HEADER, String.format("%s %s", BEARER_TOKEN_TYPE, details.getTokenValue())); requestTemplate.header(AUTHORIZATION_HEADER, String.format("%s %s", BEARER_TOKEN_TYPE, details.getTokenValue()));
} }

@ -1,8 +1,12 @@
package digital.laboratory.platform.imr.mapper; package digital.laboratory.platform.imr.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import digital.laboratory.platform.imr.entity.DrugUsageRecord; import digital.laboratory.platform.imr.entity.DrugUsageRecord;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import digital.laboratory.platform.imr.query.DrugDepotsQuery;
import digital.laboratory.platform.imr.vo.DrugMaterialInfoVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/** /**
* @author ChenJiangBao * @author ChenJiangBao
@ -13,6 +17,8 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface DrugUsageRecordMapper extends BaseMapper<DrugUsageRecord> { public interface DrugUsageRecordMapper extends BaseMapper<DrugUsageRecord> {
IPage<DrugMaterialInfoVO> queryUsageRecordVOPage(IPage<DrugMaterialInfoVO> page, @Param("query") DrugDepotsQuery query);
} }

@ -30,6 +30,9 @@ public class DrugDepotsQuery {
@ApiModelProperty(value = "案件id查询") @ApiModelProperty(value = "案件id查询")
private String caseId; private String caseId;
@ApiModelProperty(value = "状态 0 录入信息 | 3 待入库 | 5 已入库")
private Integer status;
@ApiModelProperty(value = "开始日期") @ApiModelProperty(value = "开始日期")
@JsonFormat(pattern = DateUtils.yyyy_MM_dd) @JsonFormat(pattern = DateUtils.yyyy_MM_dd)
private LocalDate startDate; private LocalDate startDate;

@ -0,0 +1,34 @@
package digital.laboratory.platform.imr.query;
import com.fasterxml.jackson.annotation.JsonFormat;
import digital.laboratory.platform.imr.component.DateUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDate;
/**
* 毒品库领用记录信息查询对象 Query
*/
@Data
@ApiModel(value = "DrugUsageRecordQuery", description = "毒品库领用记录信息查询对象 Query")
public class DrugUsageRecordQuery {
@ApiModelProperty(value = "分页参数,每页多少条, 默认10")
private Long size = 10L;
@ApiModelProperty(value = "分页参数, 当前页, 默认1")
private Long current = 1L;
@ApiModelProperty(value = "关键字,支持 案件名称, 毒品名称")
private String keywords;
@ApiModelProperty(value = "开始日期")
@JsonFormat(pattern = DateUtils.yyyy_MM_dd)
private LocalDate startDate;
@ApiModelProperty(value = "结束日期")
@JsonFormat(pattern = DateUtils.yyyy_MM_dd)
private LocalDate endDate;
}

@ -77,4 +77,11 @@ public interface CommonFeignService {
* @return * @return
*/ */
Map<String, String> remoteUploadFile(MultipartFile file, String path); Map<String, String> remoteUploadFile(MultipartFile file, String path);
/**
* 远程调用柜子里的检材出库
* @param cellId 检材存储的格子id
* @param sampleId 存放的检材id
*/
void remoteCabinetOutbound(String cellId, String sampleId);
} }

@ -3,6 +3,7 @@ package digital.laboratory.platform.imr.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import digital.laboratory.platform.imr.dto.DrugDepotsDTO; import digital.laboratory.platform.imr.dto.DrugDepotsDTO;
import digital.laboratory.platform.imr.dto.DrugMaterialInfoDTO;
import digital.laboratory.platform.imr.entity.DrugCaseInfo; import digital.laboratory.platform.imr.entity.DrugCaseInfo;
import digital.laboratory.platform.imr.query.DrugDepotsQuery; import digital.laboratory.platform.imr.query.DrugDepotsQuery;
import digital.laboratory.platform.imr.vo.DrugCaseInfoVO; import digital.laboratory.platform.imr.vo.DrugCaseInfoVO;

@ -3,6 +3,7 @@ package digital.laboratory.platform.imr.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import digital.laboratory.platform.common.mybatis.security.service.DLPUser; import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
import digital.laboratory.platform.imr.dto.DrugMaterialInfoDTO;
import digital.laboratory.platform.imr.dto.InRepositoryDTO; import digital.laboratory.platform.imr.dto.InRepositoryDTO;
import digital.laboratory.platform.imr.entity.DrugCaseInfo; import digital.laboratory.platform.imr.entity.DrugCaseInfo;
import digital.laboratory.platform.imr.entity.DrugMaterialInfo; import digital.laboratory.platform.imr.entity.DrugMaterialInfo;
@ -76,4 +77,11 @@ public interface DrugMaterialInfoService extends IService<DrugMaterialInfo> {
* @return * @return
*/ */
boolean delete(List<String> ids); boolean delete(List<String> ids);
/**
* 复制检材
* @param dto
* @return
*/
DrugMaterialInfoVO copy(DrugMaterialInfoDTO dto);
} }

@ -1,5 +1,6 @@
package digital.laboratory.platform.imr.service; package digital.laboratory.platform.imr.service;
import digital.laboratory.platform.imr.dto.DrugUsageRecordDTO;
import digital.laboratory.platform.imr.entity.DrugUsageRecord; import digital.laboratory.platform.imr.entity.DrugUsageRecord;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
@ -10,4 +11,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/ */
public interface DrugUsageRecordService extends IService<DrugUsageRecord> { public interface DrugUsageRecordService extends IService<DrugUsageRecord> {
/**
* 毒品检材领用出库
* @param dto
* @return
*/
boolean outbound(DrugUsageRecordDTO dto);
} }

@ -0,0 +1,15 @@
package digital.laboratory.platform.imr.service;
import com.baomidou.mybatisplus.extension.service.IService;
import digital.laboratory.platform.imr.entity.SampleInboundAndOutboundTable;
import digital.laboratory.platform.imr.entity.SampleOutboundRecord;
/**
* 服务类
*
* @author Zhang Xiaolong created at 2023-03-21
* @describe 服务类
*/
public interface SampleOutboundRecordService extends IService<SampleOutboundRecord> {
}

@ -10,8 +10,10 @@ import digital.laboratory.platform.common.feign.RemoteWord2PDFService;
import digital.laboratory.platform.common.oss.service.OssFile; import digital.laboratory.platform.common.oss.service.OssFile;
import digital.laboratory.platform.imr.service.CommonFeignService; import digital.laboratory.platform.imr.service.CommonFeignService;
import digital.laboratory.platform.sys.dto.UserInfo; import digital.laboratory.platform.sys.dto.UserInfo;
import digital.laboratory.platform.sys.entity.CellAndStoreSupplyData;
import digital.laboratory.platform.sys.entity.SysOrg; import digital.laboratory.platform.sys.entity.SysOrg;
import digital.laboratory.platform.sys.entity.SysUser; import digital.laboratory.platform.sys.entity.SysUser;
import digital.laboratory.platform.sys.feign.RemoteCabinetService;
import digital.laboratory.platform.sys.feign.RemoteOrgService; import digital.laboratory.platform.sys.feign.RemoteOrgService;
import digital.laboratory.platform.sys.feign.RemoteUserService; import digital.laboratory.platform.sys.feign.RemoteUserService;
import feign.Response; import feign.Response;
@ -24,10 +26,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.util.Base64; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -46,6 +45,9 @@ public class CommonFeignServiceImpl implements CommonFeignService {
@Resource @Resource
private RemoteWord2PDFService remoteWord2PDFService; private RemoteWord2PDFService remoteWord2PDFService;
@Resource
private RemoteCabinetService remoteCabinetService;
@Resource @Resource
private OssFile ossFile; private OssFile ossFile;
@ -203,4 +205,25 @@ public class CommonFeignServiceImpl implements CommonFeignService {
throw new RuntimeException(failMsg); throw new RuntimeException(failMsg);
} }
} }
/**
* 远程调用柜子里的检材出库
* @param cellId 检材存储的格子id
* @param sampleId 存放的检材id
*/
@Override
public void remoteCabinetOutbound(String cellId, String sampleId) {
ArrayList<String> sampleIds = new ArrayList<>();
CellAndStoreSupplyData cellAndStoreSupplyData = new CellAndStoreSupplyData();
cellAndStoreSupplyData.setCellId(cellId);
cellAndStoreSupplyData.setCellStatus("1");
sampleIds.add(sampleId);
cellAndStoreSupplyData.setStoreSupplyList(sampleIds);
/*
柜子新接口
*/
ArrayList<CellAndStoreSupplyData> supplyData = new ArrayList<>();
supplyData.add(cellAndStoreSupplyData);
remoteCabinetService.takeOrSaveGoodsFromCabinet(supplyData, -1);
}
} }

@ -1,13 +1,16 @@
package digital.laboratory.platform.imr.service.impl; package digital.laboratory.platform.imr.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import digital.laboratory.platform.common.core.exception.ValidateCodeException;
import digital.laboratory.platform.imr.convert.DrugCaseInfoConvert; import digital.laboratory.platform.imr.convert.DrugCaseInfoConvert;
import digital.laboratory.platform.imr.convert.DrugMaterialInfoConvert; import digital.laboratory.platform.imr.convert.DrugMaterialInfoConvert;
import digital.laboratory.platform.imr.dto.DrugDepotsDTO; import digital.laboratory.platform.imr.dto.DrugDepotsDTO;
import digital.laboratory.platform.imr.dto.DrugMaterialInfoDTO;
import digital.laboratory.platform.imr.entity.DrugCaseInfo; import digital.laboratory.platform.imr.entity.DrugCaseInfo;
import digital.laboratory.platform.imr.entity.DrugMaterialInfo; import digital.laboratory.platform.imr.entity.DrugMaterialInfo;
import digital.laboratory.platform.imr.mapper.DrugCaseInfoMapper; import digital.laboratory.platform.imr.mapper.DrugCaseInfoMapper;
@ -19,10 +22,12 @@ import digital.laboratory.platform.imr.service.DrugMaterialInfoService;
import digital.laboratory.platform.imr.vo.DrugCaseInfoVO; import digital.laboratory.platform.imr.vo.DrugCaseInfoVO;
import digital.laboratory.platform.imr.vo.DrugMaterialInfoVO; import digital.laboratory.platform.imr.vo.DrugMaterialInfoVO;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.sql.SQLIntegrityConstraintViolationException;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -54,7 +59,7 @@ public class DrugCaseInfoServiceImpl extends ServiceImpl<DrugCaseInfoMapper, Dru
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public List<DrugMaterialInfoVO> save(DrugDepotsDTO dto) { public List<DrugMaterialInfoVO> save(DrugDepotsDTO dto) {
DrugCaseInfo drugCaseInfo = DrugCaseInfoConvert.dtoTOEntity(dto); DrugCaseInfo drugCaseInfo = DrugCaseInfoConvert.dtoTOEntity(dto);
boolean flag = false; boolean flag = true;
if (StrUtil.isBlank(drugCaseInfo.getId())) { if (StrUtil.isBlank(drugCaseInfo.getId())) {
if (super.save(drugCaseInfo)) { if (super.save(drugCaseInfo)) {
// 保存毒品检材 // 保存毒品检材
@ -69,10 +74,14 @@ public class DrugCaseInfoServiceImpl extends ServiceImpl<DrugCaseInfoMapper, Dru
List<DrugMaterialInfo> saveList = drugMaterialInfos.stream().filter(o -> StrUtil.isBlank(o.getId())).collect(Collectors.toList()); List<DrugMaterialInfo> saveList = drugMaterialInfos.stream().filter(o -> StrUtil.isBlank(o.getId())).collect(Collectors.toList());
List<DrugMaterialInfo> updateList = drugMaterialInfos.stream().filter(o -> StrUtil.isNotBlank(o.getId())).collect(Collectors.toList()); List<DrugMaterialInfo> updateList = drugMaterialInfos.stream().filter(o -> StrUtil.isNotBlank(o.getId())).collect(Collectors.toList());
// 直接更新 // 直接更新
if (CollUtil.isNotEmpty(updateList)) {
flag = drugMaterialInfoService.updateBatchById(updateList); flag = drugMaterialInfoService.updateBatchById(updateList);
}
if (CollUtil.isNotEmpty(saveList)) {
flag = drugMaterialInfoService.saveDrugMaterialBatch(saveList, drugCaseInfo); flag = drugMaterialInfoService.saveDrugMaterialBatch(saveList, drugCaseInfo);
} }
} }
}
if (flag) { if (flag) {
return drugMaterialInfoMapper.getDrugMaterialVO(Wrappers.<DrugMaterialInfo>lambdaQuery().eq(DrugMaterialInfo::getCaseId, dto.getId())); return drugMaterialInfoMapper.getDrugMaterialVO(Wrappers.<DrugMaterialInfo>lambdaQuery().eq(DrugMaterialInfo::getCaseId, dto.getId()));
} }
@ -99,9 +108,20 @@ public class DrugCaseInfoServiceImpl extends ServiceImpl<DrugCaseInfoMapper, Dru
@Override @Override
public DrugCaseInfo drugCaseSave(DrugDepotsDTO dto) { public DrugCaseInfo drugCaseSave(DrugDepotsDTO dto) {
DrugCaseInfo drugCaseInfo = DrugCaseInfoConvert.dtoTOEntity(dto); DrugCaseInfo drugCaseInfo = DrugCaseInfoConvert.dtoTOEntity(dto);
try {
super.save(drugCaseInfo); super.save(drugCaseInfo);
} catch (DataIntegrityViolationException e) {
// 检查是否是唯一约束违规异常并抛出自定义异常
Throwable cause = e.getCause();
if (cause instanceof SQLIntegrityConstraintViolationException
&& cause.getMessage().contains("Duplicate entry")) {
throw new ValidateCodeException("案件编号已经存在: " + dto.getCaseNo());
}
throw e; // 其他异常继续向上抛出
}
return drugCaseInfo; return drugCaseInfo;
} }
} }

@ -11,6 +11,8 @@ import digital.laboratory.platform.common.core.constant.CommonConstants;
import digital.laboratory.platform.common.core.exception.ValidateCodeException; import digital.laboratory.platform.common.core.exception.ValidateCodeException;
import digital.laboratory.platform.common.feign.RemoteTemplate2htmlService; import digital.laboratory.platform.common.feign.RemoteTemplate2htmlService;
import digital.laboratory.platform.common.mybatis.security.service.DLPUser; import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
import digital.laboratory.platform.imr.convert.DrugMaterialInfoConvert;
import digital.laboratory.platform.imr.dto.DrugMaterialInfoDTO;
import digital.laboratory.platform.imr.dto.InRepositoryDTO; import digital.laboratory.platform.imr.dto.InRepositoryDTO;
import digital.laboratory.platform.imr.entity.*; import digital.laboratory.platform.imr.entity.*;
import digital.laboratory.platform.imr.enums.DrugMaterialStatus; import digital.laboratory.platform.imr.enums.DrugMaterialStatus;
@ -106,6 +108,32 @@ public class DrugMaterialInfoServiceImpl extends ServiceImpl<DrugMaterialInfoMap
return super.saveBatch(drugMaterialInfos); return super.saveBatch(drugMaterialInfos);
} }
/**
* 复制检材
* @param dto
* @return
*/
@Override
public DrugMaterialInfoVO copy(DrugMaterialInfoDTO dto) {
DrugMaterialInfo drugMaterialInfo = DrugMaterialInfoConvert.dtoToEntity(dto);
if (super.count(Wrappers.<DrugMaterialInfo>lambdaQuery().eq(DrugMaterialInfo::getCaseId, dto.getCaseId())) == 0) {
// 如果当前案件是第一次保存检材,则都保存当前检材和复制的检材
super.save(drugMaterialInfo);
}
// drugMaterialInfo = DrugMaterialInfoConvert.dtoToEntity(dto);
drugMaterialInfo.setId(null);
super.save(drugMaterialInfo);
List<DrugMaterialInfoVO> drugMaterialInfoVOS = baseMapper.getDrugMaterialVO(Wrappers.<DrugMaterialInfo>lambdaQuery()
.eq(DrugMaterialInfo::getId, drugMaterialInfo.getId()));
// 检查是否获取到 VO
if (!drugMaterialInfoVOS.isEmpty()) {
return drugMaterialInfoVOS.get(0);
} else {
// 处理未找到 VO 的情况
throw new RuntimeException("Failed to retrieve the DrugMaterialInfoVO for the saved record.");
}
}
/** /**
* 分页查询毒品库中的毒品检材信息VO列表 * 分页查询毒品库中的毒品检材信息VO列表
* *
@ -153,15 +181,17 @@ public class DrugMaterialInfoServiceImpl extends ServiceImpl<DrugMaterialInfoMap
.in("drug_no", .in("drug_no",
sample.stream().map(InRepositoryDTO::getSampleNo).collect(Collectors.toList())) sample.stream().map(InRepositoryDTO::getSampleNo).collect(Collectors.toList()))
.eq("dm.status", DrugMaterialStatus.ENTER_DRUG_INFO.getStatus())); // 状态为为未入库的 .eq("dm.status", DrugMaterialStatus.ENTER_DRUG_INFO.getStatus())); // 状态为为未入库的
if (CollUtil.isEmpty(drugMaterialInfoVOS)) {
return Collections.emptyList();
}
Map<String, DrugMaterialInfoVO> drugMaterialInfoVOMap = drugMaterialInfoVOS.stream() Map<String, DrugMaterialInfoVO> drugMaterialInfoVOMap = drugMaterialInfoVOS.stream()
.collect(Collectors.toMap(DrugMaterialInfoVO::getDrugNo, Function.identity())); .collect(Collectors.toMap(DrugMaterialInfoVO::getDrugNo, Function.identity()));
// 待操作的毒品检材id列表 // 待操作的毒品检材id列表
List<String> waitOpDrugIds = drugMaterialInfoVOS.stream().map(DrugMaterialInfoVO::getId).collect(Collectors.toList()); List<String> waitOpDrugIds = drugMaterialInfoVOS.stream().map(DrugMaterialInfoVO::getId).collect(Collectors.toList());
Map<String, SampleStorage> sampleStorageMap = sampleStorageMapper List<SampleStorage> sampleStorages = sampleStorageMapper.selectList(Wrappers.<SampleStorage>lambdaQuery()
.selectList(Wrappers.<SampleStorage>lambdaQuery() .in(SampleStorage::getSampleId, waitOpDrugIds));
.in(SampleStorage::getSampleId, Map<String, SampleStorage> sampleStorageMap = CollUtil.isEmpty(sampleStorages) ?
waitOpDrugIds)) new HashMap<>() : sampleStorages.stream().collect(Collectors.toMap(SampleStorage::getSampleId, Function.identity()));
.stream().collect(Collectors.toMap(SampleStorage::getSampleId, Function.identity()));
// 存储需要批量保存的实体信息 // 存储需要批量保存的实体信息
List<SampleStorage> updateSampleStorageList = new ArrayList<>(); List<SampleStorage> updateSampleStorageList = new ArrayList<>();
List<SampleStorage> saveSampleStorageList = new ArrayList<>(); List<SampleStorage> saveSampleStorageList = new ArrayList<>();
@ -254,7 +284,8 @@ public class DrugMaterialInfoServiceImpl extends ServiceImpl<DrugMaterialInfoMap
} }
List<DrugMaterialInfo> drugMaterialInfos = super.list(Wrappers.<DrugMaterialInfo>lambdaQuery().in(DrugMaterialInfo::getId, ids)); List<DrugMaterialInfo> drugMaterialInfos = super.list(Wrappers.<DrugMaterialInfo>lambdaQuery().in(DrugMaterialInfo::getId, ids));
for (DrugMaterialInfo drugMaterialInfo : drugMaterialInfos) { for (DrugMaterialInfo drugMaterialInfo : drugMaterialInfos) {
if (!drugMaterialInfo.getStatus().equals(DrugMaterialStatus.ENTER_DRUG_INFO.getStatus())) { if (!drugMaterialInfo.getStatus().equals(DrugMaterialStatus.ENTER_DRUG_INFO.getStatus())
&& !drugMaterialInfo.getStatus().equals(DrugMaterialStatus.WAIT_INBOUND.getStatus())) {
throw new ValidateCodeException(String.format("检材编号为 %s 的检材不在可删除状态,不能删除!", drugMaterialInfo.getDrugNo())); throw new ValidateCodeException(String.format("检材编号为 %s 的检材不在可删除状态,不能删除!", drugMaterialInfo.getDrugNo()));
} }
} }

@ -1,10 +1,27 @@
package digital.laboratory.platform.imr.service.impl; package digital.laboratory.platform.imr.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import digital.laboratory.platform.imr.entity.DrugUsageRecord; import digital.laboratory.platform.common.core.exception.ValidateCodeException;
import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
import digital.laboratory.platform.common.security.util.SecurityUtils;
import digital.laboratory.platform.imr.convert.DrugUsageRecordConvert;
import digital.laboratory.platform.imr.dto.DrugUsageRecordDTO;
import digital.laboratory.platform.imr.entity.*;
import digital.laboratory.platform.imr.enums.DrugMaterialStatus;
import digital.laboratory.platform.imr.enums.DrugUsageStatus;
import digital.laboratory.platform.imr.enums.OutboundType;
import digital.laboratory.platform.imr.mapper.DrugUsageRecordMapper; import digital.laboratory.platform.imr.mapper.DrugUsageRecordMapper;
import digital.laboratory.platform.imr.service.DrugUsageRecordService; import digital.laboratory.platform.imr.service.*;
import digital.laboratory.platform.imr.vo.DrugMaterialInfoVO;
import digital.laboratory.platform.sys.entity.Drug;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;
/** /**
* @author ChenJiangBao * @author ChenJiangBao
@ -15,6 +32,98 @@ import org.springframework.stereotype.Service;
public class DrugUsageRecordServiceImpl extends ServiceImpl<DrugUsageRecordMapper, DrugUsageRecord> public class DrugUsageRecordServiceImpl extends ServiceImpl<DrugUsageRecordMapper, DrugUsageRecord>
implements DrugUsageRecordService{ implements DrugUsageRecordService{
@Resource
private DrugMaterialInfoService drugMaterialInfoService;
@Resource
private SampleStorageService sampleStorageService;
@Resource
private CommonFeignService commonFeignService;
@Resource
private SampleOutboundRecordService sampleOutboundRecordService;
@Resource
private SampleInboundAndOutboundTableService sampleInboundAndOutboundTableService;
/**
* 毒品检材领用出库
* @param dto
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public boolean outbound(DrugUsageRecordDTO dto) {
List<String> drugIds = dto.getDrugIds();
String usagePurpose = dto.getUsagePurpose();
LocalDateTime usageDate = dto.getUsageDate();
// 判断当前需要领用的检材是否都可以出库
List<DrugMaterialInfo> drugMaterialInfos = drugMaterialInfoService.list(Wrappers.<DrugMaterialInfo>lambdaQuery().in(DrugMaterialInfo::getId, drugIds));
for (DrugMaterialInfo drugMaterialInfo : drugMaterialInfos) {
if (!drugMaterialInfo.getStatus().equals(DrugMaterialStatus.FINISH_INBOUND.getStatus())) {
throw new ValidateCodeException(String.format("毒品检材编号为 %s 的检材不在可以出库的状态!", drugMaterialInfo.getDrugNo()));
}
}
// 校验通过,保存领用出库记录
DLPUser user = SecurityUtils.getUser();
DrugUsageRecord drugUsageRecord = DrugUsageRecordConvert.dtoToEntity(dto);
drugUsageRecord.setApplicant(user.getId());
drugUsageRecord.setApplicantName(user.getName());
drugUsageRecord.setUsageName(drugMaterialInfos.stream().map(DrugMaterialInfo::getDrugName).collect(Collectors.joining(",")));
if (super.save(drugUsageRecord)) {
// 移除柜子系统中关联的id, 获取格子id
List<SampleStorage> sampleStorageList = sampleStorageService.list(Wrappers.<SampleStorage>lambdaQuery().in(SampleStorage::getSampleId, drugIds));
// 更新样本仓库状态为已出库
sampleStorageService.update(Wrappers.<SampleStorage>lambdaUpdate()
.in(SampleStorage::getSampleId, drugIds)
.set(SampleStorage::getStatus, 3)
.set(SampleStorage::getReturnTime, null)
.set(SampleStorage::getIsReturn, 1)
.set(SampleStorage::getRecipientId, user.getId())
.set(SampleStorage::getOutRepositoryDate, usageDate)
.set(SampleStorage::getPurpose, usagePurpose)
);
// 修改样本出入库登记表
sampleInboundAndOutboundTableService.update(Wrappers.<SampleInboundAndOutboundTable>lambdaUpdate()
.in(SampleInboundAndOutboundTable::getSampleId, drugIds)
.isNull(SampleInboundAndOutboundTable::getAppraiserId)
.set(SampleInboundAndOutboundTable::getAppraiserId, user.getId())
.set(SampleInboundAndOutboundTable::getOutWarehouseDate, usageDate)
.set(SampleInboundAndOutboundTable::getRemarks, usagePurpose)
.set(SampleInboundAndOutboundTable::getReturnTime, null)
.set(SampleInboundAndOutboundTable::getOutboundSupervisor, null)
);
//添加样本出库记录
// List<SampleOutboundRecord> sampleOutboundRecordList = sampleStorageList.parallelStream().map(sampleStorage -> {
// SampleOutboundRecord sampleOutboundRecord = new SampleOutboundRecord();
// sampleOutboundRecord.setSampleId(sampleStorage.getSampleId());
// sampleOutboundRecord.setOutboundType(OutboundType.USE);//领用出库
// sampleOutboundRecord.setRecipientId(user.getId());//领取人
// sampleOutboundRecord.setName(sampleStorage.getName());//样本名称--方便搜索
// sampleOutboundRecord.setReason(usagePurpose);//把出库原因设置为备注
// sampleOutboundRecord.setOutboundDate(usageDate);//出库时间
//
// // 从格子中出库
// commonFeignService.remoteCabinetOutbound(sampleStorage.getStorageCellId(), sampleStorage.getSampleId());
// return sampleOutboundRecord;
// }).collect(Collectors.toList());
// sampleOutboundRecordService.saveBatch(sampleOutboundRecordList);
sampleStorageList.parallelStream().forEach(sampleStorage -> {
// 从格子中出库
commonFeignService.remoteCabinetOutbound(sampleStorage.getStorageCellId(), sampleStorage.getSampleId());
});
// 更新毒品检材状态为已经出库
drugMaterialInfoService.update(Wrappers.<DrugMaterialInfo>lambdaUpdate()
.in(DrugMaterialInfo::getId, drugIds)
.set(DrugMaterialInfo::getStatus, DrugMaterialStatus.OUTBOUND.getStatus())
);
return true;
}
return false;
}
} }

@ -17,6 +17,7 @@ import digital.laboratory.platform.imr.enums.OutboundType;
import digital.laboratory.platform.imr.feign.TransferFeignService; import digital.laboratory.platform.imr.feign.TransferFeignService;
import digital.laboratory.platform.imr.feign.dto.UpdateHolderDTO; import digital.laboratory.platform.imr.feign.dto.UpdateHolderDTO;
import digital.laboratory.platform.imr.mapper.*; import digital.laboratory.platform.imr.mapper.*;
import digital.laboratory.platform.imr.service.CommonFeignService;
import digital.laboratory.platform.imr.service.SampleOutWarehouseApplyService; import digital.laboratory.platform.imr.service.SampleOutWarehouseApplyService;
import digital.laboratory.platform.imr.vo.BaseSampleDetail; import digital.laboratory.platform.imr.vo.BaseSampleDetail;
import digital.laboratory.platform.imr.vo.CellVO; import digital.laboratory.platform.imr.vo.CellVO;
@ -48,7 +49,7 @@ public class SampleOutWarehouseApplyServiceImpl extends ServiceImpl<SampleOutWar
private final RemoteTemplate2htmlService remoteTemplate2htmlService; private final RemoteTemplate2htmlService remoteTemplate2htmlService;
private final RemoteCabinetService cabinetService; private final CommonFeignService commonFeignService;
private final SampleOutWarehouseApplyMapper sawMapper; private final SampleOutWarehouseApplyMapper sawMapper;
@ -368,20 +369,7 @@ public class SampleOutWarehouseApplyServiceImpl extends ServiceImpl<SampleOutWar
//8.柜子出库 //8.柜子出库
commonFeignService.remoteCabinetOutbound(storage.getStorageCellId(), storage.getSampleId());
ArrayList<String> sampleIds = new ArrayList<>();
CellAndStoreSupplyData cellAndStoreSupplyData = new CellAndStoreSupplyData();
cellAndStoreSupplyData.setCellId(storage.getStorageCellId());
cellAndStoreSupplyData.setCellStatus("1");
sampleIds.add(storage.getSampleId());
cellAndStoreSupplyData.setStoreSupplyList(sampleIds);
/*
柜子新接口
*/
ArrayList<CellAndStoreSupplyData> supplyData = new ArrayList<>();
supplyData.add(cellAndStoreSupplyData);
cabinetService.takeOrSaveGoodsFromCabinet(supplyData, -1);
} }
return this.getOutWarehouseDetailedById(selectOne.getId()); return this.getOutWarehouseDetailedById(selectOne.getId());
} }

@ -0,0 +1,11 @@
package digital.laboratory.platform.imr.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import digital.laboratory.platform.imr.entity.SampleOutboundRecord;
import digital.laboratory.platform.imr.mapper.SampleOutboundRecordMapper;
import digital.laboratory.platform.imr.service.SampleOutboundRecordService;
import org.springframework.stereotype.Service;
@Service
public class SampleOutboundRecordServiceImpl extends ServiceImpl<SampleOutboundRecordMapper, SampleOutboundRecord> implements SampleOutboundRecordService {
}

@ -34,6 +34,9 @@ public class DrugMaterialInfoVO {
@ApiModelProperty("关联的入库记录id") @ApiModelProperty("关联的入库记录id")
private String sampleStorageId; private String sampleStorageId;
@ApiModelProperty("柜子id")
private String canineId;
@ApiModelProperty("存放位置") @ApiModelProperty("存放位置")
private String storageLocation; private String storageLocation;

@ -0,0 +1,63 @@
package digital.laboratory.platform.imr.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import digital.laboratory.platform.imr.component.DateUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import java.time.LocalDateTime;
import java.util.List;
/**
* 毒品检材的领用归还记录表 VO类
* @TableName b_drug_usage_record
*/
@Data
@ApiModel(value = "DrugUsageRecordVO", description = "毒品检材的领用归还记录表 VO类")
public class DrugUsageRecordVO {
@ApiModelProperty("主键id")
private String id;
/**
* 关联领用的毒品id
*/
@ApiModelProperty("关联领用的毒品id")
private List<String> drugIds;
/**
* 领用物品名称
*/
@ApiModelProperty("领用物品名称")
private String usageName;
/**
* 领用时间
*/
@ApiModelProperty("领用时间")
@JsonFormat(pattern = DateUtils.yyyy_MM_dd_HH_mm_ss, timezone = DateUtils.TIME_ZONE)
private LocalDateTime usageDate;
/**
* 领用目的
*/
@ApiModelProperty("领用目的")
private String usagePurpose;
/**
* 领用申请人
*/
@ApiModelProperty("领用申请人id")
private String applicant;
/**
* 领用申请人姓名
*/
@ApiModelProperty("领用申请人姓名")
private String applicantName;
@ApiModelProperty("领用的毒品检材详情信息列表")
private List<DrugMaterialInfoVO> drugMaterialInfoVOList;
}

@ -34,7 +34,8 @@
dc.handing_over_org, dc.handing_over_org,
dc.handing_over_date, dc.handing_over_date,
ss.id as sampleStorageId, ss.id as sampleStorageId,
ss.storage_location ss.storage_location,
ss.box_id as canineId
FROM b_drug_material_info dm FROM b_drug_material_info dm
LEFT JOIN b_drug_case_info dc ON dm.case_id = dc.id 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 LEFT JOIN b_sample_storage ss ON dm.id = ss.sample_id
@ -54,6 +55,9 @@
<if test="query.caseId != null and query.caseId != ''"> <if test="query.caseId != null and query.caseId != ''">
AND dm.case_id = #{query.caseId} AND dm.case_id = #{query.caseId}
</if> </if>
<if test="query.caseId != null">
AND dm.status = #{query.status}
</if>
<if test="query.startDate != null"> <if test="query.startDate != null">
AND dc.handing_over_date &gt;= #{query.startDate} AND dc.handing_over_date &gt;= #{query.startDate}
</if> </if>

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="digital.laboratory.platform.imr.mapper.DrugUsageRecordMapper">
<resultMap id="BaseResultMap" type="digital.laboratory.platform.imr.entity.DrugUsageRecord">
<id property="id" column="id" jdbcType="VARCHAR"/>
<result property="drugId" column="drug_id" jdbcType="VARCHAR"/>
<result property="applicant" column="applicant" jdbcType="VARCHAR"/>
<result property="applicantName" column="applicant_name" jdbcType="VARCHAR"/>
<result property="usageDate" column="usage_date" jdbcType="TIMESTAMP"/>
<result property="usageName" column="usage_name" jdbcType="TIMESTAMP"/>
<result property="usagePurpose" column="usage_purpose" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
id,drug_id,applicant,applicant_name,
usage_date,usage_purpose,
create_time,update_time,
create_by,update_by
</sql>
<select id="queryUsageRecordVOPage">
SELECT
<include refid="Base_Column_List"/>
FROM b_drug_usage_record du
<where>
<if test="query.keywords != null and query.keywords != ''">
OR du.applicant_name = #{query.keywords}
</if>
<if test="query.startDate != null">
AND du.usage_date &gt;= #{query.startDate}
</if>
<if test="query.endDate != null">
AND du.usage_date &lt;= #{query.endDate}
</if>
</where>
ORDER BY du.usage_date DESC
</select>
</mapper>
Loading…
Cancel
Save