RuoYi-Vue-Plus/ruoyi-system/src/main/resources/mapper/fantang/FtReportMealsDaoMapper.xml
2020-12-31 13:42:43 +08:00

44 lines
2.2 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.fantang.mapper.FtReportMealsDaoMapper">
<resultMap type="FtReportMealsDao" id="FtReportMealsDaoResult">
<result property="id" column="id"/>
<result property="createAt" column="create_at"/>
<result property="type" column="type"/>
<result property="patientId" column="patient_id"/>
<result property="createBy" column="create_by"/>
<result property="foods" column="foods"/>
<result property="price" column="price"/>
<result property="settlementFlag" column="settlement_flag"/>
<result property="settlementId" column="settlement_id"/>
<result property="settlementAt" column="settlement_at"/>
<result property="settlementBy" column="settlement_by"/>
<result property="nutritionFoodId" column="nutrition_food_id"/>
<result property="nutritionFoodFlag" column="nutrition_food_flag"/>
<result property="isReplaceFood" column="is_replace_food"/>
<result property="nutritionFoodPrice" column="nutrition_food_price"/>
<result property="totalPrice" column="total_price"/>
<result property="vegetables" column="vegetables"/>
<result property="meat" column="meat"/>
<result property="rice" column="rice"/>
<result property="egg" column="egg"/>
</resultMap>
<select id="listMealsWithInSettle" resultType="com.ruoyi.system.fantang.domain.FtReportMealsDao">
select sum(a.price) as price, a.patient_id, b.hospital_id, b.bed_id, b.`name`, c.depart_name, c.depart_code
from ft_report_meals a
LEFT JOIN ft_patient b on a.patient_id = b.patient_id
LEFT JOIN ft_depart c on b.depart_id = c.depart_id
<where>
<if test="hospitalId != null">and b.hospital_id = #{hospitalId}</if>
<if test="departId != null">and b.depart_id = #{departId}</if>
<if test="name != null and name !=''">and b.name = #{name}</if>
<if test="settlementFlag != null">and a.settlement_flag = #{settlementFlag}</if>
</where>
GROUP BY a.patient_id
</select>
</mapper>