parent
306139c1f9
commit
48b5d73bbf
@ -0,0 +1,71 @@ |
||||
package digital.laboratory.platform.entrustment.controller; |
||||
|
||||
import cn.hutool.core.collection.CollUtil; |
||||
import digital.laboratory.platform.common.core.exception.CheckedException; |
||||
import digital.laboratory.platform.common.core.util.R; |
||||
import digital.laboratory.platform.entrustment.convert.EntrustMaterialCheckoutResultConvert; |
||||
import digital.laboratory.platform.entrustment.dto.EntrustMaterialCheckoutResultDTO; |
||||
import digital.laboratory.platform.entrustment.service.EntrustMaterialCheckoutResultService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import lombok.RequiredArgsConstructor; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import javax.annotation.Resource; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
import java.io.IOException; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 委托检材--检出定性定量结果信息 |
||||
* |
||||
* @author chenjiangbao |
||||
* @describe 委托检材--检出定性定量结果信息相关接口 前端控制器 |
||||
*/ |
||||
@RestController |
||||
@RequiredArgsConstructor |
||||
@RequestMapping("/papp/checkoutResult") |
||||
@Api(tags = "017-委托检材--检出定性定量结果信息相关接口") |
||||
public class EntrustMaterialCheckoutResultController { |
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(EntrustMaterialCheckoutResultController.class); |
||||
@Resource |
||||
private EntrustMaterialCheckoutResultService entrustMaterialCheckoutResultService; |
||||
|
||||
@ApiOperation("查询检出得定性定量结果") |
||||
@GetMapping("/query") |
||||
public R query(@RequestParam("id") String id) { |
||||
return R.ok( |
||||
EntrustMaterialCheckoutResultConvert.entityToVO(entrustMaterialCheckoutResultService.getById(id)), |
||||
"查询检出得定性定量结果成功!" |
||||
); |
||||
} |
||||
|
||||
@ApiOperation("保存检出得定性定量结果") |
||||
@PostMapping("/save") |
||||
public R save(@RequestBody EntrustMaterialCheckoutResultDTO dto) { |
||||
boolean success = false; |
||||
try { |
||||
success = entrustMaterialCheckoutResultService.save(dto); |
||||
} catch (CheckedException e) { |
||||
return R.failed(e.getMessage()); |
||||
} |
||||
return success ? R.ok("保存检出得定性定量结果成功!") : R.ok("保存检出得定性定量结果失败!"); |
||||
} |
||||
|
||||
@ApiOperation("导出检材检出结果的excel表格") |
||||
@PostMapping("/exportExcel") |
||||
public void exportExcel(@RequestBody List<String> entrustIds, HttpServletResponse response) { |
||||
if (CollUtil.isEmpty(entrustIds)) { |
||||
throw new CheckedException("请选择要导出的委托检出结果信息!"); |
||||
} |
||||
try { |
||||
entrustMaterialCheckoutResultService.exportExcel(entrustIds, response); |
||||
} catch (IOException e) { |
||||
throw new CheckedException("导出excel失败!"); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,37 @@ |
||||
package digital.laboratory.platform.entrustment.convert; |
||||
|
||||
import cn.hutool.core.util.StrUtil; |
||||
import digital.laboratory.platform.entrustment.dto.EntrustMaterialCheckoutResultDTO; |
||||
import digital.laboratory.platform.entrustment.entity.EntrustMaterialCheckoutResult; |
||||
import digital.laboratory.platform.entrustment.vo.EntrustMaterialCheckoutResultVO; |
||||
|
||||
import java.util.stream.Collectors; |
||||
|
||||
/** |
||||
* 托检材--检出定性定量结果信息 转换类 |
||||
*/ |
||||
public class EntrustMaterialCheckoutResultConvert { |
||||
|
||||
public static EntrustMaterialCheckoutResult dtoToEntity(EntrustMaterialCheckoutResultDTO dto) { |
||||
if (dto == null) return null; |
||||
EntrustMaterialCheckoutResult entrustMaterialCheckoutResult = new EntrustMaterialCheckoutResult(); |
||||
entrustMaterialCheckoutResult.setQualitativeResult(dto.getQualitativeResult()); |
||||
entrustMaterialCheckoutResult.setQuantitativeResult(dto.getQuantitativeResult().stream().collect(Collectors.joining("、"))); |
||||
entrustMaterialCheckoutResult.setOtherResult(dto.getOtherResult()); |
||||
entrustMaterialCheckoutResult.setCheckoutRemark(dto.getCheckoutRemark()); |
||||
return entrustMaterialCheckoutResult; |
||||
|
||||
} |
||||
|
||||
public static EntrustMaterialCheckoutResultVO entityToVO(EntrustMaterialCheckoutResult entity) { |
||||
if (entity == null) return new EntrustMaterialCheckoutResultVO(); |
||||
EntrustMaterialCheckoutResultVO vo = new EntrustMaterialCheckoutResultVO(); |
||||
vo.setId(entity.getId()); |
||||
vo.setQualitativeResult(entity.getQualitativeResult()); |
||||
vo.setQuantitativeResult(StrUtil.split(entity.getQuantitativeResult(), "、")); |
||||
vo.setOtherResult(entity.getOtherResult()); |
||||
vo.setCheckoutRemark(entity.getCheckoutRemark()); |
||||
return vo; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,71 @@ |
||||
package digital.laboratory.platform.entrustment.dto; |
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty; |
||||
import digital.laboratory.platform.sys.entity.DrugLite; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import java.time.LocalDateTime; |
||||
import java.util.List; |
||||
|
||||
@Data |
||||
@ApiModel(value = "CheckoutResultExcelDTO", description = "存储要导出的检出结果excel数据DTO对象") |
||||
public class CheckoutResultExcelDTO { |
||||
|
||||
@ApiModelProperty("序号") |
||||
@ExcelProperty("序号") |
||||
private Integer order; |
||||
|
||||
@ApiModelProperty("送检日期") |
||||
@ExcelProperty("送检日期") |
||||
private String deliverTime; |
||||
|
||||
@ApiModelProperty("送检单位") |
||||
@ExcelProperty("送检单位") |
||||
private String clientOrgName; |
||||
|
||||
@ApiModelProperty("检材采集地-省") |
||||
@ExcelProperty(value = "检材采集地", index = 3) |
||||
private String provinceCollectPlace; |
||||
|
||||
@ApiModelProperty("检材采集地-市") |
||||
@ExcelProperty(value = "检材采集地", index = 4) |
||||
private String cityCollectPlace; |
||||
|
||||
@ApiModelProperty(value="受理编号") |
||||
@ExcelProperty("受理编号") |
||||
private String acceptNo; |
||||
|
||||
@ApiModelProperty(value = "委托检材顺序号,由系统根据录入顺序生成") |
||||
@ExcelProperty("检材编号") |
||||
private Integer orderNo; |
||||
|
||||
@ApiModelProperty(value = "检材类别名称:继承所取物证的类别或从物证类别选择") |
||||
@ExcelProperty("检材类型") |
||||
private String typeName; |
||||
|
||||
@ApiModelProperty(value = "检材颜色:继承所取物证颜色或手动填入") |
||||
@ExcelProperty("检材颜色") |
||||
private String color; |
||||
|
||||
@ApiModelProperty(value = "检材性状名称:继承所取物证性状或从物证性状类别选择") |
||||
@ExcelProperty("检材形态") |
||||
private String formName; |
||||
|
||||
@ApiModelProperty("定性结果") |
||||
@ExcelProperty("定性结果") |
||||
private String qualitativeResult; |
||||
|
||||
@ApiModelProperty("定量结果") |
||||
@ExcelProperty("定量结果") |
||||
private String quantitativeResult; |
||||
|
||||
@ApiModelProperty("其他鉴定结果") |
||||
@ExcelProperty("其他鉴定结果") |
||||
private String otherResult; |
||||
|
||||
@ApiModelProperty("备注") |
||||
@ExcelProperty("备注") |
||||
private String remark; |
||||
} |
@ -0,0 +1,60 @@ |
||||
package digital.laboratory.platform.entrustment.dto; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler; |
||||
import digital.laboratory.platform.common.mybatis.base.BaseEntity; |
||||
import digital.laboratory.platform.sys.entity.DrugLite; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import lombok.Data; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 委托检材--检出定性定量结果信息 |
||||
* @TableName b_entrust_material_checkout_result |
||||
*/ |
||||
@Data |
||||
@ApiModel(value = "EntrustMaterialCheckoutResultDTO", description = "委托检材--检出定性定量结果信息DTO") |
||||
public class EntrustMaterialCheckoutResultDTO { |
||||
/** |
||||
* 委托检材id |
||||
*/ |
||||
@ApiModelProperty("委托检材id列表, 支持批量") |
||||
private List<String> ids; |
||||
|
||||
/** |
||||
* 委托检材id |
||||
*/ |
||||
@ApiModelProperty("委托id") |
||||
private String entrustId; |
||||
|
||||
/** |
||||
* 定性结果 |
||||
*/ |
||||
@ApiModelProperty("定性结果") |
||||
private List<DrugLite> qualitativeResult; |
||||
|
||||
/** |
||||
* 定量结果 |
||||
*/ |
||||
@ApiModelProperty("定量结果") |
||||
private List<String> quantitativeResult; |
||||
|
||||
/** |
||||
* 其他鉴定结果 |
||||
*/ |
||||
@ApiModelProperty("其他鉴定结果") |
||||
private String otherResult; |
||||
|
||||
/** |
||||
* 检出结果的备注信息 |
||||
*/ |
||||
@ApiModelProperty("检出结果的备注信息") |
||||
private String checkoutRemark; |
||||
|
||||
} |
@ -0,0 +1,51 @@ |
||||
package digital.laboratory.platform.entrustment.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler; |
||||
import digital.laboratory.platform.common.mybatis.base.BaseEntity; |
||||
import digital.laboratory.platform.sys.entity.DrugLite; |
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 委托检材--检出定性定量结果信息 |
||||
* @TableName b_entrust_material_checkout_result |
||||
*/ |
||||
@TableName(value ="b_entrust_material_checkout_result", autoResultMap = true) |
||||
@Data |
||||
public class EntrustMaterialCheckoutResult extends BaseEntity { |
||||
/** |
||||
* 委托检材id |
||||
*/ |
||||
@TableId(value = "entrust_material_id", type = IdType.ASSIGN_ID) |
||||
private String id; |
||||
|
||||
/** |
||||
* 定性结果 |
||||
*/ |
||||
@TableField(typeHandler = FastjsonTypeHandler.class) |
||||
private List<DrugLite> qualitativeResult; |
||||
|
||||
/** |
||||
* 定量结果 |
||||
*/ |
||||
private String quantitativeResult; |
||||
|
||||
/** |
||||
* 其他鉴定结果 |
||||
*/ |
||||
private String otherResult; |
||||
|
||||
/** |
||||
* 检出结果的备注信息 |
||||
*/ |
||||
private String checkoutRemark; |
||||
|
||||
@TableField(exist = false) |
||||
private static final long serialVersionUID = 1L; |
||||
} |
@ -0,0 +1,20 @@ |
||||
package digital.laboratory.platform.entrustment.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import digital.laboratory.platform.entrustment.entity.EntrustMaterialCheckoutResult; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
/** |
||||
* @author ChenJiangBao |
||||
* @description 针对表【b_entrust_material_checkout_result(委托检材--检出定性定量结果信息)】的数据库操作Mapper |
||||
* @createDate 2024-12-30 16:16:25 |
||||
* @Entity generator.entity.EntrustMaterialCheckoutResult |
||||
*/ |
||||
@Mapper |
||||
public interface EntrustMaterialCheckoutResultMapper extends BaseMapper<EntrustMaterialCheckoutResult> { |
||||
|
||||
} |
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,33 @@ |
||||
package digital.laboratory.platform.entrustment.service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import digital.laboratory.platform.entrustment.dto.EntrustMaterialCheckoutResultDTO; |
||||
import digital.laboratory.platform.entrustment.entity.EntrustMaterialCheckoutResult; |
||||
|
||||
import javax.servlet.http.HttpServletResponse; |
||||
import java.io.IOException; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author ChenJiangBao |
||||
* @description 针对表【b_entrust_material_checkout_result(委托检材--检出定性定量结果信息)】的数据库操作Service |
||||
* @createDate 2024-12-30 16:16:25 |
||||
*/ |
||||
public interface EntrustMaterialCheckoutResultService extends IService<EntrustMaterialCheckoutResult> { |
||||
|
||||
/** |
||||
* 根据DTO保存检材得检出结果信息 |
||||
* @param dto 检出DTO |
||||
* @return |
||||
*/ |
||||
boolean save(EntrustMaterialCheckoutResultDTO dto); |
||||
|
||||
/** |
||||
* 根据委托id导出检出结果excel文件 |
||||
* |
||||
* @param entrustIds 委托id列表,包含需要导出的委托的id |
||||
* @param response HttpServletResponse对象,用于将生成的excel文件写入响应中 |
||||
*/ |
||||
void exportExcel(List<String> entrustIds, HttpServletResponse response) throws IOException; |
||||
|
||||
} |
@ -0,0 +1,199 @@ |
||||
package digital.laboratory.platform.entrustment.service.impl; |
||||
|
||||
import cn.hutool.core.collection.CollUtil; |
||||
import cn.idev.excel.FastExcel; |
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import digital.laboratory.platform.common.core.exception.CheckedException; |
||||
import digital.laboratory.platform.entrustment.convert.DrugLiteConvert; |
||||
import digital.laboratory.platform.entrustment.convert.EntrustMaterialCheckoutResultConvert; |
||||
import digital.laboratory.platform.entrustment.dto.CheckoutResultExcelDTO; |
||||
import digital.laboratory.platform.entrustment.dto.EntrustMaterialCheckoutResultDTO; |
||||
import digital.laboratory.platform.entrustment.entity.EntrustMaterialCheckoutResult; |
||||
import digital.laboratory.platform.entrustment.entity.Entrustment; |
||||
import digital.laboratory.platform.entrustment.entity.EntrustmentIdentificationMaterial; |
||||
import digital.laboratory.platform.entrustment.enums.EntrustmentStatusConstants; |
||||
import digital.laboratory.platform.entrustment.mapper.EntrustMaterialCheckoutResultMapper; |
||||
import digital.laboratory.platform.entrustment.service.CommonFeignService; |
||||
import digital.laboratory.platform.entrustment.service.EntrustMaterialCheckoutResultService; |
||||
import digital.laboratory.platform.entrustment.service.EntrustmentIdentificationMaterialService; |
||||
import digital.laboratory.platform.entrustment.service.EntrustmentService; |
||||
import digital.laboratory.platform.sys.entity.Area; |
||||
import digital.laboratory.platform.sys.entity.DrugLite; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import javax.annotation.Resource; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
import java.io.IOException; |
||||
import java.net.URLEncoder; |
||||
import java.time.LocalDateTime; |
||||
import java.time.format.DateTimeFormatter; |
||||
import java.util.ArrayList; |
||||
import java.util.Collections; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import java.util.function.Function; |
||||
import java.util.stream.Collectors; |
||||
|
||||
/** |
||||
* @author ChenJiangBao |
||||
* @description 针对表【b_entrust_material_checkout_result(委托检材--检出定性定量结果信息)】的数据库操作Service实现 |
||||
* @createDate 2024-12-30 16:16:25 |
||||
*/ |
||||
@Service |
||||
public class EntrustMaterialCheckoutResultServiceImpl extends ServiceImpl<EntrustMaterialCheckoutResultMapper, EntrustMaterialCheckoutResult> |
||||
implements EntrustMaterialCheckoutResultService { |
||||
|
||||
@Resource |
||||
private EntrustmentService entrustmentService; |
||||
|
||||
@Resource |
||||
private EntrustmentIdentificationMaterialService entrustmentIdentificationMaterialService; |
||||
|
||||
@Resource |
||||
private CommonFeignService commonFeignService; |
||||
|
||||
/** |
||||
* 根据DTO保存检材得检出结果信息 |
||||
* @param dto 检出DTO |
||||
* @return |
||||
*/ |
||||
@Override |
||||
public boolean save(EntrustMaterialCheckoutResultDTO dto) { |
||||
Entrustment entrustment = entrustmentService.getById(dto.getEntrustId()); |
||||
if (entrustment == null) { |
||||
throw new CheckedException("委托信息不存在!"); |
||||
} |
||||
if (!entrustment.getStatus().equals(EntrustmentStatusConstants.ENTRUSTMENT_STATUS_ACCEPTED.getStatus())) { |
||||
throw new CheckedException("该委托信息并未被机构受理!"); |
||||
} |
||||
List<String> ids = dto.getIds(); |
||||
List<EntrustmentIdentificationMaterial> materialList = entrustmentIdentificationMaterialService.list(Wrappers.<EntrustmentIdentificationMaterial>lambdaQuery().in(EntrustmentIdentificationMaterial::getId, ids)); |
||||
Map<String, EntrustmentIdentificationMaterial> identificationMaterialMap = materialList.stream().collect(Collectors.toMap(EntrustmentIdentificationMaterial::getId, Function.identity())); |
||||
boolean success = false; |
||||
for (String id : ids) { |
||||
EntrustmentIdentificationMaterial identificationMaterial = identificationMaterialMap.get(id); |
||||
if (identificationMaterial == null) { |
||||
throw new CheckedException(String.format("id为 [%s] 得检材信息不存在!", id)); |
||||
} |
||||
EntrustMaterialCheckoutResult entrustMaterialCheckoutResult = EntrustMaterialCheckoutResultConvert.dtoToEntity(dto); |
||||
entrustMaterialCheckoutResult.setId(id); |
||||
if (super.count(Wrappers.<EntrustMaterialCheckoutResult>lambdaQuery().eq(EntrustMaterialCheckoutResult::getId, id)) <= 0) { |
||||
// throw new CheckedException(String.format("检材编号 [%s] 的检材检出结果已经存在!", identificationMaterial.getImNo()));
|
||||
success = super.save(entrustMaterialCheckoutResult); |
||||
} else { |
||||
success = super.updateById(entrustMaterialCheckoutResult); |
||||
} |
||||
} |
||||
return success; |
||||
} |
||||
|
||||
/** |
||||
* 根据委托id导出检出结果excel文件 |
||||
* |
||||
* @param entrustIds 委托id列表,包含需要导出的委托的id |
||||
* @param response HttpServletResponse对象,用于将生成的excel文件写入响应中 |
||||
*/ |
||||
@Override |
||||
public void exportExcel(List<String> entrustIds, HttpServletResponse response) throws IOException { |
||||
// 获取委托信息
|
||||
List<Entrustment> entrustmentList = entrustmentService.list( |
||||
Wrappers.<Entrustment>lambdaQuery().in(Entrustment::getId, entrustIds) |
||||
); |
||||
// 获取检材信息, 排序的原因是需要数据是有序的
|
||||
List<EntrustmentIdentificationMaterial> materialList = entrustmentIdentificationMaterialService.list( |
||||
Wrappers.<EntrustmentIdentificationMaterial>lambdaQuery() |
||||
.in(EntrustmentIdentificationMaterial::getEntrustmentId, entrustIds) |
||||
.orderByAsc(EntrustmentIdentificationMaterial::getEntrustmentId) |
||||
.orderByAsc(EntrustmentIdentificationMaterial::getOrderNo) |
||||
); |
||||
// 获取检材id,后续根据检材id获取对应的检出结果
|
||||
List<String> materialIds = materialList.stream().map(EntrustmentIdentificationMaterial::getId).collect(Collectors.toList()); |
||||
// 根据委托id进行分组,防止导出的excel数据被打乱
|
||||
Map<String, List<EntrustmentIdentificationMaterial>> materialGroupByEntrustMap = materialList.stream().collect(Collectors.groupingBy(EntrustmentIdentificationMaterial::getEntrustmentId)); |
||||
|
||||
// 获取检出结果
|
||||
List<EntrustMaterialCheckoutResult> checkoutResultList = super.list(Wrappers.<EntrustMaterialCheckoutResult>lambdaQuery().in(EntrustMaterialCheckoutResult::getId, materialIds)); |
||||
Map<String, EntrustMaterialCheckoutResult> checkoutResultMap = checkoutResultList.stream().collect(Collectors.toMap(EntrustMaterialCheckoutResult::getId, Function.identity())); |
||||
List<CheckoutResultExcelDTO> checkoutResultExcelDTOS = fetchCheckoutResultExcelDTOList(entrustmentList, materialGroupByEntrustMap, checkoutResultMap); |
||||
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
||||
response.setCharacterEncoding("utf-8"); |
||||
String fileName = URLEncoder.encode("测试", "UTF-8").replaceAll("\\+", "%20"); |
||||
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); |
||||
|
||||
FastExcel.write(response.getOutputStream(), CheckoutResultExcelDTO.class) |
||||
.sheet(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) |
||||
.doWrite(checkoutResultExcelDTOS); |
||||
} |
||||
|
||||
/** |
||||
* 根据委托列表、材料映射和检验结果映射生成导出Excel的DTO列表 |
||||
* |
||||
* @param entrustList 委托列表 |
||||
* @param materialMap 材料映射,键为委托ID,值为对应的材料列表 |
||||
* @param checkoutResultMap 检验结果映射,键为委托ID,值为对应的检验结果 |
||||
* @return 导出Excel的DTO列表,但此方法实际返回空列表,因为最后返回的是Collections.emptyList() |
||||
*/ |
||||
private List<CheckoutResultExcelDTO> fetchCheckoutResultExcelDTOList(List<Entrustment> entrustList, Map<String, List<EntrustmentIdentificationMaterial>> materialMap, Map<String, EntrustMaterialCheckoutResult> checkoutResultMap) { |
||||
List<CheckoutResultExcelDTO> checkoutResultExcelDTOList = new ArrayList<>(); |
||||
Integer index = 1; |
||||
for (Entrustment entrust : entrustList) { |
||||
List<EntrustmentIdentificationMaterial> materialList = materialMap.get(entrust.getId()); |
||||
List<Area> areas = commonFeignService.remoteGetProvinceCityInfo(entrust.getClientOrgId()); |
||||
String provinceCollectPlace = areas.get(0).getName(); |
||||
String cityCollectPlace = ""; |
||||
if (areas.size() > 1) { |
||||
cityCollectPlace = areas.get(1).getName(); |
||||
} |
||||
String typeName = getTypeName(entrust); |
||||
if (CollUtil.isNotEmpty(materialList)) { |
||||
for (EntrustmentIdentificationMaterial material : materialList) { |
||||
CheckoutResultExcelDTO excelDTO = new CheckoutResultExcelDTO(); |
||||
excelDTO.setOrder(index++); |
||||
excelDTO.setDeliverTime(entrust.getDeliverTime().format(DateTimeFormatter.ofPattern("yyyy/M/d"))); |
||||
excelDTO.setClientOrgName(entrust.getClientOrgName()); |
||||
excelDTO.setProvinceCollectPlace(provinceCollectPlace); |
||||
excelDTO.setCityCollectPlace(cityCollectPlace); |
||||
excelDTO.setAcceptNo(entrust.getAcceptNo()); |
||||
excelDTO.setOrderNo(material.getOrderNo()); |
||||
excelDTO.setTypeName(typeName); |
||||
excelDTO.setColor(material.getColor()); |
||||
excelDTO.setFormName(material.getFormName()); |
||||
EntrustMaterialCheckoutResult entrustMaterialCheckoutResult = checkoutResultMap.get(material.getId()); |
||||
excelDTO.setQualitativeResult( |
||||
DrugLiteConvert.convertDirtyLiteByJSON(entrustMaterialCheckoutResult.getQualitativeResult()) |
||||
.stream().map(DrugLite::getName).collect(Collectors.joining("、")) |
||||
); |
||||
excelDTO.setQuantitativeResult(entrustMaterialCheckoutResult.getQuantitativeResult()); |
||||
excelDTO.setOtherResult(entrustMaterialCheckoutResult.getOtherResult()); |
||||
excelDTO.setRemark(entrustMaterialCheckoutResult.getCheckoutRemark()); |
||||
checkoutResultExcelDTOList.add(excelDTO); |
||||
} |
||||
} |
||||
} |
||||
return checkoutResultExcelDTOList; |
||||
} |
||||
|
||||
/** |
||||
* 根据委托类型获取委托检材类型的名称 |
||||
* |
||||
* @param entrust 委托对象 |
||||
* @return 委托类型的名称 |
||||
*/ |
||||
private String getTypeName(Entrustment entrust) { |
||||
String typeName = ""; |
||||
if (entrust.getEntrustmentType().equals(0)) { |
||||
typeName = "缴获物"; |
||||
} else if (entrust.getEntrustmentType().equals(1)) { |
||||
typeName = "生物样本"; |
||||
} else { |
||||
typeName = "其他"; |
||||
} |
||||
return typeName; |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,53 @@ |
||||
package digital.laboratory.platform.entrustment.vo; |
||||
|
||||
import digital.laboratory.platform.sys.entity.DrugLite; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 委托检材--检出定性定量结果信息 |
||||
* @TableName b_entrust_material_checkout_result |
||||
*/ |
||||
@Data |
||||
@ApiModel(value = "EntrustMaterialCheckoutResultVO", description = "委托检材--检出定性定量结果信息VO") |
||||
public class EntrustMaterialCheckoutResultVO { |
||||
/** |
||||
* 委托检材id |
||||
*/ |
||||
@ApiModelProperty("委托检材id列表, 支持批量") |
||||
private String id; |
||||
|
||||
/** |
||||
* 委托检材id |
||||
*/ |
||||
@ApiModelProperty("委托id") |
||||
private String entrustId; |
||||
|
||||
/** |
||||
* 定性结果 |
||||
*/ |
||||
@ApiModelProperty("定性结果") |
||||
private List<DrugLite> qualitativeResult; |
||||
|
||||
/** |
||||
* 定量结果 |
||||
*/ |
||||
@ApiModelProperty("定量结果") |
||||
private List<String> quantitativeResult; |
||||
|
||||
/** |
||||
* 其他鉴定结果 |
||||
*/ |
||||
@ApiModelProperty("其他鉴定结果") |
||||
private String otherResult; |
||||
|
||||
/** |
||||
* 检出结果的备注信息 |
||||
*/ |
||||
@ApiModelProperty("检出结果的备注信息") |
||||
private String checkoutRemark; |
||||
|
||||
} |
@ -0,0 +1,28 @@ |
||||
<?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.entrustment.mapper.EntrustMaterialCheckoutResultMapper"> |
||||
|
||||
<resultMap id="BaseResultMap" type="digital.laboratory.platform.entrustment.entity.EntrustMaterialCheckoutResult"> |
||||
<id property="id" column="entrust_material_id" jdbcType="VARCHAR"/> |
||||
<result property="qualitativeResult" column="qualitative_result" jdbcType="VARCHAR" typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/> |
||||
<result property="quantitativeResult" column="quantitative_result" jdbcType="VARCHAR"/> |
||||
<result property="otherResult" column="other_result" jdbcType="VARCHAR"/> |
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> |
||||
<result property="createBy" column="create_by" jdbcType="VARCHAR"/> |
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> |
||||
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/> |
||||
</resultMap> |
||||
|
||||
<sql id="Base_Column_List"> |
||||
entrust_material_id, |
||||
qualitative_result, |
||||
quantitative_result, |
||||
other_result, |
||||
create_time, |
||||
create_by, |
||||
update_time, |
||||
update_by |
||||
</sql> |
||||
</mapper> |
Loading…
Reference in new issue