Browse Source

解析结构调整

chengyao 4 years ago
parent
commit
1d5ae58ce2
1 changed files with 63 additions and 120 deletions
  1. 63 120
      src/main/java/com/diagbot/facade/data/AMedicalRecordFacade.java

+ 63 - 120
src/main/java/com/diagbot/facade/data/AMedicalRecordFacade.java

@@ -124,118 +124,75 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
             medicalRecordQe.in("rec_id", hisDataDealVO.getRecIdList());
         }
         List<MedicalRecord> medicalRecordList = medicalRecordService.list(medicalRecordQe);
-        List<MedicalRecordContent> medicalRecord_7 = new ArrayList<>();
-
-        List<MedicalRecordContent> medicalRecord_30 = new ArrayList<>();
-
-        List<MedicalRecordContent> medicalRecord_31 = new ArrayList<>();
-
-
         Boolean flag = true;
-        Long log = null;
-
-        for (MedicalRecord medicalRecord : medicalRecordList) {
-
-            if (medicalRecord.getModeId() == 7l) {
-                specialDataWithKey(medicalRecord_7, hisDataDealVO, medicalRecord);
-                log = 7l;
-                flag = false;
-            }
-            if (medicalRecord.getModeId() == 30l) {
-                specialDataWithKey(medicalRecord_30, hisDataDealVO, medicalRecord);
-                log = 30l;
-                flag = false;
-            }
-            if (medicalRecord.getModeId() == 31l) {
-                specialDataWithKey(medicalRecord_31, hisDataDealVO, medicalRecord);
-                log = 31l;
-                flag = false;
-            }
-
+        if(hisDataDealVO.getModeId().size()>1){
+            flag = false;
         }
 
-        if(!flag) {
-            if (log != null && log == 7l) {
-                specialDataWithKey2(encryptFlag, medicalRecord_7);
 
-            }
-            if (log != null && log == 30l) {
-                specialDataWithKey2(encryptFlag, medicalRecord_30);
-            }
-            if (log != null && log == 31l) {
-                specialDataWithKey2(encryptFlag, medicalRecord_31);
-            }
-
-            Map<String, Object> content = new HashMap<>();
-            for (MedicalRecord medicalRecord : medicalRecordList) {
-
-                Map<String, Object> listMap = new HashMap<>();
-//            List<MedicalRecordContent> recIdList_7 = null;
-//            List<MedicalRecordContent> recIdList_30 = null;
-//            List<MedicalRecordContent> recIdList_31 = null;
-                RecordDataVO recordContentVO_7 = new RecordDataVO();
-                BeanUtil.copyProperties(medicalRecord, recordContentVO_7);
-                recordContentVO_7.setModeId(7l);
-                List<RecordContentDTO> recordContentFac_7 = medicalRecordFacade.getRecordData(recordContentVO_7);
-//            recIdList_7 = BeanUtil.listCopyTo(recordContentFac_7, MedicalRecordContent.class);
-                List<Map<String, Object>> returnData = new ArrayList<>();
-                if (ListUtil.isNotEmpty(recordContentFac_7)) {
-                    for (RecordContentDTO recordContentDTO : recordContentFac_7) {
-                        try {
-                            Map<String, Object> objectMap = MapUtil.objectToMap(recordContentDTO);
-                            returnData.add(objectMap);
-                        } catch (Exception e) {
-                            e.printStackTrace();
-                        }
+        Map<String, Object> content = new HashMap<>();
+        for (MedicalRecord medicalRecord : medicalRecordList) {
+            RecordDataVO recordContentVO_7 = new RecordDataVO();
+            BeanUtil.copyProperties(medicalRecord, recordContentVO_7);
+            recordContentVO_7.setModeId(7l);
+            List<RecordContentDTO> recordContentFac_7 = medicalRecordFacade.getRecordData(recordContentVO_7);
+            specialDataWithKey(encryptFlag, recordContentFac_7);
+            List<Map<String, Object>> returnData = new ArrayList<>();
+            Map<String, List<Map<String, Object>>> returnMap = new HashMap<>();
+            if (ListUtil.isNotEmpty(recordContentFac_7)) {
+                for (RecordContentDTO recordContentDTO : recordContentFac_7) {
+                    try {
+                        Map<String, Object> objectMap = MapUtil.objectToMap(recordContentDTO);
+                        returnData.add(objectMap);
+                        returnMap.put("会诊记录",returnData);
+                    } catch (Exception e) {
+                        e.printStackTrace();
                     }
-
                 }
+            }
 
-
-                RecordDataVO recordContentVO_30 = new RecordDataVO();
-                BeanUtil.copyProperties(medicalRecord, recordContentVO_30);
-                recordContentVO_30.setModeId(30l);
-                List<RecordContentDTO> recordContentFac_30 = medicalRecordFacade.getRecordData(recordContentVO_30);
-//            recIdList_30 = BeanUtil.listCopyTo(recordContentFac_30, MedicalRecordContent.class);
-                if (ListUtil.isNotEmpty(recordContentFac_30)) {
-                    for (RecordContentDTO recordContentDTO : recordContentFac_30) {
-                        try {
-                            Map<String, Object> objectMap = MapUtil.objectToMap(recordContentDTO);
-                            returnData.add(objectMap);
-                        } catch (Exception e) {
-                            e.printStackTrace();
-                        }
+            RecordDataVO recordContentVO_30 = new RecordDataVO();
+            BeanUtil.copyProperties(medicalRecord, recordContentVO_30);
+            recordContentVO_30.setModeId(30l);
+            List<RecordContentDTO> recordContentFac_30 = medicalRecordFacade.getRecordData(recordContentVO_30);
+            specialDataWithKey(encryptFlag, recordContentFac_30);
+            if (ListUtil.isNotEmpty(recordContentFac_30)) {
+                for (RecordContentDTO recordContentDTO : recordContentFac_30) {
+                    try {
+                        Map<String, Object> objectMap = MapUtil.objectToMap(recordContentDTO);
+                        returnData.add(objectMap);
+                        returnMap.put("会诊申请单",returnData);
+                    } catch (Exception e) {
+                        e.printStackTrace();
                     }
-
                 }
+            }
 
-                RecordDataVO recordContentVO_31 = new RecordDataVO();
-                BeanUtil.copyProperties(medicalRecord, recordContentVO_31);
-                recordContentVO_31.setModeId(31l);
-
-                List<RecordContentDTO> recordContentFac_31 = medicalRecordFacade.getRecordData(recordContentVO_31);
-//            recIdList_31 = BeanUtil.listCopyTo(recordContentFac_31, MedicalRecordContent.class);
-                if (ListUtil.isNotEmpty(recordContentFac_31)) {
-
-                    for (RecordContentDTO recordContentDTO : recordContentFac_31) {
-                        try {
-                            Map<String, Object> objectMap = MapUtil.objectToMap(recordContentDTO);
-                            returnData.add(objectMap);
-                        } catch (Exception e) {
-                            e.printStackTrace();
-                        }
+            RecordDataVO recordContentVO_31 = new RecordDataVO();
+            BeanUtil.copyProperties(medicalRecord, recordContentVO_31);
+            recordContentVO_31.setModeId(31l);
+            List<RecordContentDTO> recordContentFac_31 = medicalRecordFacade.getRecordData(recordContentVO_31);
+            specialDataWithKey(encryptFlag, recordContentFac_31);
+            if (ListUtil.isNotEmpty(recordContentFac_31)) {
+                for (RecordContentDTO recordContentDTO : recordContentFac_31) {
+                    try {
+                        Map<String, Object> objectMap = MapUtil.objectToMap(recordContentDTO);
+                        returnData.add(objectMap);
+                        returnMap.put("会诊结果单",returnData);
+                    } catch (Exception e) {
+                        e.printStackTrace();
                     }
                 }
-
-
-                content.put("content", returnData);
-                MedrecVo medrecVo = new MedrecVo();
-                medrecVo.setHospitalId(medicalRecord.getHospitalId());
-                medrecVo.setContent(content);
-                medrecVo.setTitle("会诊");
-                splicingParam(null, medrecVo);
-
             }
+            content.put("content", returnMap);
+            MedrecVo medrecVo = new MedrecVo();
+            medrecVo.setHospitalId(medicalRecord.getHospitalId());
+            medrecVo.setContent(content);
+        if(recordContentVO_31.getModeId()==7l||recordContentVO_30.getModeId()==30l||recordContentVO_31.getModeId()==31l){
+            medrecVo.setTitle("会诊");
+        }
+            splicingParam(null, medrecVo);
+
         }
 
         if (flag) {
@@ -269,7 +226,7 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
                         records.add(aMedicalRecordVO);
                         AMrContentVO aMrContentVO = new AMrContentVO();
                         aMrContentVO.setRecords(records);
-                        splicingParam(aMrContentVO,null);
+                        splicingParam(aMrContentVO, null);
                     }
             );
         }
@@ -277,35 +234,20 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
         return true;
     }
 
-    /**
-     * 特殊公共方法处理数据1
-     *
-     * @param hisDataDealVO
-     * @param medicalRecord
-     */
-    public void specialDataWithKey(List<MedicalRecordContent> medicalRecordContentList,
-                                   HisDataDealVO hisDataDealVO, MedicalRecord medicalRecord) {
-
-        QueryWrapper<MedicalRecordContent> medicalRecordContentQe = new QueryWrapper<>();
-        medicalRecordContentQe.eq("hospital_id", hisDataDealVO.getHospitalId());
-        medicalRecordContentQe.eq("rec_id", medicalRecord.getRecId());
-        MedicalRecordContent medicalRecordContent = aMedicalRecordContentFacade.getOne(medicalRecordContentQe);
-        medicalRecordContentList.add(medicalRecordContent);
 
-    }
 
     /**
-     * 特殊公共方法处理数据2
+     * 特殊公共方法处理数据
      *
      * @param
      */
-    public void specialDataWithKey2(Boolean encryptFlag, List<MedicalRecordContent> medicalRecordContentList
+    public void specialDataWithKey(Boolean encryptFlag, List<RecordContentDTO> recordContentDTOS
     ) {
 
         if (encryptFlag) {
             try {
                 EncrypDES encrypDES = new EncrypDES();
-                for (MedicalRecordContent mrj : medicalRecordContentList) {
+                for (RecordContentDTO mrj : recordContentDTOS) {
                     mrj.setXmlText(encrypDES.decryptor(mrj.getXmlText()));
                 }
             } catch (Exception e) {
@@ -330,7 +272,8 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
             queryVo.setHospitalId(String.valueOf(medrec.getHospitalId()));
             queryVo.setCid(basHospitalInfoFacade.getHosCode(medrec.getHospitalId()));
             columnFacade.analyseRec(queryVo);
-        } if(null == medrec) {
+        }
+        if (null == medrec) {
             try {
                 QueryVo queryVo = new QueryVo();
                 List<MedrecVo> medreclist = Lists.newArrayList();
@@ -415,7 +358,7 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
             });
 
             //数据解析
-            splicingParam(aMrContentVO,null);
+            splicingParam(aMrContentVO, null);
 
             //评分后返回结构体
             return mrIng(aMrContentVO);