yxh
6 天以前 68ff33beff11310e830b0615b5a81f83fad0f683
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/devrent/DevRentMapper.java
@@ -63,6 +63,28 @@
    @Select("select * from lihu.dev_rent where state=#{state} and pat_id=#{patId} and check_type=#{checkType} and to_days(create_time)=to_days(now())")
    List<DevRentDO> selectByPatAndChecktypeAndState(@Param("patId") String patId, @Param("checkType") Integer checkType, @Param("state") Integer state);
    /**
     * 该患者 + 检查项目、**今日**、状态在给定集合里的**最近一条**检查单。
     *
     * <p>两处用途:
     * <ol>
     *   <li>【撤销回滚】撤销「检查完成」时,把 60(常规检查完成) 的单找出来回滚成 0(待检查);</li>
     *   <li>【完成兜底】再次完成时若找不到「待检查(0)」的单,用最近一条 60/50 的单兜底复用,
     *       避免直接报「请先预约确认」。</li>
     * </ol>
     */
    @Select("<script>" +
            "select * from lihu.dev_rent where pat_id=#{patId} and check_type=#{checkType} " +
            "  and to_days(create_time)=to_days(now()) and state in ( " +
            "   <foreach collection='stateList' separator=',' item='state'>#{state}</foreach> ) " +
            " order by id desc limit 1" +
            "</script>")
    @Results({
            @Result(property = "patDetails", column = "pat_details", typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler.class)
    })
    DevRentDO selectLatestByPatCheckTypeStates(@Param("patId") String patId, @Param("checkType") Integer checkType,
                                               @Param("stateList") List<Integer> stateList);
    @Select("<script>" +
            "SELECT paid FROM lihu.dev_rent " +
            "where id in (" +