demo作成
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.inventoryManage.assembler;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.openhis.administration.domain.Patient;
|
||||
import com.openhis.medication.domain.Medication;
|
||||
import com.openhis.web.inventoryManage.dto.InventoryReceiptDto;
|
||||
import com.openhis.workflow.domain.SupplyRequest;
|
||||
|
||||
/**
|
||||
* 采购入库相关dto转换器
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-02-20
|
||||
*/
|
||||
public class PurchaseInventoryAssembler {
|
||||
|
||||
/**
|
||||
* 装配【入库单据分页列表DTO】分页
|
||||
*
|
||||
* @param supplyRequestPage 【供应申请管理Entity实体】分页
|
||||
* @param medicationList 【药品基本信息管理Entity实体】列表
|
||||
* @param patientList【患者管理Entity实体】列表
|
||||
* @return 【入库单据分页列表DTO】分页
|
||||
*/
|
||||
public static Page<InventoryReceiptDto> assembleInventoryReceiptDto(Page<SupplyRequest> supplyRequestPage,
|
||||
List<Medication> medicationList, List<Patient> patientList) {
|
||||
|
||||
// 将查询到的【药品基本信息管理】列表,作成以ID为Key的Map
|
||||
Map<Long, Medication> medicationMap =
|
||||
medicationList.stream().collect(Collectors.toMap(Medication::getId, Function.identity()));
|
||||
|
||||
// 将查询到的【患者管理】列表,作成以ID为Key的Map
|
||||
Map<Long, Patient> patientMap =
|
||||
patientList.stream().collect(Collectors.toMap(Patient::getId, Function.identity()));
|
||||
|
||||
// 定义【入库单据分页列表DTO】的分页,传入【页码】、【行数】、及上面分页的【总数】
|
||||
Page<InventoryReceiptDto> returnPage =
|
||||
new Page<>(supplyRequestPage.getCurrent(), supplyRequestPage.getSize(), supplyRequestPage.getTotal());
|
||||
|
||||
// 将【供应申请管理】的分页转化为返回【入库单据分页列表DTO】的分页
|
||||
returnPage.setRecords(supplyRequestPage.getRecords().stream().map(entity -> {
|
||||
// 定义【入库单据分页列表DTO】
|
||||
InventoryReceiptDto dto = new InventoryReceiptDto();
|
||||
// 从主表COPY需要的字段
|
||||
dto.setId(entity.getId());
|
||||
dto.setCategoryEnum(1);
|
||||
// 从【药品基本信息管理】Map取值,设置【药品基本信息管理】返回实体
|
||||
dto.setMedication(medicationMap.getOrDefault(entity.getDispenseId(), null));
|
||||
// 从【患者管理】Map取值,设置【患者管理】返回实体
|
||||
dto.setPatient(patientMap.getOrDefault(entity.getPatientId(), null));
|
||||
return dto;
|
||||
}).collect(Collectors.toList()));
|
||||
|
||||
// 返回【入库单据分页列表DTO】分页
|
||||
return returnPage;
|
||||
}
|
||||
}
|
||||
@@ -3,17 +3,27 @@
|
||||
*/
|
||||
package com.openhis.web.inventoryManage.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.openhis.workflow.service.ISupplyRequestService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.bean.BeanUtils;
|
||||
import com.openhis.administration.domain.Patient;
|
||||
import com.openhis.administration.service.IPatientService;
|
||||
import com.openhis.medication.domain.Medication;
|
||||
import com.openhis.medication.service.IMedicationService;
|
||||
import com.openhis.web.inventoryManage.assembler.PurchaseInventoryAssembler;
|
||||
import com.openhis.web.inventoryManage.dto.SupplySearchParam;
|
||||
import com.openhis.workflow.domain.SupplyRequest;
|
||||
import com.openhis.workflow.service.ISupplyRequestService;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
@@ -23,12 +33,15 @@ import lombok.extern.slf4j.Slf4j;
|
||||
* @date 2025-02-18
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/purchase-inventory")
|
||||
@RequestMapping("/inventory-manage-purchase")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class PurchaseInventoryController {
|
||||
|
||||
private final ISupplyRequestService supplyRequestService;
|
||||
@Autowired
|
||||
private ISupplyRequestService supplyRequestService;
|
||||
@Autowired
|
||||
private IMedicationService medicationService;
|
||||
@Autowired
|
||||
private IPatientService patientService;
|
||||
|
||||
/**
|
||||
* 入库单据分页列表
|
||||
@@ -83,9 +96,53 @@ public class PurchaseInventoryController {
|
||||
*
|
||||
* @param supplyRequest 供应请求信息
|
||||
*/
|
||||
@PutMapping("/submit-examine")
|
||||
public void submitExamine(SupplyRequest supplyRequest) {
|
||||
|
||||
// 更改供应请求单据状态
|
||||
// 生成供应分发supply_delivery
|
||||
}
|
||||
|
||||
/**
|
||||
* 入库单据详情列表
|
||||
*
|
||||
* @param supplySearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 入库单据分页列表
|
||||
*/
|
||||
@GetMapping(value = "/inventory-receipt-page")
|
||||
public R<?> getDetailPage(SupplySearchParam supplySearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
|
||||
// 数据初始化
|
||||
Medication medication = new Medication();
|
||||
BeanUtils.copyProperties(supplySearchParam, medication);
|
||||
|
||||
SupplyRequest supplyRequest = new SupplyRequest();
|
||||
BeanUtils.copyProperties(supplySearchParam, supplyRequest);
|
||||
|
||||
// 获取供应请求信息
|
||||
|
||||
// ====================================================================================
|
||||
|
||||
// 查询【供应申请管理】分页列表
|
||||
Page<SupplyRequest> supplyRequestPage = supplyRequestService.getPage(supplyRequest, pageNo, pageSize);
|
||||
|
||||
// 根据【发放id】查询【药品基本信息管理】列表
|
||||
List<Medication> medicationList = medicationService.listByIds(
|
||||
supplyRequestPage.getRecords().stream().map(SupplyRequest::getDispenseId).collect(Collectors.toList()));
|
||||
|
||||
// 根据【患者id】查询【患者管理】列表
|
||||
List<Patient> patientList = patientService.listByIds(
|
||||
supplyRequestPage.getRecords().stream().map(SupplyRequest::getPatientId).collect(Collectors.toList()));
|
||||
|
||||
// 装配并返回【入库单据分页列表DTO】分页
|
||||
return R.ok(
|
||||
PurchaseInventoryAssembler.assembleInventoryReceiptDto(supplyRequestPage, medicationList, patientList),
|
||||
"查询成功");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,13 @@
|
||||
*/
|
||||
package com.openhis.web.inventoryManage.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.openhis.administration.domain.Patient;
|
||||
import com.openhis.medication.domain.Medication;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@@ -14,5 +21,70 @@ import lombok.experimental.Accessors;
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class InventoryReceiptDto {
|
||||
public class InventoryReceiptDto implements Serializable {
|
||||
|
||||
/** ID */
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/** 类型 */
|
||||
private Integer typeEnum;
|
||||
|
||||
/** 状态 */
|
||||
private Integer statusEnum;
|
||||
|
||||
/** 意图 */
|
||||
private Integer intentEnum;
|
||||
|
||||
/** 分类 */
|
||||
private Integer categoryEnum;
|
||||
|
||||
/** 优先权 */
|
||||
private Integer priorityEnum;
|
||||
|
||||
/** 汇总编号 */
|
||||
private Long summaryId;
|
||||
|
||||
/** 交付 */
|
||||
private Long deliverId;
|
||||
|
||||
/** 患者id */
|
||||
private Long patientId;
|
||||
|
||||
/** 发放实体表名 */
|
||||
private String dispenseTable;
|
||||
|
||||
/** 发放id */
|
||||
private Long dispenseId;
|
||||
|
||||
/** 期望时间 */
|
||||
private Date occurrenceTime;
|
||||
|
||||
/** 供应人 */
|
||||
private Long practitionerId;
|
||||
|
||||
/** 供应商 */
|
||||
private Long supplierId;
|
||||
|
||||
/** 理由 */
|
||||
private String reason;
|
||||
|
||||
/** 源仓库类型 */
|
||||
private Integer sourceType;
|
||||
|
||||
/** 源仓库 */
|
||||
private Long sourceLocationId;
|
||||
|
||||
/** 源仓位 */
|
||||
private Long sourceLocationStoreId;
|
||||
|
||||
/** 目的类型 */
|
||||
private Integer purposeType;
|
||||
|
||||
/** 药品基本信息管理Entity实体 */
|
||||
private Medication medication;
|
||||
|
||||
/** 患者管理Entity实体 */
|
||||
private Patient patient;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
*/
|
||||
package com.openhis.web.inventoryManage.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@@ -14,4 +16,6 @@ import lombok.experimental.Accessors;
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class SupplySearchParam {}
|
||||
public class SupplySearchParam implements Serializable {
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user