Explorar el Código

增加药品分类展示

SGTY hace 11 meses
padre
commit
350a51afa8

+ 1 - 0
src/main/java/com/diagbot/dto/DiseaseItemDTO.java

@@ -14,4 +14,5 @@ public class DiseaseItemDTO {
     private String diseaseName;
     private Long relationId;
     private String itemName;
+    private String DrugC;
 }

+ 2 - 0
src/main/java/com/diagbot/dto/PushDTO.java

@@ -28,6 +28,8 @@ public class PushDTO {
     private List<PushBaseDTO> operations = Lists.newArrayList();
     // 药品
     private List<PushBaseDTO> medicines = Lists.newArrayList();
+    // 分类后的药品
+    private Map<String, List<PushBaseDTO>> medicine = new LinkedHashMap<>();
     // 并发症
     private List<PushBaseDTO> complications = Lists.newArrayList();
     // 量表

+ 1 - 1
src/main/java/com/diagbot/dto/WordCrfDTO.java

@@ -71,7 +71,7 @@ public class WordCrfDTO {
     private Item diseaseName;
     // 选中手术
     private Item operationName;
-     // 诊断
+    // 诊断
     private List<Item> diag = new ArrayList<>();
     // 当前化验开单项
     private List<Lis> lisOrder = new ArrayList<>();

+ 24 - 0
src/main/java/com/diagbot/facade/KlRelationFacade.java

@@ -33,4 +33,28 @@ public class KlRelationFacade extends KlRelationServiceImpl {
         }
         return map;
     }
+
+    /**
+     * @Description:
+     * @param diseaseItemVO
+     * @return Map<Long, List<DiseaseItemDTO>>
+     * @author SGTY
+     * @create 2024.07.30
+     **/
+
+    public Map<Long, List<DiseaseItemDTO>> getInfoByDiseaseMap(DiseaseItemVO diseaseItemVO){
+        Map<Long, List<DiseaseItemDTO>> map = new HashMap<>();
+        List<DiseaseItemDTO> dtoList = this.getItemByDisease(diseaseItemVO);
+        if (ListUtil.isNotEmpty(dtoList)) {
+            for (DiseaseItemDTO diseaseItemDTO : dtoList) {
+                List<DiseaseItemDTO> items = new ArrayList<>();
+                if (null != map.get(diseaseItemDTO.getRelationId())) {
+                    items.addAll(map.get(diseaseItemDTO.getRelationId()));
+                }
+                items.add(diseaseItemDTO);
+                map.put(diseaseItemDTO.getRelationId(), items);
+            }
+        }
+        return map;
+    }
 }

+ 14 - 4
src/main/java/com/diagbot/process/PushProcess.java

@@ -12,6 +12,7 @@ import com.diagbot.dto.PushDTO;
 import com.diagbot.dto.ReverseDTO;
 import com.diagbot.dto.TreatDTO;
 import com.diagbot.dto.WordCrfDTO;
+import com.diagbot.dto.DiseaseItemDTO;
 import com.diagbot.dto.icss.FeatureRate;
 import com.diagbot.dto.icss.Response;
 import com.diagbot.dto.icss.ResponseData;
@@ -177,13 +178,22 @@ public class PushProcess {
             DiseaseItemVO diseaseItemVO = new DiseaseItemVO();
             diseaseItemVO.setDiseaseName(uniqueName);
             Map<Long, List<String>> items = klRelationFacade.getItemByDiseaseMap(diseaseItemVO);
+            Map<Long, List<DiseaseItemDTO>> infos = klRelationFacade.getInfoByDiseaseMap(diseaseItemVO);
             if (MapUtils.isNotEmpty(items)) {
                 if (ruleTypeList.contains("8") && ListUtil.isNotEmpty(items.get(PushRelationTypeEnum.DRUG.getKey()))) {
-                    pushDTO.setMedicines(items.get(PushRelationTypeEnum.DRUG.getKey()).stream().map(x -> {
+                    // 将infos中键值为506的数据取出,以drugC聚合,如果drugC为空,则给map中的key赋值为“未分类药品”
+                    infos.get(PushRelationTypeEnum.DRUG.getKey()).forEach(x -> {
+                        String Classification = StringUtil.isNotBlank(x.getDrugC()) ? x.getDrugC() : "未分类药品";
                         PushBaseDTO pushBaseDTO = new PushBaseDTO();
-                        pushBaseDTO.setName(x);
-                        return pushBaseDTO;
-                    }).collect(Collectors.toList()));
+                        pushBaseDTO.setName(x.getItemName());
+                        if (pushDTO.getMedicine().containsKey(Classification)) {
+                            pushDTO.getMedicine().get(Classification).add(pushBaseDTO);
+                        } else {
+                            List<PushBaseDTO> pushBaseDTOS = new ArrayList<>();
+                            pushBaseDTOS.add(pushBaseDTO);
+                            pushDTO.getMedicine().put(Classification, pushBaseDTOS);
+                        }
+                    });
                 }
                 if (ruleTypeList.contains("9") && ListUtil.isNotEmpty(items.get(PushRelationTypeEnum.OPERATION.getKey()))) {
                     pushDTO.setOperations(items.get(PushRelationTypeEnum.OPERATION.getKey()).stream().map(x -> {

+ 122 - 39
src/main/resources/mapper/KlRelationMapper.xml

@@ -49,12 +49,91 @@
             t3.id
     </select>
 
+<!--    <select id="getItemByDisease" resultType="com.diagbot.dto.DiseaseItemDTO" parameterType="com.diagbot.vo.DiseaseItemVO">-->
+<!--        SELECT-->
+<!--            t7.diseaseName,-->
+<!--            t7.relationId,-->
+<!--            t7.itemName-->
+<!--        FROM-->
+<!--            (-->
+<!--                SELECT-->
+<!--                    t5.diseaseId,-->
+<!--                    t5.diseaseName,-->
+<!--                    t5.relationId,-->
+<!--                    t5.itemName,-->
+<!--                    t5.itemId,-->
+<!--                    t5.order_no,-->
+<!--                    IFNULL(t6.min_age, 0) AS min_age,-->
+<!--                    IFNULL(t6.max_age, 200) AS max_age,-->
+<!--                    IFNULL(t6.sex_type, 3) AS sex_type-->
+<!--                FROM-->
+<!--                    (-->
+<!--                        SELECT-->
+<!--                            t1.id AS diseaseId,-->
+<!--                            t1.lib_name AS diseaseName,-->
+<!--                            t2.relation_id AS relationId,-->
+<!--                            t3.lib_name AS itemName,-->
+<!--                            t3.id AS itemId,-->
+<!--                            t4.order_no-->
+<!--                        FROM-->
+<!--                            kl_concept t1,-->
+<!--                            kl_relation t2,-->
+<!--                            kl_concept t3,-->
+<!--                            kl_relation_order t4-->
+<!--                        WHERE-->
+<!--                            t1.is_deleted = "N"-->
+<!--                        AND t2.is_deleted = "N"-->
+<!--                        AND t3.is_deleted = "N"-->
+<!--                        AND t4.is_deleted = "N"-->
+<!--                        AND t1.lib_type = 100-->
+<!--                        AND t1.id = t2.start_id-->
+<!--                        AND t3.id = t2.end_id-->
+<!--                        AND t2.id = t4.t_relation_id-->
+<!--                        AND t2.relation_id IN (501,502,503,504,505,506,507,508,509,510)-->
+<!--                        AND t1.lib_name = #{diseaseName}-->
+<!--                        AND t1.`status` = 1-->
+<!--                        AND t3.`status` = 1-->
+<!--                    ) t5-->
+<!--                LEFT JOIN kl_concept_common t6 ON t6.is_deleted = "N"-->
+<!--                AND t5.itemId = t6.concept_id-->
+<!--            ) t7-->
+<!--        WHERE 1=1-->
+<!--        <if test="sexType == 3">-->
+<!--            AND t7.sex_type in ('1','2','3')-->
+<!--        </if>-->
+<!--        <if test="sexType != 3">-->
+<!--            AND t7.sex_type in ('3',#{sexType})-->
+<!--        </if>-->
+<!--        <if test="age != null and age != ''">-->
+<!--            AND <![CDATA[ t7.min_age <= #{age} ]]>-->
+<!--            AND <![CDATA[ t7.max_age >= #{age} ]]>-->
+<!--        </if>-->
+<!--        ORDER BY-->
+<!--            t7.diseaseId,-->
+<!--            t7.relationId,-->
+<!--            t7.order_no-->
+<!--    </select>-->
+
+
     <select id="getItemByDisease" resultType="com.diagbot.dto.DiseaseItemDTO" parameterType="com.diagbot.vo.DiseaseItemVO">
         SELECT
-            t7.diseaseName,
-            t7.relationId,
-            t7.itemName
+            t9.diseaseName,
+            t9.relationId,
+            t9.itemName,
+            t9.drug_c
         FROM
+        (
+            SELECT
+                t7.diseaseName,
+                t7.relationId,
+                t7.itemName,
+                t8.drug_c,
+                IFNULL(t7.min_age, 0) AS min_age,
+                IFNULL(t7.max_age, 200) AS max_age,
+                IFNULL(t7.sex_type, 3) AS sex_type,
+                t7.diseaseId as diseaseId,
+                t7.order_no as order_no
+            FROM
             (
                 SELECT
                     t5.diseaseId,
@@ -65,53 +144,57 @@
                     t5.order_no,
                     IFNULL(t6.min_age, 0) AS min_age,
                     IFNULL(t6.max_age, 200) AS max_age,
-                    IFNULL(t6.sex_type, 3) AS sex_type
+                    IFNULL(t6.sex_type, 3) AS sex_type,
+                    t6.concept_id as concept_id
                 FROM
-                    (
-                        SELECT
-                            t1.id AS diseaseId,
-                            t1.lib_name AS diseaseName,
-                            t2.relation_id AS relationId,
-                            t3.lib_name AS itemName,
-                            t3.id AS itemId,
-                            t4.order_no
-                        FROM
-                            kl_concept t1,
-                            kl_relation t2,
-                            kl_concept t3,
-                            kl_relation_order t4
-                        WHERE
-                            t1.is_deleted = "N"
-                        AND t2.is_deleted = "N"
-                        AND t3.is_deleted = "N"
-                        AND t4.is_deleted = "N"
-                        AND t1.lib_type = 100
-                        AND t1.id = t2.start_id
-                        AND t3.id = t2.end_id
-                        AND t2.id = t4.t_relation_id
-                        AND t2.relation_id IN (501,502,503,504,505,506,507,508,509,510)
-                        AND t1.lib_name = #{diseaseName}
-                        AND t1.`status` = 1
-                        AND t3.`status` = 1
-                    ) t5
+                (
+                    SELECT
+                        t1.id AS diseaseId,
+                        t1.lib_name AS diseaseName,
+                        t2.relation_id AS relationId,
+                        t3.lib_name AS itemName,
+                        t3.id AS itemId,
+                        t4.order_no
+                    FROM
+                        kl_concept t1,
+                        kl_relation t2,
+                        kl_concept t3,
+                        kl_relation_order t4
+                    WHERE
+                        t1.is_deleted = "N"
+                    AND t2.is_deleted = "N"
+                    AND t3.is_deleted = "N"
+                    AND t4.is_deleted = "N"
+                    AND t1.lib_type = 100
+                    AND t1.id = t2.start_id
+                    AND t3.id = t2.end_id
+                    AND t2.id = t4.t_relation_id
+                    AND t2.relation_id IN (501,502,503,504,505,506,507,508,509,510)
+                    AND t1.lib_name = #{diseaseName}
+                    AND t1.`status` = 1
+                    AND t3.`status` = 1
+                ) t5
                 LEFT JOIN kl_concept_common t6 ON t6.is_deleted = "N"
                 AND t5.itemId = t6.concept_id
             ) t7
+            LEFT JOIN kl_drug t8 ON t8.is_deleted = "N"
+            AND t8.concept_id = t7.concept_id
+        )t9
         WHERE 1=1
         <if test="sexType == 3">
-            AND t7.sex_type in ('1','2','3')
+            AND t9.sex_type in ('1','2','3')
         </if>
         <if test="sexType != 3">
-            AND t7.sex_type in ('3',#{sexType})
+            AND t9.sex_type in ('3',#{sexType})
         </if>
         <if test="age != null and age != ''">
-            AND <![CDATA[ t7.min_age <= #{age} ]]>
-            AND <![CDATA[ t7.max_age >= #{age} ]]>
+            AND <![CDATA[ t9.min_age <= #{age} ]]>
+            AND <![CDATA[ t9.max_age >= #{age} ]]>
         </if>
         ORDER BY
-            t7.diseaseId,
-            t7.relationId,
-            t7.order_no
+        t9.diseaseId,
+        t9.relationId,
+        t9.order_no,
+        t9.drug_c
     </select>
-
 </mapper>