package thyyxxk.webserver.dao.his.jiekou;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import thyyxxk.webserver.entity.fluorescenceTest.FluorescenceSpecimenResult;
import thyyxxk.webserver.entity.inpatient.patient.Patient;

@Mapper
public interface FluorescenceTestDao extends BaseMapper<FluorescenceSpecimenResult> {

    @Select("select rtrim(inpatient_no) as inpatient_no, admiss_times " +
            "from ysh_yj_req " +
            "where req_no = #{id}")
    Patient selectPatInfoByReqNo(@Param("id") Integer id);


    @Select("select patient_id as inpatient_no ,times as admiss_times" +
            " from mz_yj_req where req_no = #{id} ")
    Patient selectPatInfoMz(@Param("id") Integer id);

    @Select("select count(1) " +
            "from fluorescence_specimen_result " +
            "where id = #{id} and pat_no = #{patNo} and times = #{times}")
    Integer selectCountById(@Param("id") Integer id,
                            @Param("patNo") String patNo,
                            @Param("times") Integer times);
}
