Fix Bug #561: AI修复
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
package com.openhis.web.outpatient.mapper;
|
||||
|
||||
import com.openhis.web.outpatient.vo.MedicalOrderVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 门诊医嘱数据访问层
|
||||
*
|
||||
* 修复 Bug #561:
|
||||
* 原查询未关联诊疗目录表或未正确映射 usage_unit 字段,导致前端总量单位显示为 null。
|
||||
* 现显式 LEFT JOIN 诊疗目录表,并将 c.usage_unit 映射为 total_unit 返回。
|
||||
*/
|
||||
@Mapper
|
||||
public interface MedicalOrderMapper {
|
||||
|
||||
/**
|
||||
* 根据患者ID查询医嘱列表(含手术/检查/药品等)
|
||||
*
|
||||
* @param patientId 患者ID
|
||||
* @return 医嘱VO列表
|
||||
*/
|
||||
@Select("<script>" +
|
||||
"SELECT " +
|
||||
" o.id, " +
|
||||
" o.order_no, " +
|
||||
" o.catalog_id, " +
|
||||
" o.total_quantity, " +
|
||||
" o.status, " +
|
||||
" o.create_time, " +
|
||||
" c.catalog_name, " +
|
||||
" c.usage_unit AS total_unit " +
|
||||
"FROM his_medical_order o " +
|
||||
"LEFT JOIN his_treatment_catalog c ON o.catalog_id = c.id " +
|
||||
"WHERE o.patient_id = #{patientId} " +
|
||||
"ORDER BY o.create_time DESC" +
|
||||
"</script>")
|
||||
List<MedicalOrderVO> selectOrdersByPatientId(@Param("patientId") Long patientId);
|
||||
|
||||
/**
|
||||
* 插入新医嘱
|
||||
*/
|
||||
@Select("INSERT INTO his_medical_order (patient_id, catalog_id, total_quantity, status, create_time) " +
|
||||
"VALUES (#{patientId}, #{catalogId}, #{totalQuantity}, 0, NOW())")
|
||||
int insertOrder(@Param("patientId") Long patientId,
|
||||
@Param("catalogId") Long catalogId,
|
||||
@Param("totalQuantity") Integer totalQuantity);
|
||||
}
|
||||
Reference in New Issue
Block a user