SiSetlinfoDao.java 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. package thyyxxk.webserver.dao.his.medicalinsurance;
  2. import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  3. import org.apache.ibatis.annotations.Mapper;
  4. import org.apache.ibatis.annotations.Param;
  5. import org.apache.ibatis.annotations.Select;
  6. import org.apache.ibatis.annotations.Update;
  7. import thyyxxk.webserver.entity.medicalinsurance.inpatient.ZyInactpatient;
  8. import thyyxxk.webserver.entity.medicalinsurance.setlinfo.SiSetlinfo;
  9. import java.util.List;
  10. import java.util.Map;
  11. /**
  12. * @description: 结算基本信息
  13. * @author: DingJie
  14. * @create: 2021/7/1317:20
  15. */
  16. @Mapper
  17. public interface SiSetlinfoDao extends BaseMapper<SiSetlinfo> {
  18. /**
  19. * 更新患者的医保基本信息(结算id)
  20. *
  21. * @param patNo 住院号/门诊号
  22. * @param times 住院次数/门诊次数
  23. * @param ledgerSn 账页号
  24. * @param setlId 结算id
  25. * @param medinsSetlId 医药机构结算ID,存放发送方报文ID
  26. */
  27. @Update("update t_si_pat_info set setl_id=#{setlId},medins_setl_id=#{medinsSetlId}," +
  28. "setl_msgid=#{setlMsgid} where pat_no=#{patNo} and times=#{times} and ledger_sn=#{ledgerSn}")
  29. void updateSiZyInfoSetlId(@Param("patNo") String patNo,
  30. @Param("times") int times,
  31. @Param("ledgerSn") int ledgerSn,
  32. @Param("setlId") String setlId,
  33. @Param("medinsSetlId") String medinsSetlId,
  34. @Param("setlMsgid") String setlMsgid);
  35. @Update("update t_si_settle_apply set settled=#{settled} where pat_no=#{patNo} and times=#{times} and ledger_sn=#{ledgerSn} and " +
  36. "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})")
  37. void updateApplySettled(@Param("patNo") String patNo,
  38. @Param("times") int times,
  39. @Param("ledgerSn") int ledgerSn,
  40. @Param("settled") int settled);
  41. @Select("select a.*,b.insuplc_admdvs from t_si_setlinfo a, t_si_pat_info b where setl_type=#{setlType} " +
  42. "and revoked=0 and setl_time>=#{begndate} and setl_time<=#{enddate} and a.setl_id=b.setl_id")
  43. List<SiSetlinfo> selectSetlinfos(@Param("setlType") String setlType,
  44. @Param("begndate") String begndate,
  45. @Param("enddate") String enddate);
  46. @Select("select a.*,b.insuplc_admdvs from t_si_setlinfo a, t_si_pat_info b where setl_type=#{setlType} " +
  47. "and revoked=0 and a.insutype=#{insutype} and setl_time>=#{begndate} " +
  48. "and setl_time<=#{enddate} and a.setl_id=b.setl_id")
  49. List<SiSetlinfo> selectSetlinfosWithInsutype(@Param("setlType") String setlType,
  50. @Param("insutype") String insutype,
  51. @Param("begndate") String begndate,
  52. @Param("enddate") String enddate);
  53. @Select("select *,sbjjPay=(select fund_payamt from t_si_setldetail " +
  54. "where setl_id=a.setl_id and fund_pay_type='650100') from t_si_setlinfo a " +
  55. "where setl_type=#{setltype} and revoked=0 and insutype like #{insutype} " +
  56. "and setl_time>=#{begntime} and setl_time<=#{endtime} ${insuplcAdmdvs}")
  57. List<SiSetlinfo> selectMyList(@Param("setltype") String setltype,
  58. @Param("insutype") String insutype,
  59. @Param("insuplcAdmdvs") String insuplcAdmdvs,
  60. @Param("begntime") String begntime,
  61. @Param("endtime") String endtime);
  62. @Select("select psn_no,setl_id,mdtrt_id,insuplc_admdvs from t_si_setlinfo with(nolock) " +
  63. "where revoked=0 and charges_analyzed=0")
  64. List<SiSetlinfo> selectUnAnalyzedData();
  65. @Update("update t_si_setlinfo set charge_western_medicine=#{chargeWesternMedicine}, " +
  66. "charge_patent_medicine=#{chargePatentMedicine},charge_herbal=#{chargeHerbal}, " +
  67. "charge_examination=#{chargeExamination},charge_treatment=#{chargeTreatment}," +
  68. "charge_operation=#{chargeOperation},charge_nursing=#{chargeNursing}, " +
  69. "charge_sanitary_material=#{chargeSanitaryMaterial},charge_assay=#{chargeAssay}, " +
  70. "charge_general_diagnosis=#{chargeGeneralDiagnosis},charge_inspection=#{chargeInspection}, " +
  71. "charge_registration=#{chargeRegistration},charge_bed=#{chargeBed},charge_others=#{chargeOthers}, " +
  72. "charges_analyzed=#{chargesAnalyzed} where setl_id=#{setlId}")
  73. void fillAnalyzedData(SiSetlinfo setlinfo);
  74. @Select(" <script> " +
  75. " <foreach collection='list' item='item' index='index' separator=' union all '> " +
  76. " select rtrim(t.inpatient_no) as inpatient_no, rtrim(t.admiss_times) as admiss_times, " +
  77. " z.name as dept, e.name as jobDoctor, t.clinic_diag_str " +
  78. " from zy_inactpatient t " +
  79. " left join zd_unit_code z on t.zk_ward = z.code " +
  80. " left join a_employee_mi e on t.refer_physician = e.code " +
  81. " where t.inpatient_no = #{item.patNo} and t.admiss_times = #{item.times} " +
  82. " </foreach> " +
  83. " </script> ")
  84. List<ZyInactpatient> selectZyPatient(@Param("list") List<SiSetlinfo> list);
  85. @Select(" <script> " +
  86. " <foreach collection='list' item='item' index='index' separator=' union all '> " +
  87. " select rtrim(t.patient_id) as patNo, t.times, z.name as dept, " +
  88. " e.name as doctor, t.icd_text_new as zyzd " +
  89. " from mz_visit_table t " +
  90. " left join zd_unit_code z on t.visit_dept_code = z.code " +
  91. " left join a_employee_mi e on t.doctor_code = e.code " +
  92. " where t.patient_id = #{item.patNo} and t.times = #{item.times} " +
  93. " </foreach> " +
  94. " </script> ")
  95. List<Map> selectMzPatient(@Param("list") List<SiSetlinfo> list);
  96. @Select("select count(1) from t_si_setlinfo where setl_id=#{setlId} and revoked=0")
  97. int getSetlCount(String setlId);
  98. }