package thyyxxk.webserver.dao.his.medicalinsurance; 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 org.apache.ibatis.annotations.Update; import thyyxxk.webserver.entity.medicalinsurance.inpatient.ZyInactpatient; import thyyxxk.webserver.entity.medicalinsurance.setlinfo.SiSetlinfo; import java.util.List; import java.util.Map; /** * @description: 结算基本信息 * @author: DingJie * @create: 2021/7/1317:20 */ @Mapper public interface SiSetlinfoDao extends BaseMapper { /** * 更新患者的医保基本信息(结算id) * * @param patNo 住院号/门诊号 * @param times 住院次数/门诊次数 * @param ledgerSn 账页号 * @param setlId 结算id * @param medinsSetlId 医药机构结算ID,存放发送方报文ID */ @Update("update t_si_pat_info set setl_id=#{setlId},medins_setl_id=#{medinsSetlId}," + "setl_msgid=#{setlMsgid} where pat_no=#{patNo} and times=#{times} and ledger_sn=#{ledgerSn}") void updateSiZyInfoSetlId(@Param("patNo") String patNo, @Param("times") int times, @Param("ledgerSn") int ledgerSn, @Param("setlId") String setlId, @Param("medinsSetlId") String medinsSetlId, @Param("setlMsgid") String setlMsgid); @Update("update t_si_settle_apply set settled=#{settled} where pat_no=#{patNo} and times=#{times} and ledger_sn=#{ledgerSn} and " + "sort_no=(select max(sort_no) from t_si_settle_apply d where d.pat_no=#{patNo} and d.times=#{times} and d.ledger_sn=#{ledgerSn})") void updateApplySettled(@Param("patNo") String patNo, @Param("times") int times, @Param("ledgerSn") int ledgerSn, @Param("settled") int settled); @Select("select a.*,b.insuplc_admdvs from t_si_setlinfo a, t_si_pat_info b where setl_type=#{setlType} " + "and revoked=0 and setl_time>=#{begndate} and setl_time<=#{enddate} and a.setl_id=b.setl_id") List selectSetlinfos(@Param("setlType") String setlType, @Param("begndate") String begndate, @Param("enddate") String enddate); @Select("select a.*,b.insuplc_admdvs from t_si_setlinfo a, t_si_pat_info b where setl_type=#{setlType} " + "and revoked=0 and a.insutype=#{insutype} and setl_time>=#{begndate} " + "and setl_time<=#{enddate} and a.setl_id=b.setl_id") List selectSetlinfosWithInsutype(@Param("setlType") String setlType, @Param("insutype") String insutype, @Param("begndate") String begndate, @Param("enddate") String enddate); @Select("select *,sbjjPay=(select fund_payamt from t_si_setldetail " + "where setl_id=a.setl_id and fund_pay_type='650100') from t_si_setlinfo a " + "where setl_type=#{setltype} and revoked=0 and insutype like #{insutype} " + "and setl_time>=#{begntime} and setl_time<=#{endtime} ${insuplcAdmdvs}") List selectMyList(@Param("setltype") String setltype, @Param("insutype") String insutype, @Param("insuplcAdmdvs") String insuplcAdmdvs, @Param("begntime") String begntime, @Param("endtime") String endtime); @Select("select psn_no,setl_id,mdtrt_id,insuplc_admdvs from t_si_setlinfo with(nolock) " + "where revoked=0 and charges_analyzed=0") List selectUnAnalyzedData(); @Update("update t_si_setlinfo set charge_western_medicine=#{chargeWesternMedicine}, " + "charge_patent_medicine=#{chargePatentMedicine},charge_herbal=#{chargeHerbal}, " + "charge_examination=#{chargeExamination},charge_treatment=#{chargeTreatment}," + "charge_operation=#{chargeOperation},charge_nursing=#{chargeNursing}, " + "charge_sanitary_material=#{chargeSanitaryMaterial},charge_assay=#{chargeAssay}, " + "charge_general_diagnosis=#{chargeGeneralDiagnosis},charge_inspection=#{chargeInspection}, " + "charge_registration=#{chargeRegistration},charge_bed=#{chargeBed},charge_others=#{chargeOthers}, " + "charges_analyzed=#{chargesAnalyzed} where setl_id=#{setlId}") void fillAnalyzedData(SiSetlinfo setlinfo); @Select(" ") List selectZyPatient(@Param("list") List list); @Select(" ") List selectMzPatient(@Param("list") List list); @Select("select count(1) from t_si_setlinfo where setl_id=#{setlId} and revoked=0") int getSetlCount(String setlId); }