demo优化,新增init方法
This commit is contained in:
@@ -12,22 +12,27 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.core.common.utils.bean.BeanUtils;
|
||||
import com.openhis.administration.domain.ChargeItem;
|
||||
import com.openhis.administration.domain.Location;
|
||||
import com.openhis.administration.domain.Patient;
|
||||
import com.openhis.administration.service.IChargeItemService;
|
||||
import com.openhis.administration.service.ILocationService;
|
||||
import com.openhis.administration.service.IPatientService;
|
||||
import com.openhis.administration.service.ISupplierService;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
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.SupplyRequestDto;
|
||||
import com.openhis.web.inventorymanage.dto.SupplySaveRequestDto;
|
||||
import com.openhis.web.inventorymanage.dto.SupplySearchParam;
|
||||
import com.openhis.web.inventorymanage.dto.InventoryDto;
|
||||
import com.openhis.web.inventorymanage.dto.InventoryReceiptInitDto;
|
||||
import com.openhis.web.inventorymanage.dto.InventorySearchParam;
|
||||
import com.openhis.web.inventorymanage.dto.SaveInventoryReceiptDto;
|
||||
import com.openhis.workflow.domain.SupplyRequest;
|
||||
import com.openhis.workflow.service.ISupplyRequestService;
|
||||
|
||||
@@ -51,11 +56,22 @@ public class PurchaseInventoryController {
|
||||
private IPatientService patientService;
|
||||
@Autowired
|
||||
private IChargeItemService chargeItemService;
|
||||
@Autowired
|
||||
private ISupplierService supplierService;
|
||||
@Autowired
|
||||
private ILocationService locationService;
|
||||
|
||||
@GetMapping(value = "/test")
|
||||
public R<?> test() {
|
||||
// return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002,new Object[] {"12345"})) ;
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"12345"}));
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> init() {
|
||||
|
||||
InventoryReceiptInitDto initDto = new InventoryReceiptInitDto();
|
||||
// 设置供应商列表
|
||||
initDto.setSupplier(supplierService.list())
|
||||
// 设置药房列表
|
||||
.setLocation(locationService.list(new LambdaQueryWrapper<Location>().in(Location::getFormEnum, 1)))
|
||||
// 药品详细
|
||||
.setMedicationDetail(medicationService.getDetailList());
|
||||
return R.ok(initDto);
|
||||
}
|
||||
|
||||
// 添加入库单据之前需要
|
||||
@@ -67,13 +83,13 @@ public class PurchaseInventoryController {
|
||||
/**
|
||||
* 添加入库单据(生成供应请求)
|
||||
*
|
||||
* @param supplyRequestDto 供应请求信息
|
||||
* @param inventoryDto 供应请求信息
|
||||
*/
|
||||
@PostMapping("/add-inventory-receipt")
|
||||
public R<?> addSupplyRequest(@Validated @RequestBody SupplyRequestDto supplyRequestDto) {
|
||||
public R<?> addSupplyRequest(@Validated @RequestBody InventoryDto inventoryDto) {
|
||||
// 生成待发送的入库单据supply_request
|
||||
SupplyRequest supplyRequest = new SupplyRequest();
|
||||
BeanUtils.copyProperties(supplyRequestDto, supplyRequest);
|
||||
BeanUtils.copyProperties(inventoryDto, supplyRequest);
|
||||
// 如果业务上不需要其它处理 直接调用service的保存方法
|
||||
boolean saveSupplyRequestSuccess = supplyRequestService.save(supplyRequest);
|
||||
|
||||
@@ -83,7 +99,7 @@ public class PurchaseInventoryController {
|
||||
// 生成收费项目charge_item
|
||||
ChargeItem chargeItem = new ChargeItem();
|
||||
// 如果字段很少建议手动set赋值
|
||||
chargeItem.setUnitPrice(supplyRequestDto.getUnitPrice());
|
||||
chargeItem.setUnitPrice(inventoryDto.getUnitPrice());
|
||||
boolean saveChargeItemSuccess = chargeItemService.saveChargeItem(chargeItem);
|
||||
// 如果采购单价被修改了,需要根据批次号更新采购单价子表价格、
|
||||
|
||||
@@ -100,20 +116,20 @@ public class PurchaseInventoryController {
|
||||
/**
|
||||
* 编辑入库单据
|
||||
*
|
||||
* @param supplySaveRequestDto 供应请求信息
|
||||
* @param saveInventoryReceiptDto 供应请求信息
|
||||
*/
|
||||
@PutMapping("/edit-inventory-receipt")
|
||||
public R<?> editSupplyRequest(@Validated @RequestBody SupplySaveRequestDto supplySaveRequestDto) {
|
||||
public R<?> editSupplyRequest(@Validated @RequestBody SaveInventoryReceiptDto saveInventoryReceiptDto) {
|
||||
// 更新supply_request信息
|
||||
SupplyRequest saveRequest = new SupplyRequest();
|
||||
BeanUtils.copyProperties(supplySaveRequestDto, saveRequest);
|
||||
BeanUtils.copyProperties(saveInventoryReceiptDto, saveRequest);
|
||||
if (!supplyRequestService.updateById(saveRequest)) {
|
||||
return R.fail();
|
||||
}
|
||||
// 更新收费项目charge_item
|
||||
ChargeItem chargeItem = new ChargeItem();
|
||||
BeanUtils.copyProperties(supplySaveRequestDto, chargeItem);
|
||||
chargeItem.setId(supplySaveRequestDto.getChargeItemId());
|
||||
BeanUtils.copyProperties(saveInventoryReceiptDto, chargeItem);
|
||||
chargeItem.setId(saveInventoryReceiptDto.getChargeItemId());
|
||||
return chargeItemService.updateChargeItem(chargeItem) ? R.ok() : R.fail();
|
||||
}
|
||||
|
||||
@@ -125,55 +141,40 @@ public class PurchaseInventoryController {
|
||||
@DeleteMapping("/delete-inventory-receipt")
|
||||
public R<?> deleteSupplyRequest(@RequestParam Long supplyRequestId) {
|
||||
// 全都是逻辑删除
|
||||
// 通过id将supply_request表的delFlag更新为1
|
||||
// todo:拓展mybatisplus :删除就是软删除 ,查询默认加上delFlag条件,通过传参实现查看被删除的项目
|
||||
|
||||
|
||||
supplyRequestService.deletebyId(SupplyRequest::getId);
|
||||
boolean deleteSuccess = supplyRequestService.update(new LambdaUpdateWrapper<SupplyRequest>()
|
||||
.eq(SupplyRequest::getId, supplyRequestId).set(SupplyRequest::getDeleteFlag, 1));
|
||||
boolean deleteSuccess = supplyRequestService.removeById(supplyRequestId);
|
||||
|
||||
if (!deleteSuccess) {
|
||||
return R.fail();
|
||||
}
|
||||
|
||||
boolean deleteChargeItemSuccess = chargeItemService.update(new LambdaUpdateWrapper<ChargeItem>()
|
||||
.eq(ChargeItem::getServiceId, supplyRequestId).set(ChargeItem::getDeleteFlag, 1));
|
||||
boolean deleteChargeItemSuccess = chargeItemService
|
||||
.remove(new LambdaUpdateWrapper<ChargeItem>().eq(ChargeItem::getServiceId, supplyRequestId));
|
||||
|
||||
return deleteChargeItemSuccess ? R.ok() : R.fail();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单据提交申请
|
||||
*
|
||||
* @param supplyRequest 供应请求信息
|
||||
*/
|
||||
@PutMapping("/submit-examine")
|
||||
public void submitExamine(SupplyRequest supplyRequest) {
|
||||
|
||||
// 更改供应请求单据状态
|
||||
// 生成供应分发supply_delivery
|
||||
}
|
||||
|
||||
/**
|
||||
* 入库单据详情列表
|
||||
*
|
||||
* @param supplySearchParam 查询条件
|
||||
* @param inventorySearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 入库单据分页列表
|
||||
*/
|
||||
@GetMapping(value = "/inventory-receipt-page")
|
||||
public R<?> getDetailPage(SupplySearchParam supplySearchParam,
|
||||
public R<?> getDetailPage(InventorySearchParam inventorySearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
|
||||
// 查询条件初始化
|
||||
Medication medication = new Medication();
|
||||
BeanUtils.copyProperties(supplySearchParam, medication);
|
||||
BeanUtils.copyProperties(inventorySearchParam, medication);
|
||||
|
||||
SupplyRequest supplyRequest = new SupplyRequest();
|
||||
BeanUtils.copyProperties(supplySearchParam, supplyRequest);
|
||||
BeanUtils.copyProperties(inventorySearchParam, supplyRequest);
|
||||
|
||||
// 获取供应请求信息
|
||||
|
||||
@@ -195,4 +196,16 @@ public class PurchaseInventoryController {
|
||||
.ok(PurchaseInventoryAssembler.assembleInventoryReceiptDto(supplyRequestPage, medicationList, patientList));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 单据提交申请
|
||||
*
|
||||
* @param supplyRequest 供应请求信息
|
||||
*/
|
||||
@PutMapping("/submit-examine")
|
||||
public void submitExamine(SupplyRequest supplyRequest) {
|
||||
|
||||
// 更改供应请求单据状态
|
||||
// 生成供应分发supply_delivery
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import lombok.experimental.Accessors;
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class SupplyRequestDto {
|
||||
public class InventoryDto {
|
||||
|
||||
/** 项目 */
|
||||
private String itemTable;
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.inventorymanage.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.openhis.administration.domain.Location;
|
||||
import com.openhis.administration.domain.Supplier;
|
||||
import com.openhis.medication.domain.MedicationDetail;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 采购入库初始化 dto
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-02-20
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class InventoryReceiptInitDto {
|
||||
|
||||
/** 药房信息 */
|
||||
private List<Location> location;
|
||||
|
||||
/** 供应商信息 */
|
||||
private List<Supplier> supplier;
|
||||
|
||||
/** 药品详细信息 */
|
||||
private List<MedicationDetail> medicationDetail;
|
||||
}
|
||||
@@ -16,6 +16,6 @@ import lombok.experimental.Accessors;
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class SupplySearchParam implements Serializable {
|
||||
public class InventorySearchParam implements Serializable {
|
||||
|
||||
}
|
||||
@@ -17,7 +17,7 @@ import lombok.experimental.Accessors;
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class SupplySaveRequestDto {
|
||||
public class SaveInventoryReceiptDto {
|
||||
/** ID */
|
||||
private Long id;
|
||||
|
||||
@@ -6,8 +6,8 @@ import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import com.core.common.core.domain.HisBaseEntity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
@@ -79,4 +79,90 @@ public class Medication extends HisBaseEntity {
|
||||
/** 删除状态 */
|
||||
private Integer deleteFlag;
|
||||
|
||||
/** 药品编号 */
|
||||
private Long code;
|
||||
|
||||
/** 药品名称 */
|
||||
private String name;
|
||||
|
||||
/** 适用范围 */
|
||||
private Integer domainEnum;
|
||||
|
||||
/** 药品版本 */
|
||||
private String version;
|
||||
|
||||
/** 英文药名 */
|
||||
private String nameEn;
|
||||
|
||||
/** 药品名称拼音码 */
|
||||
private String pyCode;
|
||||
|
||||
/** 药品五笔码 */
|
||||
private String wbCode;
|
||||
|
||||
/** 药品分类 */
|
||||
private Integer categoryCode;
|
||||
|
||||
/** 商品名称 */
|
||||
private String merchandiseName;
|
||||
|
||||
/** 商品名称拼音码 */
|
||||
private String merchandisePyCode;
|
||||
|
||||
/** 商品五笔码 */
|
||||
private String merchandiseWbCode;
|
||||
|
||||
/** 药品单位 */
|
||||
private String unitCode;
|
||||
|
||||
/** 最小单位 */
|
||||
private String minUnitCode;
|
||||
|
||||
/** 所含耗材 */
|
||||
private String comprisedText;
|
||||
|
||||
/** 成分 */
|
||||
private String ingredient;
|
||||
|
||||
/** 拆零比 */
|
||||
private BigDecimal partPercent;
|
||||
|
||||
/** 剂量形式 */
|
||||
private Integer doseFrom;
|
||||
|
||||
/** 批准文号 */
|
||||
private String approvalNumber;
|
||||
|
||||
/** 医保是否对码 */
|
||||
private Integer ybMatchFlag;
|
||||
|
||||
/** 医保编码 */
|
||||
private String ybCode;
|
||||
|
||||
/** 药理作用分类 */
|
||||
private String pharmacologyCategoryCode;
|
||||
|
||||
/** 是否皮试 */
|
||||
private Integer skinTestFlag;
|
||||
|
||||
/** 是否为注射药物 */
|
||||
private Integer injectFlag;
|
||||
|
||||
/** 生产厂家 */
|
||||
private Long manufacturerId;
|
||||
|
||||
/** 供应商 */
|
||||
private Long supplyId;
|
||||
|
||||
/** 是否限制使用 */
|
||||
private Integer restrictedFlag;
|
||||
|
||||
/** 限制使用范围 */
|
||||
private String restrictedScope;
|
||||
|
||||
/** 儿童用药标志 */
|
||||
private Integer childrenFlag;
|
||||
|
||||
/** 产品特性 */
|
||||
private Integer characteristic;
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.medication.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.core.common.core.domain.HisBaseEntity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 药品信息详情
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-02-20
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class MedicationDetail extends HisBaseEntity {
|
||||
|
||||
/** ID */
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/** 药品编码 */
|
||||
private Long medicationProductId;
|
||||
|
||||
/** 药品状态 */
|
||||
private Integer statusEnum;
|
||||
|
||||
/** 所属科室 */
|
||||
private Long orgId;
|
||||
|
||||
/** 剂型 */
|
||||
private String doseFormCode;
|
||||
|
||||
/** 规格 */
|
||||
private String totalVolume;
|
||||
|
||||
/** 成分 */
|
||||
private String ingredientItem;
|
||||
|
||||
/** 是否为活性 */
|
||||
private Integer activeFlag;
|
||||
|
||||
/** 批次号 */
|
||||
private String lotNumber;
|
||||
|
||||
/** 生效日期 */
|
||||
private Date effectiveDate;
|
||||
|
||||
/** 到期日期 */
|
||||
private Date expirationDate;
|
||||
|
||||
/** 用法 */
|
||||
private String methodCode;
|
||||
|
||||
/** 用药频次 */
|
||||
private String rateCode;
|
||||
|
||||
/** 单次剂量 */
|
||||
private BigDecimal dose;
|
||||
|
||||
/** 剂量单位 */
|
||||
private String doseUnitCode;
|
||||
|
||||
/** 单次最大剂量 */
|
||||
private BigDecimal maxUnit;
|
||||
|
||||
/** 药品定义 */
|
||||
private String definition;
|
||||
|
||||
/** 删除状态 */
|
||||
private Integer deleteFlag;
|
||||
}
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.openhis.medication.mapper;
|
||||
|
||||
import com.openhis.medication.domain.MedicationDetail;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.openhis.medication.domain.Medication;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 药品基本信息管理Mapper接口
|
||||
*
|
||||
@@ -14,4 +17,10 @@ import com.openhis.medication.domain.Medication;
|
||||
@Repository
|
||||
public interface MedicationMapper extends BaseMapper<Medication> {
|
||||
|
||||
/**
|
||||
* 查询药品详细信息列表
|
||||
*
|
||||
* @return 药品详细信息列表
|
||||
*/
|
||||
List<MedicationDetail> selectDetailList();
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.openhis.medication.domain.Medication;
|
||||
import com.openhis.medication.domain.MedicationDetail;
|
||||
|
||||
/**
|
||||
* 药品基本信息管理Service接口
|
||||
@@ -20,4 +21,11 @@ public interface IMedicationService extends IService<Medication> {
|
||||
* @return 药品信息列表
|
||||
*/
|
||||
List<Medication> getList(List<Long> medicationIdList);
|
||||
|
||||
/**
|
||||
* 查询药品详细信息列表
|
||||
*
|
||||
* @return 药品详细信息列表
|
||||
*/
|
||||
List<MedicationDetail> getDetailList();
|
||||
}
|
||||
@@ -2,16 +2,17 @@ package com.openhis.medication.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.openhis.common.enums.DelFlag;
|
||||
import com.openhis.medication.domain.Medication;
|
||||
import com.openhis.medication.domain.MedicationDetail;
|
||||
import com.openhis.medication.mapper.MedicationMapper;
|
||||
import com.openhis.medication.service.IMedicationService;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
@@ -22,9 +23,11 @@ import lombok.extern.slf4j.Slf4j;
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class MedicationServiceImpl extends ServiceImpl<MedicationMapper, Medication> implements IMedicationService {
|
||||
|
||||
@Autowired
|
||||
private MedicationMapper medicationMapper;
|
||||
|
||||
/**
|
||||
* 查询药品信息列表
|
||||
*
|
||||
@@ -42,4 +45,15 @@ public class MedicationServiceImpl extends ServiceImpl<MedicationMapper, Medicat
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询药品详细信息列表
|
||||
*
|
||||
* @return 药品详细信息列表
|
||||
*/
|
||||
@Override
|
||||
public List<MedicationDetail> getDetailList() {
|
||||
return medicationMapper.selectDetailList();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,4 +4,42 @@
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.openhis.medication.mapper.MedicationMapper">
|
||||
|
||||
<select id="selectDetailList" resultType="com.openhis.medication.domain.MedicationDetail">
|
||||
SELECT T1.id,
|
||||
T1.medication_product_id,
|
||||
T1.status_enum,
|
||||
T1.org_id,
|
||||
T1.dose_form_code,
|
||||
T1.total_volume,
|
||||
T1.ingredient_item,
|
||||
T1.active_flag,
|
||||
T1.lot_number,
|
||||
T1.effective_date,
|
||||
T1.expiration_date,
|
||||
T1.effective_date,
|
||||
T1.method_code,
|
||||
T1.rate_code,
|
||||
T1.dose,
|
||||
T1.dose_unit_code,
|
||||
T1.max_unit,
|
||||
T1.definition,
|
||||
T2.code,
|
||||
T2.name,
|
||||
T2.domain_enum,
|
||||
T2.name_en,
|
||||
T2.py_code,
|
||||
T2.wb_code,
|
||||
T2.category_code,
|
||||
T2.merchandise_name,
|
||||
T2.merchandise_py_code,
|
||||
T2.merchandise_wb_code,
|
||||
T2.unit_code,
|
||||
T2.min_unit_code,
|
||||
T2.part_percent,
|
||||
T2.dose_from
|
||||
FROM med_medication AS T1
|
||||
LEFT JOIN med_medication_definition AS T2
|
||||
ON T1.medication_product_id = T2.id
|
||||
WHERE T1.delete_flag = 0
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user