Ver código fonte

肠外营养完成

Huanyi 1 mês atrás
pai
commit
e22693c2e2

+ 105 - 0
ruoyi-admin/src/main/java/org/dromara/web/controller/ParenteralNutritionController.java

@@ -0,0 +1,105 @@
+package org.dromara.web.controller;
+
+import java.util.List;
+
+import lombok.RequiredArgsConstructor;
+import jakarta.servlet.http.HttpServletResponse;
+import jakarta.validation.constraints.*;
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.validation.annotation.Validated;
+import org.dromara.common.idempotent.annotation.RepeatSubmit;
+import org.dromara.common.log.annotation.Log;
+import org.dromara.common.web.core.BaseController;
+import org.dromara.common.mybatis.core.page.PageQuery;
+import org.dromara.common.core.domain.R;
+import org.dromara.common.core.validate.AddGroup;
+import org.dromara.common.core.validate.EditGroup;
+import org.dromara.common.log.enums.BusinessType;
+import org.dromara.common.excel.utils.ExcelUtil;
+import org.dromara.web.domain.vo.ParenteralNutritionVo;
+import org.dromara.web.domain.bo.ParenteralNutritionBo;
+import org.dromara.web.service.IParenteralNutritionService;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
+
+/**
+ * 肠外营养
+ *
+ * @author Huanyi
+ * @date 2025-08-27
+ */
+@Validated
+@RequiredArgsConstructor
+@RestController
+@RequestMapping("/parenteralNutrition")
+public class ParenteralNutritionController extends BaseController {
+
+    private final IParenteralNutritionService parenteralNutritionService;
+
+    /**
+     * 查询肠外营养列表
+     */
+    @SaCheckPermission("admin:web:list")
+    @GetMapping("/list")
+    public TableDataInfo<ParenteralNutritionVo> list(ParenteralNutritionBo bo, PageQuery pageQuery) {
+        return parenteralNutritionService.queryPageList(bo, pageQuery);
+    }
+
+    /**
+     * 导出肠外营养列表
+     */
+    @SaCheckPermission("admin:web:export")
+    @Log(title = "肠外营养", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(ParenteralNutritionBo bo, HttpServletResponse response) {
+        List<ParenteralNutritionVo> list = parenteralNutritionService.queryList(bo);
+        ExcelUtil.exportExcel(list, "肠外营养", ParenteralNutritionVo.class, response);
+    }
+
+    /**
+     * 获取肠外营养详细信息
+     *
+     * @param id 主键
+     */
+    @SaCheckPermission("admin:web:query")
+    @GetMapping("/{id}")
+    public R<ParenteralNutritionVo> getInfo(@NotNull(message = "主键不能为空")
+                                     @PathVariable Long id) {
+        return R.ok(parenteralNutritionService.queryById(id));
+    }
+
+    /**
+     * 新增肠外营养
+     */
+    @SaCheckPermission("admin:web:add")
+    @Log(title = "肠外营养", businessType = BusinessType.INSERT)
+    @RepeatSubmit()
+    @PostMapping()
+    public R<Void> add(@Validated(AddGroup.class) @RequestBody ParenteralNutritionBo bo) {
+        return toAjax(parenteralNutritionService.insertByBo(bo));
+    }
+
+    /**
+     * 修改肠外营养
+     */
+    @SaCheckPermission("admin:web:edit")
+    @Log(title = "肠外营养", businessType = BusinessType.UPDATE)
+    @RepeatSubmit()
+    @PutMapping()
+    public R<Void> edit(@Validated(EditGroup.class) @RequestBody ParenteralNutritionBo bo) {
+        return toAjax(parenteralNutritionService.updateByBo(bo));
+    }
+
+    /**
+     * 删除肠外营养
+     *
+     * @param ids 主键串
+     */
+    @SaCheckPermission("admin:web:remove")
+    @Log(title = "肠外营养", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public R<Void> remove(@NotEmpty(message = "主键不能为空")
+                          @PathVariable Long[] ids) {
+        return toAjax(parenteralNutritionService.deleteWithValidByIds(List.of(ids), true));
+    }
+}

+ 12 - 0
ruoyi-admin/src/main/java/org/dromara/web/controller/ProductNutritionController.java

@@ -61,6 +61,18 @@ public class ProductNutritionController extends BaseController {
         return productNutritionService.listAll();
     }
 
+    @SaCheckPermission(
+        value = {
+            "warehouse:nutrition:list",
+            "basicPublicTemplate:enteralNutritionTemplate:add"
+        },
+        mode = SaMode.OR
+    )
+    @GetMapping("/listAllByType")
+    public TableDataInfo<ProductNutritionVo> listAllByType(@RequestParam("type") Integer type) {
+        return productNutritionService.listAllByType(type);
+    }
+
     /**
      * 导出营养产品信息列表
      */

+ 200 - 0
ruoyi-admin/src/main/java/org/dromara/web/domain/ParenteralNutrition.java

@@ -0,0 +1,200 @@
+package org.dromara.web.domain;
+
+import org.dromara.common.tenant.core.TenantEntity;
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.io.Serial;
+
+/**
+ * 肠外营养对象 parenteral_nutrition
+ *
+ * @author Huanyi
+ * @date 2025-08-27
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("parenteral_nutrition")
+public class ParenteralNutrition extends TenantEntity {
+
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 结算管理id
+     */
+    private Long settlementId;
+
+    /**
+     * 开方日期
+     */
+    private Date prescriptionDate;
+
+    /**
+     * 组号
+     */
+    private String groupNo;
+
+    /**
+     * 营养产品
+     */
+    private Long nutritionProductId;
+
+    /**
+     * 营养产品
+     */
+    private String nutritionProduct;
+
+    /**
+     * 停嘱日期
+     */
+    private Date stopDate;
+
+    /**
+     * 处方类型
+     */
+    private String prescriptionType;
+
+    /**
+     * 数量
+     */
+    private Long quantity;
+
+    /**
+     * 用量/次
+     */
+    private Long dosePerTime;
+
+    /**
+     * 餐次时间
+     */
+    private String mealTime;
+
+    /**
+     * 频次
+     */
+    private Long frequency;
+
+    /**
+     * 首日
+     */
+    private Long firstDay;
+
+    /**
+     * 用量/日
+     */
+    private Long dosePerDay;
+
+    /**
+     * 使用天数
+     */
+    private Long usageDays;
+
+    /**
+     * 用量/总
+     */
+    private Long totalDose;
+
+    /**
+     * 规格
+     */
+    private String specification;
+
+    /**
+     * 用法
+     */
+    @TableField(value = "`usage`")
+    private String usage;
+
+    /**
+     * 制剂液量/次
+     */
+    private Long preparationVolumePerTime;
+
+    /**
+     * 制剂浓度/次
+     */
+    private Long preparationConcentrationPerTime;
+
+    /**
+     * 能量密度/次
+     */
+    private Long energyDensityPerTime;
+
+    /**
+     * 处方备注
+     */
+    private String prescriptionRemark;
+
+    /**
+     * 每日热量
+     */
+    private Long dailyCalories;
+
+    /**
+     * 金额
+     */
+    private Long amount;
+
+    /**
+     * 状态(0正常 1停用)
+     */
+    private String status;
+
+    /**
+     * 删除标志(0代表存在 1代表删除)
+     */
+    @TableLogic
+    private String delFlag;
+
+    /**
+     * 配置状态
+     */
+    private String configStatus;
+
+    /**
+     * 配置时间
+     */
+    private Date configTime;
+
+    /**
+     * 配置人
+     */
+    private String configBy;
+
+    /**
+     * 执行状态
+     */
+    private String executeStatus;
+
+    /**
+     * 执行日期
+     */
+    private Date executeDate;
+
+    /**
+     * 执行时间
+     */
+    private Date executeTime;
+
+    /**
+     * 执行人
+     */
+    private String executeBy;
+
+    /**
+     * 标签打印数量
+     */
+    private Long tagPrintNum;
+
+    private Long recordId;
+}

+ 192 - 0
ruoyi-admin/src/main/java/org/dromara/web/domain/bo/ParenteralNutritionBo.java

@@ -0,0 +1,192 @@
+package org.dromara.web.domain.bo;
+
+import org.dromara.web.domain.ParenteralNutrition;
+import org.dromara.common.mybatis.core.domain.BaseEntity;
+import org.dromara.common.core.validate.AddGroup;
+import org.dromara.common.core.validate.EditGroup;
+import io.github.linpeilie.annotations.AutoMapper;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import jakarta.validation.constraints.*;
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+/**
+ * 肠外营养业务对象 parenteral_nutrition
+ *
+ * @author Huanyi
+ * @date 2025-08-27
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@AutoMapper(target = ParenteralNutrition.class, reverseConvertGenerate = false)
+public class ParenteralNutritionBo extends BaseEntity {
+
+    /**
+     * 主键ID
+     */
+    @NotNull(message = "主键ID不能为空", groups = { AddGroup.class })
+    private Long id;
+
+    /**
+     * 结算管理id
+     */
+    private Long settlementId;
+
+    /**
+     * 开方日期
+     */
+    private Date prescriptionDate;
+
+    /**
+     * 组号
+     */
+    private String groupNo;
+
+    /**
+     * 营养产品
+     */
+    private Long nutritionProductId;
+
+    /**
+     * 营养产品
+     */
+    private String nutritionProduct;
+
+    /**
+     * 停嘱日期
+     */
+    private Date stopDate;
+
+    /**
+     * 处方类型
+     */
+    private String prescriptionType;
+
+    /**
+     * 数量
+     */
+    private Long quantity;
+
+    /**
+     * 用量/次
+     */
+    private Long dosePerTime;
+
+    /**
+     * 餐次时间
+     */
+    private String mealTime;
+
+    /**
+     * 频次
+     */
+    private Long frequency;
+
+    /**
+     * 首日
+     */
+    private Long firstDay;
+
+    /**
+     * 用量/日
+     */
+    private Long dosePerDay;
+
+    /**
+     * 使用天数
+     */
+    private Long usageDays;
+
+    /**
+     * 用量/总
+     */
+    private Long totalDose;
+
+    /**
+     * 规格
+     */
+    private String specification;
+
+    /**
+     * 用法
+     */
+    private String usage;
+
+    /**
+     * 制剂液量/次
+     */
+    private Long preparationVolumePerTime;
+
+    /**
+     * 制剂浓度/次
+     */
+    private Long preparationConcentrationPerTime;
+
+    /**
+     * 能量密度/次
+     */
+    private Long energyDensityPerTime;
+
+    /**
+     * 处方备注
+     */
+    private String prescriptionRemark;
+
+    /**
+     * 每日热量
+     */
+    private Long dailyCalories;
+
+    /**
+     * 金额
+     */
+    private Long amount;
+
+    /**
+     * 状态(0正常 1停用)
+     */
+    private String status;
+
+    /**
+     * 配置状态
+     */
+    private String configStatus;
+
+    /**
+     * 配置时间
+     */
+    private Date configTime;
+
+    /**
+     * 配置人
+     */
+    private String configBy;
+
+    /**
+     * 执行状态
+     */
+    private String executeStatus;
+
+    /**
+     * 执行日期
+     */
+    private Date executeDate;
+
+    /**
+     * 执行时间
+     */
+    private Date executeTime;
+
+    /**
+     * 执行人
+     */
+    private String executeBy;
+
+    /**
+     * 标签打印数量
+     */
+    private Long tagPrintNum;
+
+    private Long recordId;
+}

+ 234 - 0
ruoyi-admin/src/main/java/org/dromara/web/domain/vo/ParenteralNutritionVo.java

@@ -0,0 +1,234 @@
+package org.dromara.web.domain.vo;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.dromara.web.domain.ParenteralNutrition;
+import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
+import cn.idev.excel.annotation.ExcelProperty;
+import org.dromara.common.excel.annotation.ExcelDictFormat;
+import org.dromara.common.excel.convert.ExcelDictConvert;
+import io.github.linpeilie.annotations.AutoMapper;
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.util.Date;
+
+
+
+/**
+ * 肠外营养视图对象 parenteral_nutrition
+ *
+ * @author Huanyi
+ * @date 2025-08-27
+ */
+@Data
+@ExcelIgnoreUnannotated
+@AutoMapper(target = ParenteralNutrition.class)
+public class ParenteralNutritionVo implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键ID
+     */
+    @ExcelProperty(value = "主键ID")
+    private Long id;
+
+    /**
+     * 结算管理id
+     */
+    @ExcelProperty(value = "结算管理id")
+    private Long settlementId;
+
+    /**
+     * 开方日期
+     */
+    @ExcelProperty(value = "开方日期")
+    private Date prescriptionDate;
+
+    /**
+     * 组号
+     */
+    @ExcelProperty(value = "组号")
+    private String groupNo;
+
+    /**
+     * 营养产品
+     */
+    @ExcelProperty(value = "营养产品")
+    private Long nutritionProductId;
+
+    /**
+     * 营养产品
+     */
+    @ExcelProperty(value = "营养产品")
+    private String nutritionProduct;
+
+    /**
+     * 停嘱日期
+     */
+    @ExcelProperty(value = "停嘱日期")
+    private Date stopDate;
+
+    /**
+     * 处方类型
+     */
+    @ExcelProperty(value = "处方类型", converter = ExcelDictConvert.class)
+    @ExcelDictFormat(dictType = "recipe_type")
+    private String prescriptionType;
+
+    /**
+     * 数量
+     */
+    @ExcelProperty(value = "数量")
+    private Long quantity;
+
+    /**
+     * 用量/次
+     */
+    @ExcelProperty(value = "用量/次")
+    private Long dosePerTime;
+
+    /**
+     * 餐次时间
+     */
+    @ExcelProperty(value = "餐次时间")
+    private String mealTime;
+
+    /**
+     * 频次
+     */
+    @ExcelProperty(value = "频次")
+    private Long frequency;
+
+    /**
+     * 首日
+     */
+    @ExcelProperty(value = "首日")
+    private Long firstDay;
+
+    /**
+     * 用量/日
+     */
+    @ExcelProperty(value = "用量/日")
+    private Long dosePerDay;
+
+    /**
+     * 使用天数
+     */
+    @ExcelProperty(value = "使用天数")
+    private Long usageDays;
+
+    /**
+     * 用量/总
+     */
+    @ExcelProperty(value = "用量/总")
+    private Long totalDose;
+
+    /**
+     * 规格
+     */
+    @ExcelProperty(value = "规格")
+    private String specification;
+
+    /**
+     * 用法
+     */
+    @ExcelProperty(value = "用法")
+    private String usage;
+
+    /**
+     * 制剂液量/次
+     */
+    @ExcelProperty(value = "制剂液量/次")
+    private Long preparationVolumePerTime;
+
+    /**
+     * 制剂浓度/次
+     */
+    @ExcelProperty(value = "制剂浓度/次")
+    private Long preparationConcentrationPerTime;
+
+    /**
+     * 能量密度/次
+     */
+    @ExcelProperty(value = "能量密度/次")
+    private Long energyDensityPerTime;
+
+    /**
+     * 处方备注
+     */
+    @ExcelProperty(value = "处方备注")
+    private String prescriptionRemark;
+
+    /**
+     * 每日热量
+     */
+    @ExcelProperty(value = "每日热量")
+    private Long dailyCalories;
+
+    /**
+     * 金额
+     */
+    @ExcelProperty(value = "金额")
+    private Long amount;
+
+    /**
+     * 状态(0正常 1停用)
+     */
+    @ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
+    @ExcelDictFormat(dictType = "sys_oper_type")
+    private String status;
+
+    /**
+     * 配置状态
+     */
+    @ExcelProperty(value = "配置状态")
+    private String configStatus;
+
+    /**
+     * 配置时间
+     */
+    @ExcelProperty(value = "配置时间")
+    private Date configTime;
+
+    /**
+     * 配置人
+     */
+    @ExcelProperty(value = "配置人")
+    private String configBy;
+
+    /**
+     * 执行状态
+     */
+    @ExcelProperty(value = "执行状态")
+    private String executeStatus;
+
+    /**
+     * 执行日期
+     */
+    @ExcelProperty(value = "执行日期")
+    private Date executeDate;
+
+    /**
+     * 执行时间
+     */
+    @ExcelProperty(value = "执行时间")
+    private Date executeTime;
+
+    /**
+     * 执行人
+     */
+    @ExcelProperty(value = "执行人")
+    private String executeBy;
+
+    /**
+     * 标签打印数量
+     */
+    @ExcelProperty(value = "标签打印数量")
+    private Long tagPrintNum;
+
+
+}

+ 15 - 0
ruoyi-admin/src/main/java/org/dromara/web/mapper/ParenteralNutritionMapper.java

@@ -0,0 +1,15 @@
+package org.dromara.web.mapper;
+
+import org.dromara.web.domain.ParenteralNutrition;
+import org.dromara.web.domain.vo.ParenteralNutritionVo;
+import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
+
+/**
+ * 肠外营养Mapper接口
+ *
+ * @author Huanyi
+ * @date 2025-08-27
+ */
+public interface ParenteralNutritionMapper extends BaseMapperPlus<ParenteralNutrition, ParenteralNutritionVo> {
+
+}

+ 68 - 0
ruoyi-admin/src/main/java/org/dromara/web/service/IParenteralNutritionService.java

@@ -0,0 +1,68 @@
+package org.dromara.web.service;
+
+import org.dromara.web.domain.vo.ParenteralNutritionVo;
+import org.dromara.web.domain.bo.ParenteralNutritionBo;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
+import org.dromara.common.mybatis.core.page.PageQuery;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * 肠外营养Service接口
+ *
+ * @author Huanyi
+ * @date 2025-08-27
+ */
+public interface IParenteralNutritionService {
+
+    /**
+     * 查询肠外营养
+     *
+     * @param id 主键
+     * @return 肠外营养
+     */
+    ParenteralNutritionVo queryById(Long id);
+
+    /**
+     * 分页查询肠外营养列表
+     *
+     * @param bo        查询条件
+     * @param pageQuery 分页参数
+     * @return 肠外营养分页列表
+     */
+    TableDataInfo<ParenteralNutritionVo> queryPageList(ParenteralNutritionBo bo, PageQuery pageQuery);
+
+    /**
+     * 查询符合条件的肠外营养列表
+     *
+     * @param bo 查询条件
+     * @return 肠外营养列表
+     */
+    List<ParenteralNutritionVo> queryList(ParenteralNutritionBo bo);
+
+    /**
+     * 新增肠外营养
+     *
+     * @param bo 肠外营养
+     * @return 是否新增成功
+     */
+    Boolean insertByBo(ParenteralNutritionBo bo);
+
+    /**
+     * 修改肠外营养
+     *
+     * @param bo 肠外营养
+     * @return 是否修改成功
+     */
+    Boolean updateByBo(ParenteralNutritionBo bo);
+
+    /**
+     * 校验并批量删除肠外营养信息
+     *
+     * @param ids     待删除的主键集合
+     * @param isValid 是否进行有效性校验
+     * @return 是否删除成功
+     */
+    Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+}

+ 2 - 0
ruoyi-admin/src/main/java/org/dromara/web/service/IProductNutritionService.java

@@ -77,4 +77,6 @@ public interface IProductNutritionService {
     Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
 
     R<?> importExcel(MultipartFile file) throws Exception;
+
+    TableDataInfo<ProductNutritionVo> listAllByType(Integer type);
 }

+ 138 - 0
ruoyi-admin/src/main/java/org/dromara/web/service/impl/ParenteralNutritionServiceImpl.java

@@ -0,0 +1,138 @@
+package org.dromara.web.service.impl;
+
+import org.dromara.common.core.utils.MapstructUtils;
+import org.dromara.common.core.utils.StringUtils;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
+import org.dromara.common.mybatis.core.page.PageQuery;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.dromara.web.domain.bo.ParenteralNutritionBo;
+import org.dromara.web.domain.vo.ParenteralNutritionVo;
+import org.dromara.web.domain.ParenteralNutrition;
+import org.dromara.web.mapper.ParenteralNutritionMapper;
+import org.dromara.web.service.IParenteralNutritionService;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Collection;
+
+/**
+ * 肠外营养Service业务层处理
+ *
+ * @author Huanyi
+ * @date 2025-08-27
+ */
+@Slf4j
+@RequiredArgsConstructor
+@Service
+public class ParenteralNutritionServiceImpl implements IParenteralNutritionService {
+
+    private final ParenteralNutritionMapper baseMapper;
+
+    /**
+     * 查询肠外营养
+     *
+     * @param id 主键
+     * @return 肠外营养
+     */
+    @Override
+    public ParenteralNutritionVo queryById(Long id){
+        return baseMapper.selectVoById(id);
+    }
+
+    /**
+     * 分页查询肠外营养列表
+     *
+     * @param bo        查询条件
+     * @param pageQuery 分页参数
+     * @return 肠外营养分页列表
+     */
+    @Override
+    public TableDataInfo<ParenteralNutritionVo> queryPageList(ParenteralNutritionBo bo, PageQuery pageQuery) {
+        LambdaQueryWrapper<ParenteralNutrition> lqw = buildQueryWrapper(bo);
+        Page<ParenteralNutritionVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
+        return TableDataInfo.build(result);
+    }
+
+    /**
+     * 查询符合条件的肠外营养列表
+     *
+     * @param bo 查询条件
+     * @return 肠外营养列表
+     */
+    @Override
+    public List<ParenteralNutritionVo> queryList(ParenteralNutritionBo bo) {
+        LambdaQueryWrapper<ParenteralNutrition> lqw = buildQueryWrapper(bo);
+        return baseMapper.selectVoList(lqw);
+    }
+
+    private LambdaQueryWrapper<ParenteralNutrition> buildQueryWrapper(ParenteralNutritionBo bo) {
+        Map<String, Object> params = bo.getParams();
+        LambdaQueryWrapper<ParenteralNutrition> lqw = Wrappers.lambdaQuery();
+        lqw.orderByAsc(ParenteralNutrition::getId);
+        lqw.eq(bo.getPrescriptionDate() != null, ParenteralNutrition::getPrescriptionDate, bo.getPrescriptionDate());
+        lqw.eq(bo.getStopDate() != null, ParenteralNutrition::getStopDate, bo.getStopDate());
+        lqw.eq(StringUtils.isNotBlank(bo.getPrescriptionType()), ParenteralNutrition::getPrescriptionType, bo.getPrescriptionType());
+        lqw.eq(StringUtils.isNotBlank(bo.getStatus()), ParenteralNutrition::getStatus, bo.getStatus());
+        lqw.eq(bo.getConfigTime() != null, ParenteralNutrition::getConfigTime, bo.getConfigTime());
+        lqw.eq(bo.getExecuteDate() != null, ParenteralNutrition::getExecuteDate, bo.getExecuteDate());
+        lqw.eq(bo.getRecordId() != null, ParenteralNutrition::getRecordId, bo.getRecordId());
+        return lqw;
+    }
+
+    /**
+     * 新增肠外营养
+     *
+     * @param bo 肠外营养
+     * @return 是否新增成功
+     */
+    @Override
+    public Boolean insertByBo(ParenteralNutritionBo bo) {
+        ParenteralNutrition add = MapstructUtils.convert(bo, ParenteralNutrition.class);
+        validEntityBeforeSave(add);
+        boolean flag = baseMapper.insert(add) > 0;
+        if (flag) {
+            bo.setId(add.getId());
+        }
+        return flag;
+    }
+
+    /**
+     * 修改肠外营养
+     *
+     * @param bo 肠外营养
+     * @return 是否修改成功
+     */
+    @Override
+    public Boolean updateByBo(ParenteralNutritionBo bo) {
+        ParenteralNutrition update = MapstructUtils.convert(bo, ParenteralNutrition.class);
+        validEntityBeforeSave(update);
+        return baseMapper.updateById(update) > 0;
+    }
+
+    /**
+     * 保存前的数据校验
+     */
+    private void validEntityBeforeSave(ParenteralNutrition entity){
+        //TODO 做一些数据校验,如唯一约束
+    }
+
+    /**
+     * 校验并批量删除肠外营养信息
+     *
+     * @param ids     待删除的主键集合
+     * @param isValid 是否进行有效性校验
+     * @return 是否删除成功
+     */
+    @Override
+    public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
+        if(isValid){
+            //TODO 做一些业务上的校验,判断是否需要校验
+        }
+        return baseMapper.deleteByIds(ids) > 0;
+    }
+}

+ 2 - 1
ruoyi-admin/src/main/java/org/dromara/web/service/impl/ProductInOutRecordServiceImpl.java

@@ -223,7 +223,8 @@ public class ProductInOutRecordServiceImpl implements IProductInOutRecordService
         } else {
             // 出库操作
             stock.setStockNum(stock.getStockNum() - bo.getNum());
-            // 出库时总库存保持不变,只修改可用库存
+            // 出库时总库存一同修改
+            stock.setTotalStockNum(stock.getTotalStockNum() - bo.getNum());
         }
         productStockMapper.updateById(stock);
     }

+ 41 - 0
ruoyi-admin/src/main/java/org/dromara/web/service/impl/ProductNutritionServiceImpl.java

@@ -408,4 +408,45 @@ public class ProductNutritionServiceImpl implements IProductNutritionService {
 
         return R.ok("导入成功!");
     }
+
+    @Override
+    public TableDataInfo<ProductNutritionVo> listAllByType(Integer type) {
+        List<ProductNutritionVo> dataList = baseMapper.selectVoList(Wrappers.lambdaQuery(ProductNutrition.class).orderByDesc(ProductNutrition::getId));
+
+        if (CollUtil.isNotEmpty(dataList)) {
+            Map<String, List<SysDictDataVo>> dictMap = dataService.selectGroupByType(
+                List.of(BizConst.PRODUCT_SPEC_UNIT, BizConst.PRODUCT_PACKAGE_UNIT)).getData();
+            Map<String, String> specUnitMap = dictMap.get(BizConst.PRODUCT_SPEC_UNIT).stream().collect(Collectors.toMap(k1 -> k1.getDictValue(), k2 -> k2.getDictLabel(), (k1, k2) -> k1));
+            Map<String, String> packageUnitMap = dictMap.get(BizConst.PRODUCT_PACKAGE_UNIT).stream().collect(Collectors.toMap(k1 -> k1.getDictValue(), k2 -> k2.getDictLabel(), (k1, k2) -> k1));
+
+            dataList.stream().map(ProductNutritionVo::getProductCategory).collect(Collectors.toSet());
+            productCategoryMapper.selectList(Wrappers.lambdaQuery(ProductCategory.class)
+                .select(ProductCategory::getCategoryName, ProductCategory::getCategoryId)
+                .in(ProductCategory::getCategoryId, dataList.stream().map(ProductNutritionVo::getProductCategory).collect(Collectors.toSet())));
+
+            dataList.forEach(v -> {
+                String packageUnit = StrUtil.emptyToDefault(packageUnitMap.get(v.getPackageUnit()), StrUtil.EMPTY);
+                String productSpecUnit = StrUtil.emptyToDefault(specUnitMap.get(v.getProductSpecUnit()), StrUtil.EMPTY);
+                v.setProductSpec(v.getProductSpec() + productSpecUnit + "/" + packageUnit);
+                v.setProductSpecUnit(productSpecUnit);
+                v.setPackageUnit(packageUnit);
+            });
+        }
+
+        StorageLocation storageLocation = locationMapper.selectOne(
+            Wrappers.lambdaQuery(StorageLocation.class).eq(StorageLocation::getStorageName, type == 0 ? "预包装库位" : "配置库位")
+        );
+        List<ProductStock> productStockList = productStockMapper.selectList(
+            Wrappers.lambdaQuery(ProductStock.class).eq(Objects.nonNull(storageLocation), ProductStock::getLocationId, storageLocation.getId())
+        );
+
+        dataList = dataList.stream().filter(e -> {
+            int stock = 0;
+            for (ProductStock productStock : productStockList)
+                if (Objects.equals(productStock.getProductId(), e.getId())) stock += productStock.getStockNum();
+            return stock > 0;
+        }).toList();
+
+        return TableDataInfo.build(dataList);
+    }
 }

+ 2 - 2
ruoyi-admin/src/main/java/org/dromara/web/service/impl/ReportServiceImpl.java

@@ -129,7 +129,7 @@ public class ReportServiceImpl implements ReportService {
                 if (recipeToIngredientMap.containsKey(e.getRecipeId())) {
                     recipeToIngredientMap.get(e.getRecipeId()).add(e.getFoodIngredientId());
                 } else {
-                    recipeToIngredientMap.put(e.getRecipeId(), List.of(e.getFoodIngredientId()));
+                    recipeToIngredientMap.put(e.getRecipeId(), new ArrayList<>(List.of(e.getFoodIngredientId())));
                 }
             });
             sysFoodIngredientMapper.selectList().forEach(e -> ingredientMap.put(e.getFoodIngredientId(), e.getName()));
@@ -342,7 +342,7 @@ public class ReportServiceImpl implements ReportService {
                 if (recipeToIngredientMap.containsKey(e.getRecipeId())) {
                     recipeToIngredientMap.get(e.getRecipeId()).add(e.getFoodIngredientId());
                 } else {
-                    recipeToIngredientMap.put(e.getRecipeId(), List.of(e.getFoodIngredientId()));
+                    recipeToIngredientMap.put(e.getRecipeId(), new ArrayList<>(List.of(e.getFoodIngredientId())));
                 }
             });
             List<SysRecipe> recipes = sysRecipeMapper.selectList();

Diferenças do arquivo suprimidas por serem muito extensas
+ 66 - 0
script/sql/biz/2025/08/dump_2025_08_26.sql


Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff