39 lines
1.2 KiB
Java
39 lines
1.2 KiB
Java
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
|
||
* - type(DISPENSE / 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);
|
||
}
|