SiSetlinfoDao.java 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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'), " +
  55. "cyzd=case when #{setltype}='21' then " +
  56. "(select rtrim(dis_diag_comment) from zy_dis_diag_yb " +
  57. "where inpatient_no=a.pat_no and admiss_times=a.times and dis_diag_no=1) " +
  58. "else (select isnull(icd_text_new, '') from mz_visit_table " +
  59. "where a.pat_no=patient_id and a.times=times) end " +
  60. "from t_si_setlinfo a " +
  61. "where setl_type=#{setltype} and revoked=0 and insutype like #{insutype} " +
  62. "and setl_time>=#{begntime} and setl_time<=#{endtime} ${insuplcAdmdvs}")
  63. List<SiSetlinfo> selectMyList(@Param("setltype") String setltype,
  64. @Param("insutype") String insutype,
  65. @Param("insuplcAdmdvs") String insuplcAdmdvs,
  66. @Param("begntime") String begntime,
  67. @Param("endtime") String endtime);
  68. @Select("select psn_no,setl_id,mdtrt_id,insuplc_admdvs from t_si_setlinfo with(nolock) " +
  69. "where revoked=0 and charges_analyzed=0")
  70. List<SiSetlinfo> selectUnAnalyzedData();
  71. @Update("update t_si_setlinfo set charge_western_medicine=#{chargeWesternMedicine}, " +
  72. "charge_patent_medicine=#{chargePatentMedicine},charge_herbal=#{chargeHerbal}, " +
  73. "charge_examination=#{chargeExamination},charge_treatment=#{chargeTreatment}," +
  74. "charge_operation=#{chargeOperation},charge_nursing=#{chargeNursing}, " +
  75. "charge_sanitary_material=#{chargeSanitaryMaterial},charge_assay=#{chargeAssay}, " +
  76. "charge_general_diagnosis=#{chargeGeneralDiagnosis},charge_inspection=#{chargeInspection}, " +
  77. "charge_registration=#{chargeRegistration},charge_bed=#{chargeBed},charge_others=#{chargeOthers}, " +
  78. "charges_analyzed=#{chargesAnalyzed} where setl_id=#{setlId}")
  79. void fillAnalyzedData(SiSetlinfo setlinfo);
  80. @Select(" <script> " +
  81. " <foreach collection='list' item='item' index='index' separator=' union all '> " +
  82. " select rtrim(t.inpatient_no) as inpatient_no, rtrim(t.admiss_times) as admiss_times, " +
  83. " z.name as dept, e.name as jobDoctor, t.clinic_diag_str " +
  84. " from zy_inactpatient t " +
  85. " left join zd_unit_code z on t.zk_ward=z.code " +
  86. " left join a_employee_mi e on t.refer_physician=e.code " +
  87. " where t.inpatient_no=#{item.patNo} and t.admiss_times=#{item.times} " +
  88. " </foreach> " +
  89. " </script> ")
  90. List<ZyInactpatient> selectZyPatient(@Param("list") List<SiSetlinfo> list);
  91. @Select(" <script> " +
  92. " <foreach collection='list' item='item' index='index' separator=' union all '> " +
  93. " select rtrim(t.patient_id) as patNo, t.times, z.name as dept, " +
  94. " e.name as doctor, t.icd_text_new as zyzd " +
  95. " from mz_visit_table t " +
  96. " left join zd_unit_code z on t.visit_dept_code=z.code " +
  97. " left join a_employee_mi e on t.doctor_code=e.code " +
  98. " where t.patient_id=#{item.patNo} and t.times=#{item.times} " +
  99. " </foreach> " +
  100. " </script> ")
  101. List<Map> selectMzPatient(@Param("list") List<SiSetlinfo> list);
  102. @Select("select count(1) from t_si_setlinfo where setl_id=#{setlId} and revoked=0")
  103. int getSetlCount(String setlId);
  104. }