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

import cn.hnthyy.thmz.entity.his.zy.ZyDetailCharge;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface YpZyPatientMapper {
    /**
     * 查询住院病人发药明细表中的住院明细
     *
     * @param inpatientNo 住院号
     * @param admissTimes 住院次数
     * @param infantFlag  是否婴儿
     * @return
     */
    @Select({"<script>",
            "SELECT rtrim(inpatient_no) inpatientNo,  " +
                    " admiss_times admissTimes, " +
                    " chargeDate=order_date, " +
                    " rtrim(charge_code) chargeCode, " +
                    " infant_flag infantFlag, " +
                    " chargeStatus='6', " +
                    " chargeFee=round(retprice * amount,2), " +
                    " self_flag selfFlag, " +
                    " separate_flag separateFlag, " +
                    " suprice_flag supriceFlag, " +
                    " ward_code wardCode, " +
                    " dept_code deptCode, " +
                    " orderNo=abs(act_order_no), " +
                    " opFlag='0', " +
                    " execUnit='', " +
                    "    chargeAmount=amount, " +
                    "    page_no pageNo " +
                    ",serial " +
                    "FROM yp_zy_patient (nolock) " +
                    "WHERE inpatient_no = #{inpatientNo}" +
                    "    and " +
                    "        admiss_times = #{admissTimes} and " +
                    "        acct_sign    ='0' and pay_self not in('2','3') and  " +
                    "        infant_flag=#{infantFlag}"
            , "</script>"})
    List<Map<String, Object>> selectZyDetailChargesFromYpZyPatient(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes, @Param("infantFlag") String infantFlag);
}
