Browse Source

DRG&DIP接口,入院诊断和出院诊断的主诊断分配

lighter 2 years ago
parent
commit
8f11791f5d

+ 19 - 6
src/main/java/thyyxxk/webserver/controller/api/forpowersi/DrgDipController.java

@@ -329,16 +329,29 @@ public class DrgDipController {
         if (null == params.getVisitId()) {
             return DrgDipResponseFactory.wrongParameters("visitId不能为空。");
         }
-        List<HisPatientDagns> list = dao.selectHisPatientDagns(params.getPatNo(), params.getTimes());
-        if (list.isEmpty()) {
+        List<HisPatientDagns> admList = dao.selectHisPatientAdmDagns(params.getPatNo(), params.getTimes());
+        List<HisPatientDagns> disList = dao.selectHisPatientDisDangs(params.getPatNo(), params.getTimes());
+        if (admList.isEmpty() && disList.isEmpty()) {
             return DrgDipResponseFactory.noCorrespondingDataFound();
         }
-        for (int i = 0; i < list.size(); i++) {
-            HisPatientDagns dagns = list.get(i);
-            dagns.setVisitId(params.getVisitId());
+        if (admList.isEmpty()) {
+            return DrgDipResponseFactory.success(accomplishDagns(disList, params.getVisitId()));
+        }
+        if (disList.isEmpty()) {
+            return DrgDipResponseFactory.success(accomplishDagns(admList, params.getVisitId()));
+        }
+        admList.get(0).setDagnsTypeId("2");
+        admList.addAll(disList);
+        return DrgDipResponseFactory.success(accomplishDagns(admList, params.getVisitId()));
+    }
+
+    private List<HisPatientDagns> accomplishDagns(List<HisPatientDagns> dangsList, String visitId) {
+        for (int i = 0; i < dangsList.size(); i++) {
+            HisPatientDagns dagns = dangsList.get(i);
+            dagns.setVisitId(visitId);
             dagns.setOrder(i + 1);
         }
-        return DrgDipResponseFactory.success(list);
+        return dangsList;
     }
 
     private JSONObject queryHisPatientOprtInfo(RequestParams params) {

+ 7 - 4
src/main/java/thyyxxk/webserver/dao/his/api/forpowersi/drgdip/DrgDipDao.java

@@ -300,16 +300,19 @@ public interface DrgDipDao {
             "dagnsWayId=1,icd_text as diseaseName, " +
             "icd_code from zy_in_diag_yb " +
             "where inpatient_no=#{patNo} and admiss_times=#{times} " +
-            "union " +
-            "select " +
+            "order by diag_no" )
+    List<HisPatientDagns> selectHisPatientAdmDagns(String patNo, int times);
+
+    @Select("select " +
             "dagnsCategory=case when si_diag_type in ('1','2') then 1 else 2 end, " +
             "dagnsTypeId=case when dis_diag_no=1 then 1 else 2 end, " +
             "dagnsWayId=2, " +
             "rtrim(dis_diag_comment) as diseaseName, " +
             "rtrim(dis_diag) as icdCode " +
             "from zy_dis_diag_yb " +
-            "where inpatient_no=#{patNo} and admiss_times=#{times}")
-    List<HisPatientDagns> selectHisPatientDagns(String patNo, int times);
+            "where inpatient_no=#{patNo} and admiss_times=#{times} " +
+            "order by dis_diag_no")
+    List<HisPatientDagns> selectHisPatientDisDangs(String patNo, int times);
 
     @Select("select no,code as oprtCode,name as oprtName from t_case_frontsheet_surgery where bah=#{patNo} and times=#{times}")
     List<HisPatientOprtInfo> selectHisPatientOprtInfo(String patNo, int times);