From 06f3d4be5f282dea252070a1df496ab4ab5b738a Mon Sep 17 00:00:00 2001
From: zhaowenxuan <chacca165@163.com>
Date: 星期四, 02 一月 2025 21:03:05 +0800
Subject: [PATCH] Lis接口

---
 src/main/java/com/example/factory/ServiceFactory.java |   37 +++++++++++++++++++++----------------
 1 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/src/main/java/com/example/factory/ServiceFactory.java b/src/main/java/com/example/factory/ServiceFactory.java
index af49815..022bba0 100644
--- a/src/main/java/com/example/factory/ServiceFactory.java
+++ b/src/main/java/com/example/factory/ServiceFactory.java
@@ -2,6 +2,8 @@
 
 import com.example.config.ConfigValue;
 import com.example.service.HisService;
+import com.example.service.LisService;
+import com.example.service.PacsService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.ApplicationContext;
 import org.springframework.stereotype.Component;
@@ -13,32 +15,35 @@
  */
 @Component
 public class ServiceFactory {
-    private final ConfigValue configValue;
     private final ApplicationContext applicationContext;
-    private final String userId;
 
     @Autowired
-    public ServiceFactory(ApplicationContext applicationContext, ConfigValue configValue) {
+    public ServiceFactory(ApplicationContext applicationContext) {
         this.applicationContext = applicationContext;
-        this.configValue = configValue;
-        try {
-            this.userId = configValue.getConfigValue("hosp_service");
-        } catch (Exception e) {
-            throw new RuntimeException("閰嶇疆鏂囦欢涓病鏈夐厤缃甴osp_service鍖婚櫌缂栫爜");
-        }
     }
 
-    public HisService getService() {
-        String beanName = getServiceBeanName(userId);
+    public HisService getService(String hospName) {
+        String beanName = getServiceBeanName(hospName);
         return (HisService) applicationContext.getBean(beanName);
     }
 
-    private String getServiceBeanName(String userId) {
-        switch (userId) {
-            case "ShanXi_XiAn_MeiJi":
-                return "ShanXiXiAnMeiJi";
+    public PacsService getPacsService(String hospName) {
+        String beanName = getServiceBeanName(hospName);
+        return (PacsService) applicationContext.getBean(beanName+"Pacs");
+    }
+
+    public LisService getLisService(String hospName) {
+        String beanName = getServiceBeanName(hospName);
+        return (LisService) applicationContext.getBean(beanName+"Lis");
+    }
+
+
+    private String getServiceBeanName(String hospName) {
+        switch (hospName) {
+            case "shanxiqinxamjyy":
+                return "ShanXiQinXiAnMeiJi"; // 瀵瑰簲鐨勪笟鍔� Bean 鍚嶇О
             default:
-                throw new RuntimeException("鎵句笉鍒板搴旂殑鍖婚櫌缂栫爜鏈嶅姟灞傞厤缃細" + userId);
+                throw new RuntimeException("鎵句笉鍒板搴旂殑鍖婚櫌鏈嶅姟閰嶇疆锛�" + hospName);
         }
     }
 }

--
Gitblit v1.8.0