package thyyxxk.webserver.dao.his.examinations;

import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import thyyxxk.webserver.entity.examinations.covidexam.CovidExamResult;

@Mapper
public interface Covid19AssessmentDao {

    @Select("select name as ptntName, idcard, patient_id, addr_additional=isnull(addr_additional,''), " +
            "phone, addrProvince=(select t.name from t_region t where t.code=addr_province), " +
            "addrCity=(select t.name from t_region t where t.code=addr_city), " +
            "addrDistrict=(select t.name from t_region t where t.code=addr_district), " +
            "temperature=case when temperature=1 then '正常' else '发烧' end, " +
            "fever_number, date, " +
            "item1=(case when item1=11 then '中高风险地区' when item1=12 then '境外其他国家' " +
            "when item1=13 then '新冠肺炎确诊病例社区' else '都没有' end), " +
            "item2=(case when item2=21 then '中高风险地区' when item2=22 then '境外其他国家' " +
            "when item2=23 then '新冠肺炎确诊病例社区' else '都没有' end), " +
            "item3=(case when item3=31 then '有' else '没有' end), " +
            "item4=(case when item4=41 then '有' else '没有' end), " +
            "item5=(case when item5=51 then '有' else '没有' end), " +
            "item6=(case when item6=61 then '绿色' when item6=62 then '黄色' " +
            "when item6=63 then '红色' else '' end), " +
            "symptoms as symptomsString from t_covid19_assessment where date>=#{start} and date<=#{end}")
    IPage<CovidExamResult> selectAssessments(IPage<CovidExamResult> iPage, @Param("start") String start, @Param("end") String end);
}
