diff --git a/com/openhis/web/outpatient/mapper/OrderMapper.java b/com/openhis/web/outpatient/mapper/OrderMapper.java
index 1fb3efa8d..f6db07fea 100644
--- a/com/openhis/web/outpatient/mapper/OrderMapper.java
+++ b/com/openhis/web/outpatient/mapper/OrderMapper.java
@@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
+import java.util.List;
import java.util.Map;
/**
@@ -49,28 +50,51 @@ public interface OrderMapper {
*
*
诊疗目录中配置的单位保存在列 {@code total_unit_name},前端 DTO 期望的属性名为 {@code totalUnit}。
*
- * @param orderId 医嘱主键
- * @return 包含 id、itemName、totalQuantity、totalUnit 等字段的 Map
+ * @param orderId 医嘱 ID
+ * @return 包含 totalUnit 的 Map
*/
- @Select("SELECT " +
- "id, " +
- "item_name AS itemName, " +
- "total_quantity AS totalQuantity, " +
- "total_unit_name AS totalUnit " +
- "FROM his_order " +
- "WHERE id = #{orderId}")
+ @Select("SELECT id, item_name AS itemName, total_quantity AS totalQuantity, " +
+ "total_unit_name AS totalUnit FROM his_order_detail WHERE order_id = #{orderId}")
Map selectOrderDetailById(@Param("orderId") Long orderId);
- // 下面是其他已存在的方法(如 updateOrderStatusToCancelled、updateOrderStatusToPaid 等),
- // 这里省略实现细节,仅保留接口声明以保持编译通过。
-
- @Update("UPDATE his_order SET status = #{status} WHERE id = #{orderId}")
- int updateOrderStatusToCancelled(@Param("orderId") Long orderId,
- @Param("status") String status);
-
+ /**
+ * 将医嘱状态更新为已支付。
+ *
+ * @param orderId 医嘱 ID
+ * @param status 状态码,建议使用 {@link #ORDER_STATUS_PAID}
+ * @return 受影响的行数
+ */
@Update("UPDATE his_order SET status = #{status} WHERE id = #{orderId}")
int updateOrderStatusToPaid(@Param("orderId") Long orderId,
@Param("status") String status);
- // 其他分页查询等方法保持不变...
+ /**
+ * 将医嘱状态更新为已取消(退号)。
+ *
+ * @param orderId 医嘱 ID
+ * @param status 状态码,建议使用 {@link #ORDER_STATUS_CANCELLED}
+ * @return 受影响的行数
+ */
+ @Update("UPDATE his_order SET status = #{status} WHERE id = #{orderId}")
+ int updateOrderStatusToCancelled(@Param("orderId") Long orderId,
+ @Param("status") String status);
+
+ /**
+ * 分页查询待写病历的医嘱,仅返回前端需要的字段,提升查询性能。
+ *
+ * @param doctorId 医生 ID
+ * @param offset 起始行
+ * @param limit 每页行数
+ * @return 医嘱列表
+ */
+ @Select("")
+ List