package cn.hnthyy.thmz.mapper.his.mz;

import cn.hnthyy.thmz.entity.his.mz.MzZyReq;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface MzZyReqMapper {
    /**
     * 查询病人的入院证（有效）
     * @param patientId
     * @return
     */
    @Select("select * from mz_zy_req where patient_id=#{patientId} and req_status = 0 order by visit_date desc ")
    List<MzZyReq> selectMzZyReqByPatientId(@Param("patientId") String patientId);

    /**
     * 设置门诊祝愿证为已经入院
     * @param mzZyReq
     * @return
     */
    @Update("update mz_zy_req set confirm_id=#{confirmId},confirm_date=#{confirmDate},zy_serial_no=#{zySerialNo},req_status=#{reqStatus} where patient_id =#{patientId} and req_status=0")
    int updateMzZyReq(MzZyReq mzZyReq);
}
