123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- package org.dromara.web.mapper;
- import org.apache.ibatis.annotations.Param;
- import org.apache.ibatis.annotations.Select;
- import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
- import org.dromara.web.domain.HospitalMealPlan;
- import org.dromara.web.domain.vo.EnteralNutritionQueryOneVo;
- import org.dromara.web.domain.vo.HospitalMealPlanQueryVo;
- import org.dromara.web.domain.vo.HospitalMealPlanVo;
- import org.springframework.stereotype.Repository;
- import java.util.List;
- /**
- * 院内膳食主Mapper接口
- *
- * @author Lion Li
- * @date 2025-07-23
- */
- @Repository
- public interface HospitalMealPlanMapper extends BaseMapperPlus<HospitalMealPlan, HospitalMealPlanVo> {
- @Select("<script>" +
- "SELECT " +
- " MIN(hmr.id) AS id, " +
- " hmp.settlement_id AS settlementId, " +
- " GROUP_CONCAT(DISTINCT hmr.id) AS idStr, " +
- " GROUP_CONCAT(DISTINCT hmr.food_name) AS productName, " +
- " MIN(hmr.create_time) AS prescriptionDate, " +
- " hmr.recipe_no AS recipeNo, " +
- " MIN(hmr.execute_date) AS executeDate, " +
- " MIN(hmr.meal_time) AS mealTime, " +
- " hmr.eat_time AS eatTime, " +
- " MIN(hmr.execute_time) AS executeTime, " +
- " MIN(se.payment_status) AS paymentStatus, " +
- " MIN(hmr.execute_status) AS executeStatus, " +
- " MIN(hmr.make_status) AS makeStatus, " +
- " MIN(hmr.make_time) AS makeTime, " +
- " MIN(hmr.make_by) AS makeBy, " +
- " MIN(hmr.execute_by) AS executeBy, " +
- " MIN(hmr.tag_print_num) AS tagPrintNum, " +
- " MIN(sd.dept_name) AS patientDepartment, " +
- " MIN(se.visit_type) AS visitType, " +
- " MIN(tu.id_card) AS idCard, " +
- " MIN(tu.outpatient_no) AS patientNo, " +
- " MIN(tu.bed_no) AS bedNo, " +
- " MIN(tu.ward_name) AS wardName, " +
- " MIN(tu.treat_num) AS treatNum, " +
- " MIN(su.user_name) AS makeByName, " +
- " MIN(syu.user_name) AS executeByName, " +
- " MIN(tu.treat_name) AS patientName, " +
- " MIN(se.stop_date) AS stopDate, " +
- " MIN(se.patient_id) AS patientId, " +
- " MIN(hmp.recommend_start_date) AS recommendStartDate, " +
- " MIN(hmp.recommend_end_date) AS recommendEndDate, " +
- " MIN(hmr.del_flag) AS delFlag " +
- "FROM hospital_meal_recipe hmr " +
- "LEFT JOIN hospital_meal_plan hmp ON hmr.plan_id = hmp.id AND IFNULL(hmp.del_Flag, '0') != '1' " +
- "LEFT JOIN settlement se ON hmp.settlement_id = se.id AND IFNULL(se.del_Flag, '0') != '1' " +
- "LEFT JOIN sys_user su ON hmr.make_by = su.user_id AND IFNULL(su.del_Flag, '0') != '1' " +
- "LEFT JOIN sys_user syu ON hmr.execute_by = syu.user_id AND IFNULL(syu.del_Flag, '0') != '1' " +
- "LEFT JOIN treatment_user tu ON se.patient_id = tu.id AND IFNULL(tu.del_Flag, '0') != '1' " +
- "LEFT JOIN sys_dept sd ON se.door_id = sd.dept_id AND IFNULL(sd.del_Flag, '0') != '1' " +
- "WHERE 1 = 1 " +
- "<if test='prescriptionType != null and prescriptionType != \"\"'> and se.charge_type = #{prescriptionType} </if> " +
- "<if test='visitType != null and visitType != \"\"'> and se.visit_type = #{visitType} </if> " +
- "<if test='makeStatus != null and makeStatus != \"\"'> and hmr.make_status = #{makeStatus} </if> " +
- "<if test='paymentStatus != null and paymentStatus != \"\"'> and se.payment_status = #{paymentStatus} </if> " +
- "<if test='executeStatus != null and executeStatus != \"\"'> and hmr.execute_status = #{executeStatus} </if> " +
- "<if test='doorId != null'> and se.door_id = #{doorId} </if> " +
- "<if test='wardId != null'> and se.ward_id = #{wardId} </if> " +
- "<if test='searchValue != null and searchValue != \"\"'> and (tu.treat_num like concat('%', #{searchValue}, '%') " +
- "or tu.treat_name like concat('%', #{searchValue}, '%') or tu.id_card like concat('%', #{searchValue}, '%') " +
- "or tu.outpatient_no like concat('%', #{searchValue}, '%') or hmp.settlement_id like concat('%', #{searchValue}, '%')) </if> " +
- "<if test='beginTime != null'> and hmr.create_time <![CDATA[>=]]> #{beginTime} </if> " +
- "<if test='endTime != null'> and hmr.create_time <![CDATA[<=]]> #{endTime} </if> " +
- "<if test='exeBeginTime != null'> and hmr.execute_date <![CDATA[>=]]> #{exeBeginTime} </if> " +
- "<if test='exeEndTime != null'> and hmr.execute_date <![CDATA[<=]]> #{exeEndTime} </if> " +
- "GROUP BY hmr.plan_id, hmr.recipe_no, hmp.settlement_id, hmr.eat_time " +
- "ORDER BY MIN(hmr.create_time) DESC " +
- "<if test='offset != null and rows != null'>LIMIT #{offset}, #{rows}</if>" +
- "</script>")
- List<HospitalMealPlanQueryVo> queryPageVoList(@Param("prescriptionType") String prescriptionType, @Param("visitType") String visitType, @Param("makeStatus") String makeStatus,
- @Param("paymentStatus") String paymentStatus, @Param("executeStatus") String executeStatus, @Param("doorId") Long doorId,
- @Param("wardId") Long wardId, @Param("searchValue") String searchValue, @Param("beginTime") String beginTime,
- @Param("endTime") String endTime, @Param("exeBeginTime") String exeBeginTime,
- @Param("exeEndTime") String exeEndTime, @Param("offset") Integer offset, @Param("rows") Integer rows);
- @Select("<script>" +
- "SELECT COUNT(*) FROM ( SELECT 1 FROM hospital_meal_recipe hmr " +
- "LEFT JOIN hospital_meal_plan hmp ON hmr.plan_id = hmp.id AND IFNULL(hmp.del_Flag, '0') != '1' " +
- "LEFT JOIN settlement se ON hmp.settlement_id = se.id AND IFNULL(se.del_Flag, '0') != '1' " +
- "LEFT JOIN sys_user su ON hmr.make_by = su.user_id AND IFNULL(su.del_Flag, '0') != '1' " +
- "LEFT JOIN sys_user syu ON hmr.execute_by = syu.user_id AND IFNULL(syu.del_Flag, '0') != '1' " +
- "LEFT JOIN treatment_user tu ON se.patient_id = tu.id AND IFNULL(tu.del_Flag, '0') != '1' " +
- "LEFT JOIN sys_dept sd ON se.door_id = sd.dept_id AND IFNULL(sd.del_Flag, '0') != '1' " +
- "WHERE 1 = 1 " +
- "<if test='prescriptionType != null and prescriptionType != \"\"'> and se.charge_type = #{prescriptionType} </if> " +
- "<if test='visitType != null and visitType != \"\"'> and se.visit_type = #{visitType} </if> " +
- "<if test='makeStatus != null and makeStatus != \"\"'> and hmr.make_status = #{makeStatus} </if> " +
- "<if test='paymentStatus != null and paymentStatus != \"\"'> and se.payment_status = #{paymentStatus} </if> " +
- "<if test='executeStatus != null and executeStatus != \"\"'> and hmr.execute_status = #{executeStatus} </if> " +
- "<if test='doorId != null '> and se.door_id = #{doorId} </if> " +
- "<if test='wardId != null '> and se.ward_id = #{wardId} </if> " +
- "<if test='searchValue != null and searchValue != \"\"'> and (tu.treat_num like concat('%', #{searchValue}, '%') " +
- "or tu.treat_name like concat('%', #{searchValue}, '%') or tu.id_card like concat('%', #{searchValue}, '%')" +
- "or tu.outpatient_no like concat('%', #{searchValue}, '%') or hmp.settlement_id like concat('%', #{searchValue}, '%')) </if> " +
- "<if test='beginTime != null'> and hmr.create_time <![CDATA[>=]]> #{beginTime} </if>" +
- "<if test='endTime != null'> and hmr.create_time <![CDATA[<=]]> #{endTime} </if>" +
- "<if test='exeBeginTime != null'> and hmr.execute_date <![CDATA[>=]]> #{exeBeginTime} </if>" +
- "<if test='exeEndTime != null'> and hmr.execute_date <![CDATA[<=]]> #{exeEndTime} </if>" +
- "GROUP BY hmr.plan_id, hmr.recipe_no,hmp.settlement_id, hmr.eat_time ) t" +
- "</script>")
- Integer queryPageVoCount(@Param("prescriptionType") String prescriptionType, @Param("visitType") String visitType, @Param("makeStatus") String makeStatus,
- @Param("paymentStatus") String paymentStatus, @Param("executeStatus") String executeStatus, @Param("doorId") Long doorId,
- @Param("wardId") Long wardId, @Param("searchValue") String searchValue, @Param("beginTime") String beginTime,
- @Param("endTime") String endTime, @Param("exeBeginTime") String exeBeginTime,
- @Param("exeEndTime") String exeEndTime);
- }
|