From 29a63f99661b4087a04f1df17bf4d7c84011f73c Mon Sep 17 00:00:00 2001 From: tianyongbao Date: Tue, 22 Oct 2024 20:28:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=8D=AF=E5=93=81=E5=AE=9E=E6=97=B6?= =?UTF-8?q?=E5=BA=93=E5=AD=98=EF=BC=8C=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HealthMedicineStockInController.java | 40 +++++++------ .../mapper/HealthMedicineStockInMapper.java | 13 ++++- .../IHealthMedicineStockInService.java | 12 +++- .../HealthMedicineStockInServiceImpl.java | 12 ++++ .../mapper/health/HealthMarRecordMapper.xml | 56 ++++++++++--------- .../health/HealthMedicineStockInMapper.xml | 34 ++++++++++- 6 files changed, 119 insertions(+), 48 deletions(-) diff --git a/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/controller/HealthMedicineStockInController.java b/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/controller/HealthMedicineStockInController.java index 9387c21..d774daf 100644 --- a/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/controller/HealthMedicineStockInController.java +++ b/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/controller/HealthMedicineStockInController.java @@ -1,30 +1,23 @@ package com.ruoyi.health.controller; -import java.util.List; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; -import javax.annotation.Resource; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.core.utils.poi.ExcelUtil; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.core.web.page.TableDataInfo; import com.ruoyi.common.log.annotation.Log; import com.ruoyi.common.log.enums.BusinessType; import com.ruoyi.common.security.annotation.RequiresPermissions; import com.ruoyi.health.domain.HealthMedicineStockIn; -import com.ruoyi.health.domain.vo.HealthMedicineStockInVo; import com.ruoyi.health.domain.dto.HealthMedicineStockInDto; +import com.ruoyi.health.domain.vo.HealthMedicineStockInVo; import com.ruoyi.health.service.IHealthMedicineStockInService; -import com.ruoyi.common.core.web.controller.BaseController; -import com.ruoyi.common.core.web.domain.AjaxResult; -import com.ruoyi.common.core.utils.poi.ExcelUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import com.ruoyi.common.core.web.page.TableDataInfo; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.util.List; /** * 药品入库清单Controller @@ -113,4 +106,17 @@ public class HealthMedicineStockInController extends BaseController { return toAjax(healthMedicineStockInService.deleteHealthMedicineStockInByIds(ids)); } + + /** + * 查询药品实时库存列表 + */ + @ApiOperation(value="查询药品实时库存列表",response = HealthMedicineStockInVo.class) + @RequiresPermissions("health:medicineStockIn:list") + @GetMapping("/realTimeList") + public TableDataInfo realTimeList(HealthMedicineStockInDto healthMedicineStockInDto) + { + startPage(); + List list = healthMedicineStockInService.selectHealthMedicineRealtimeList(healthMedicineStockInDto); + return getDataTable(list); + } } diff --git a/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/mapper/HealthMedicineStockInMapper.java b/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/mapper/HealthMedicineStockInMapper.java index b773f70..bc8c07c 100644 --- a/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/mapper/HealthMedicineStockInMapper.java +++ b/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/mapper/HealthMedicineStockInMapper.java @@ -1,10 +1,11 @@ package com.ruoyi.health.mapper; -import java.util.List; import com.ruoyi.health.domain.HealthMedicineStockIn; import com.ruoyi.health.domain.dto.HealthMedicineStockInDto; import com.ruoyi.health.domain.vo.HealthMedicineStockInVo; +import java.util.List; + /** * 药品入库清单Mapper接口 * @@ -76,4 +77,14 @@ public interface HealthMedicineStockInMapper * @return 结果 */ public int removeHealthMedicineStockInByIds(Long[] ids); + + + /** + * 查询药品实时库存列表 + * + * @param healthMedicineStockInDto 药品入库清单 + * @return 药品入库清单集合 + */ + public List selectHealthMedicineRealtimeList(HealthMedicineStockInDto healthMedicineStockInDto); + } diff --git a/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/service/IHealthMedicineStockInService.java b/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/service/IHealthMedicineStockInService.java index 5c76292..60872bb 100644 --- a/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/service/IHealthMedicineStockInService.java +++ b/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/service/IHealthMedicineStockInService.java @@ -1,10 +1,11 @@ package com.ruoyi.health.service; -import java.util.List; import com.ruoyi.health.domain.HealthMedicineStockIn; import com.ruoyi.health.domain.dto.HealthMedicineStockInDto; import com.ruoyi.health.domain.vo.HealthMedicineStockInVo; +import java.util.List; + /** * 药品入库清单Service接口 * @@ -60,4 +61,13 @@ public interface IHealthMedicineStockInService * @return 结果 */ public int deleteHealthMedicineStockInById(Long id); + + /** + * 查询药品实时库存列表 + * + * @param healthMedicineStockInDto 药品入库清单 + * @return 药品入库清单集合 + */ + public List selectHealthMedicineRealtimeList(HealthMedicineStockInDto healthMedicineStockInDto); + } diff --git a/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/service/impl/HealthMedicineStockInServiceImpl.java b/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/service/impl/HealthMedicineStockInServiceImpl.java index 5675cae..9dd8641 100644 --- a/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/service/impl/HealthMedicineStockInServiceImpl.java +++ b/ruoyi-modules/intc-health/src/main/java/com/ruoyi/health/service/impl/HealthMedicineStockInServiceImpl.java @@ -101,4 +101,16 @@ public class HealthMedicineStockInServiceImpl implements IHealthMedicineStockInS { return healthMedicineStockInMapper.removeHealthMedicineStockInById(id); } + + /** + * 查询药品实时库存列表 + * + * @param healthMedicineStockInDto 药品入库清单 + * @return 药品入库清单 + */ + @Override + public List selectHealthMedicineRealtimeList(HealthMedicineStockInDto healthMedicineStockInDto) + { + return healthMedicineStockInMapper.selectHealthMedicineRealtimeList(healthMedicineStockInDto); + } } diff --git a/ruoyi-modules/intc-health/src/main/resources/mapper/health/HealthMarRecordMapper.xml b/ruoyi-modules/intc-health/src/main/resources/mapper/health/HealthMarRecordMapper.xml index 9de3f59..c7a0f44 100644 --- a/ruoyi-modules/intc-health/src/main/resources/mapper/health/HealthMarRecordMapper.xml +++ b/ruoyi-modules/intc-health/src/main/resources/mapper/health/HealthMarRecordMapper.xml @@ -32,34 +32,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select - a.id, - a.name, - a.type, - a.create_by, - a.create_time, - a.update_by, - a.update_time, - a.del_flag, - a.remark, - a.health_record_id, - a.dosing_time, - a.dosage, - a.person_id, - a.resource, - a.place, - a.place, - a.medicine_id, - a.unit, - a.content, - a.content_unit, - hp."name" as person_name , - hr."name" as health_record_name + a.id, + a.type, + a.create_by, + a.create_time, + a.update_by, + a.update_time, + a.del_flag, + a.remark, + a.health_record_id, + a.dosing_time, + a.dosage, + a.person_id, + a.resource, + a.place, + a.place, + a.medicine_id, + a.unit, + a.content, + a.content_unit, + hp."name" as person_name , + hr."name" as health_record_name, + hmb.short_name || '-' || hmb.brand || '(' || hmb.packaging || ')' as name from - health_mar_record a - left join health_person hp on - hp.id = a.person_id - left join health_record hr on - hr.id = a.health_record_id + health_mar_record a + left join health_person hp on + hp.id = a.person_id + left join health_record hr on + hr.id = a.health_record_id + left join health_medicine_basic hmb on + hmb.id = a.medicine_id + select + a.medicine_id, + sum(a.left_count) as left_count, + sum(a.total_count) as total_count, + a.unit, + hmb.short_name || '-' || hmb.brand || '(' || hmb.packaging || ')' as medicine_name + from + health_medicine_stock_in a + left join health_medicine_basic hmb on + hmb.id = a.medicine_id + + + a.del_flag='0' + and a.left_count>0 + and a.medicine_id = #{medicineId} + + + ${params.dataScope} + group by + a.medicine_id, + a.left_count, + a.unit, + hmb.short_name, + a.package_unit, + hmb.brand, + hmb.packaging, + a.total_count +