Fix Bug #503: fallback修复

This commit is contained in:
2026-05-27 00:47:48 +08:00
parent bed4d52894
commit fc9eaa18a9

View File

@@ -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 {
*
* <p>诊疗目录中配置的单位保存在列 {@code total_unit_name},前端 DTO 期望的属性名为 {@code totalUnit}。</p>
*
* @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<String, Object> 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("<script>" +
"SELECT id, patient_id AS patientId, item_name AS itemName, created_at AS createdAt " +
"FROM his_order " +
"WHERE doctor_id = #{doctorId} AND status = 'PENDING_RECORD' " +
"ORDER BY created_at DESC " +
"LIMIT #{limit} OFFSET #{offset}" +
"</script>")
List<Map<String, Object>> selectPendingMedicalRecords(@Param("doctorId") Long doctorId,
@Param("offset") int offset,
@Param("limit") int limit);
}