package thyyxxk.webserver.dao.his.zhuyuanyisheng;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import thyyxxk.webserver.entity.dictionary.CodeName;
import thyyxxk.webserver.entity.zhuyuanyisheng.contagiousdisease.CrbMainCard;

import java.util.List;

@Mapper
public interface ContagiousDiseaseDao extends BaseMapper<CrbMainCard> {

    @Select("SELECT patient_id, " +
            "       times, " +
            "       card_no, " +
            "       ill_type, " +
            "       scope_flag, " +
            "       name, " +
            "       sex, " +
            "       age, " +
            "       age_unit, " +
            "       corporation, " +
            "       relation_tel, " +
            "       genearch, " +
            "       current_district, " +
            "       current_street, " +
            "       home_district, " +
            "       home_street, " +
            "       occupation_code, " +
            "       ill_start_date, " +
            "       ill_first_date, " +
            "       admiss_date, " +
            "       dis_date, " +
            "       dischar_status, " +
            "       dis_diag_type, " +
            "       report_hospital, " +
            "       report_dept, " +
            "       zy_mz_flag, " +
            "       report_opera, " +
            "       report_date, " +
            "       anamnesis, " +
            "       rtrim(contagion) contagion, " +
            "       rtrim(contagion_text) contagion_text, " +
            "       social_no, " +
            "       rtrim(contagion2) contagion2, " +
            "       rtrim(contagion3) contagion3, " +
            "       op_id, " +
            "       input_dt, " +
            "       death_date, " +
            "       case_type, " +
            "       vaccinate, " +
            "       dc_flag, " +
            "       vaccinate2, " +
            "       rtrim(contagion_qt) contagion_qt, " +
            "       card_ret, " +
            "       report_tel, " +
            "       birth_date, " +
            "       remark, " +
            "       status_flag, " +
            "       sub_card, " +
            "       icd_code, " +
            "       print_flag, " +
            "       modify_id, " +
            "       modify_date, " +
            "       config_flag, " +
            "       config_id, " +
            "       gy_lcfx, " +
            "       gy_byfx, " +
            "       rtrim(v_alt) valt, " +
            "       rtrim(v_k_hcv) vkhcv, " +
            "       rtrim(v_zdhz) vzdhz, " +
            "       rtrim(v_hcv_rna) vhcvrna, " +
            "       rtrim(v_k_havigm) vkhavigm, " +
            "       rtrim(v_k_hdvigm) vkhdvigm, " +
            "       rtrim(v_hav_rna) vhavrna, " +
            "       rtrim(v_k_hdv) vkhdv, " +
            "       rtrim(v_hbsag) vhbsag, " +
            "       rtrim(v_hdv_rna) vhdvrna, " +
            "       rtrim(v_k_hbs) vkhbs, " +
            "       rtrim(v_k_hevigm) vkhevigm, " +
            "       rtrim(v_hbeag) vhbeag, " +
            "       rtrim(v_k_hev) vkhev, " +
            "       rtrim(v_k_hbe) vkhbe, " +
            "       rtrim(v_hev_rna) vhevrna, " +
            "       rtrim(v_k_hbc) vkhbc, " +
            "       rtrim(v_k_hbcigm) vkhbcigm, " +
            "       rtrim(v_hbv_dna) vhbvdna, " +
            "       gy_dzbm, " +
            "       visit_type, " +
            "       rtrim(c_trust) ctrust, " +
            "       rtrim(c_rpr) crpr, " +
            "       rtrim(c_tppa) ctppa, " +
            "       rtrim(c_tpha)  ctpha, " +
            "       rtrim(m_trust) mtrust, " +
            "       rtrim(m_rpr) mrpr, " +
            "       rtrim(m_tppa) mtppa, " +
            "       rtrim(m_other) mother, " +
            "       config_date, " +
            "       yun_days, " +
            "       order_code " +
            "FROM crb_main_card a " +
            "where patient_id = #{patNo} " +
            "  and status_flag <> 'd'")
    List<CrbMainCard> seleceContagiousDisease(String patNo);


    @Select("select name " +
            "from zd_icd_code_new " +
            " ${ew.customSqlSegment} ")
    List<String> selectCrbDiseList(@Param(Constants.WRAPPER) QueryWrapper<?> queryWrapper);


}
