Files
his/com/openhis/web/inpatient/mapper/DispensingDetailMapper.java
2026-05-27 00:32:16 +08:00

39 lines
1.2 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.openhis.web.inpatient.mapper;
import org.apache.ibatis.annotations.*;
import java.util.List;
import java.util.Map;
/**
* 发药明细 Mapper
*
* 新增 batchInsertDetail 方法,统一使用 Map 参数,便于前端传递任意字段。
*/
@Mapper
public interface DispensingDetailMapper {
/**
* 批量插入发药明细。
*
* @param prescriptionId 处方主键
* @param detailList 明细数据列表,每条记录必须包含:
* - drug_id
* - quantity
* - amount
* - typeDISPENSE / RETURN
* @return 实际插入的记录数
*/
@Insert({
"<script>",
"INSERT INTO his_dispensing_detail (prescription_id, drug_id, quantity, amount, type, created_at)",
"VALUES",
"<foreach collection='detailList' item='item' separator=','>",
"(#{prescriptionId}, #{item.drugId}, #{item.quantity}, #{item.amount}, #{item.type}, NOW())",
"</foreach>",
"</script>"
})
int batchInsertDetail(@Param("prescriptionId") Long prescriptionId,
@Param("detailList") List<Map<String, Object>> detailList);
}