<?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.huimv.management.dao.HealthMedicalRecordDao">

	<!-- 可根据自己的需求，是否要使用 -->
    <resultMap type="com.huimv.management.entity.HealthMedicalRecordEntity" id="healthMedicalRecordMap">
        <result property="id" column="id"/>
        <result property="pigId" column="pig_id"/>
        <result property="diseaseName" column="disease_name"/>
        <result property="symptomName" column="symptom_name"/>
        <result property="causeName" column="cause_name"/>
        <result property="diseaseTime" column="disease_time"/>
        <result property="doctor" column="doctor"/>
        <result property="doctorId" column="doctor_id"/>
        <result property="diagnosisTime" column="diagnosis_time"/>
        <result property="treatmentPlan" column="treatment_plan"/>
        <result property="result" column="result"/>
        <result property="farmId" column="farm_id"/>
        <result property="effective" column="effective"/>
        <result property="isolationStatus" column="isolation_status"/>
        <result property="offTime" column="off_time"/>
        <result property="createTime" column="create_time"/>
    </resultMap>


    <select id="diseaseCount" resultType="com.huimv.management.entity.dto.DiseaseDto">
        select
         disease_name ,
         COUNT(id) count_disease
         FROM `health_medical_record`
        ${ew.customSqlSegment}
        GROUP BY  disease_name
    </select>

    <select id="treatResultCount" resultType="com.huimv.management.entity.dto.TreatResultDto">
        select
         result treatResult ,
         COUNT(id) treatResultCount
         FROM `health_medical_record`
        ${ew.customSqlSegment}
        GROUP BY  result
    </select>


</mapper>