EmrPatientDao.java 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. package thyyxxk.webserver.dao.his.zhuyuanyisheng;
  2. import org.apache.ibatis.annotations.*;
  3. import org.springframework.web.bind.annotation.RequestParam;
  4. import thyyxxk.webserver.entity.drg.AuxiliaryFillingOfDiagnosis;
  5. import thyyxxk.webserver.entity.zhuyuanyisheng.emr.EmrDataElement;
  6. import thyyxxk.webserver.entity.zhuyuanyisheng.emr.EmrDataExtract;
  7. import thyyxxk.webserver.entity.zhuyuanyisheng.emr.EmrPatientData;
  8. import java.util.List;
  9. import java.util.Map;
  10. @Mapper
  11. public interface EmrPatientDao {
  12. @Select("select id, " +
  13. " pat_no, " +
  14. " times, " +
  15. " emr_document_id, " +
  16. " emr_category_code, " +
  17. " del_flag, " +
  18. " emr_name, " +
  19. " create_id, " +
  20. " create_date, " +
  21. " modify_id, " +
  22. " modify_date, " +
  23. " name," +
  24. " submit " +
  25. "from emr_patient_data " +
  26. "where pat_no = #{patNo} " +
  27. " and times = #{times}" +
  28. " and del_flag = 0 ")
  29. List<EmrPatientData> getPatientData(@Param("patNo") String patNo,
  30. @Param("times") Integer times);
  31. @Select("select count(1) " +
  32. "from emr_patient_data " +
  33. "where pat_no = #{patNo} " +
  34. " and times = #{times} " +
  35. " and emr_document_id = #{docmentId} ")
  36. Integer whetherThereIsAMedicalRecord(@Param("patNo") String patNo,
  37. @Param("times") Integer times,
  38. @Param("docmentId") String docmentId);
  39. @Insert("insert into emr_patient_data (pat_no, times, emr_document_id, emr_category_code, emr_name,create_id,name) " +
  40. "values (#{patNo},#{times},#{emrDocumentId},#{emrCategoryCode},#{emrName},#{createId},#{name})")
  41. void emrInsertForTheFirstTime(EmrPatientData param);
  42. @Update("update emr_patient_data " +
  43. "set name = #{name}, " +
  44. " modify_date = getdate() , " +
  45. " modify_id = #{createId} " +
  46. "where pat_no = #{patNo} " +
  47. " and times = #{times} " +
  48. " and emr_document_id = #{emrDocumentId} ")
  49. void updateCreatedTemplate(EmrPatientData param);
  50. @Select("select emr_category_code,pat_no,times,create_id from emr_patient_data where emr_document_id = #{id} ")
  51. EmrPatientData getCategoryCodeByDocumentId(String id);
  52. @Update("update emr_patient_data " +
  53. "set del_flag = 1," +
  54. " modify_id = #{userCode}," +
  55. " modify_date = getdate() " +
  56. "where emr_document_id = #{documentId}")
  57. void deletePatientEmrByDocumentId(@Param("documentId") String documentId,
  58. @Param("userCode") String userCode);
  59. @Select("select count(1) " +
  60. "from emr_patient_data " +
  61. "where pat_no = #{patNo} " +
  62. " and times = #{times} " +
  63. " and del_flag = 0 " +
  64. " and emr_category_code = #{emrCategoryCode} ")
  65. Integer queryWhetherThePatientHasASpecifiedMedicalRecord(@Param("patNo") String patNo,
  66. @Param("times") Integer times,
  67. @Param("emrCategoryCode") String emrCategoryCode);
  68. @Select("select * " +
  69. "from emr_data_extract " +
  70. "where emr_category_code = #{code} ")
  71. EmrDataExtract extractDataSource(String code);
  72. @Select("select pat_no,times,data_element from emr_data_element where pat_no = #{patNo} and times = #{times}")
  73. EmrDataElement obtainPatientSOriginalData(@Param("patNo") String patNo,
  74. @Param("times") Integer times);
  75. @Insert("insert into emr_data_element (pat_no, times, data_element) " +
  76. "values (#{patNo},#{times},#{dataElement});")
  77. void insertDataSource(@Param("patNo") String patNo,
  78. @Param("times") Integer times,
  79. @Param("dataElement") String dataElement);
  80. @Update("update emr_data_element set data_element = #{dataElement} where " +
  81. "pat_no = #{patNo} and times = #{times}")
  82. void updatePatientDataSource(@Param("patNo") String patNo,
  83. @Param("times") Integer times,
  84. @Param("dataElement") String dataElement);
  85. @Select("select count(1) from hot_search_sorting where user_code = #{userCode} and code = #{code} and table_name = #{tableName}")
  86. Integer queryWhetherThereIsHotSearch(@Param("userCode") String userCode,
  87. @Param("code") String code,
  88. @Param("tableName") String tableName);
  89. @Insert("insert into hot_search_sorting (user_code, code, table_name, count) values (#{userCode}, #{code}, #{tableName}, 1)")
  90. void hotSearchSorting(@Param("userCode") String userCode,
  91. @Param("code") String code,
  92. @Param("tableName") String tableName);
  93. @Update("update hot_search_sorting set count = count + 1 where user_code = #{userCode} and code = #{code} and table_name = #{tableName}")
  94. void updateHotSearch(@Param("userCode") String userCode,
  95. @Param("code") String code,
  96. @Param("tableName") String tableName);
  97. @Select("select create_id from emr_patient_data where emr_document_id = #{id}")
  98. String getDocumentIdCreatedBy(String id);
  99. @Update("update emr_patient_data set submit = 1 where emr_document_id = #{id}")
  100. void updateSubmissionFlag(String id);
  101. @Select("select emr_document_id from emr_patient_data where pat_no = #{patNo} and times = #{times} and emr_category_code = #{categoryCode} and del_flag = 0")
  102. List<String> getDocumentIdByPatietn(String patNo, int times, String categoryCode);
  103. @Select("select rtrim(a.name) as xm, " +
  104. " dis_date as cysj, " +
  105. " a.sex as xb, " +
  106. " (select DATEDIFF(yy, birth_date, GETDATE()) from a_patient_mi b where b.inpatient_no = a.inpatient_no) as nl, " +
  107. " (select sum(charge_fee) " +
  108. " from zy_detail_charge " +
  109. " where zy_detail_charge.inpatient_no = a.inpatient_no " +
  110. " and zy_detail_charge.admiss_times = a.admiss_times " +
  111. " and ledger_sn = #{ledgerSn}) as zfy, " +
  112. " datediff(day, admiss_date, isnull(dis_date, getdate())) as sjzyts, " +
  113. " condition_code as rybq, " +
  114. " route_of_admission as rytj, " +
  115. " '' as lyfs, " +
  116. " (select insutype " +
  117. " from t_si_setlinfo " +
  118. " where a.inpatient_no = pat_no " +
  119. " and admiss_times = times) as insur_type_id, " +
  120. " '' as xsecstz, " +
  121. " '' as xserytz, " +
  122. " '' as bzyzsnl " +
  123. "from zy_actpatient a, " +
  124. " a_patient_mi b, " +
  125. " mz_zy_req c " +
  126. "where a.inpatient_no = #{patNo} " +
  127. " and admiss_times = #{times} " +
  128. " and a.inpatient_no = b.inpatient_no " +
  129. " and b.mz_no = c.patient_id")
  130. Map<String, String> drgPatientInfo(String patNo, int times, int ledgerSn);
  131. @Select("select max(admiss_times) " +
  132. "from zy_inactpatient " +
  133. "where inpatient_no = #{patNo} ")
  134. Integer getMaxTimes(String patNo);
  135. @Select("select data_element from emr_data_element where pat_no = #{patNo} and times = #{times}")
  136. Map<String, String> selectEmrDataElement(String patNo, Integer times);
  137. }