fix: 药品实时库存,代码提交。

This commit is contained in:
tianyongbao
2024-10-22 20:28:52 +08:00
parent bf5efee7b5
commit 29a63f9966
6 changed files with 119 additions and 48 deletions

View File

@@ -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<HealthMedicineStockInVo> list = healthMedicineStockInService.selectHealthMedicineRealtimeList(healthMedicineStockInDto);
return getDataTable(list);
}
}

View File

@@ -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<HealthMedicineStockInVo> selectHealthMedicineRealtimeList(HealthMedicineStockInDto healthMedicineStockInDto);
}

View File

@@ -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<HealthMedicineStockInVo> selectHealthMedicineRealtimeList(HealthMedicineStockInDto healthMedicineStockInDto);
}

View File

@@ -101,4 +101,16 @@ public class HealthMedicineStockInServiceImpl implements IHealthMedicineStockInS
{
return healthMedicineStockInMapper.removeHealthMedicineStockInById(id);
}
/**
* 查询药品实时库存列表
*
* @param healthMedicineStockInDto 药品入库清单
* @return 药品入库清单
*/
@Override
public List<HealthMedicineStockInVo> selectHealthMedicineRealtimeList(HealthMedicineStockInDto healthMedicineStockInDto)
{
return healthMedicineStockInMapper.selectHealthMedicineRealtimeList(healthMedicineStockInDto);
}
}

View File

@@ -33,7 +33,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectHealthMarRecordVo">
select
a.id,
a.name,
a.type,
a.create_by,
a.create_time,
@@ -53,13 +52,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.content,
a.content_unit,
hp."name" as person_name ,
hr."name" as health_record_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
left join health_medicine_basic hmb on
hmb.id = a.medicine_id
</sql>
<select id="selectHealthMarRecordList" parameterType="HealthMarRecordDto" resultMap="HealthMarRecordResult">

View File

@@ -56,7 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.purchase_address,
a.unit,
a.total_price,
hmb."name" as medicine_name,
hmb.short_name || '-' || hmb.brand || '(' || hmb.packaging || ')' as medicine_name,
a.package_unit,
a.total_count
from
@@ -173,7 +173,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ageWeight != null">age_weight = #{ageWeight},</if>
<if test="unit != null">unit = #{unit},</if>
<if test="packageUnit != null">package_unit = #{packageUnit},</if>
<if test="totalCount != null">total_count = #{packageUnit},</if>
<if test="totalCount != null">total_count = #{totalCount},</if>
</trim>
where id = #{id}
</update>
@@ -198,4 +198,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</update>
<select id="selectHealthMedicineRealtimeList" parameterType="HealthMedicineStockInDto" resultMap="HealthMedicineStockInResult">
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
<where>
a.del_flag='0'
and a.left_count>0
<if test="medicineId != null "> and a.medicine_id = #{medicineId}</if>
</where>
<!-- 数据范围过滤 -->
${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
</select>
</mapper>