Browse Source

优化添加医院名字2

wangfeng 4 năm trước cách đây
mục cha
commit
2b214d3fb2

+ 2 - 0
cdssman-service/src/main/java/com/diagbot/dto/UserRoleInfoFindDTO.java

@@ -36,4 +36,6 @@ public class UserRoleInfoFindDTO {
 
     private Long hospitalId;
 
+    private String hospitalName;
+
 }

+ 14 - 2
cdssman-service/src/main/java/com/diagbot/facade/UserRoleFacade.java

@@ -19,8 +19,10 @@ import com.diagbot.vo.UserRoleInfoVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @author wangfeng
@@ -36,6 +38,8 @@ public class UserRoleFacade extends UserRoleServiceImpl {
     UserHospitalFacade userHospitalFacade;
     @Autowired
     UserRoleService userRoleService;
+    @Autowired
+    HospitalInfoFacade hospitalInfoFacade;
 
     public boolean addUserRoles(UserRoleInfoVO userRoleInfoVO) {
         boolean res = false;
@@ -64,8 +68,16 @@ public class UserRoleFacade extends UserRoleServiceImpl {
     }
 
     public List<UserRoleInfoFindDTO> getUserRoles(UserRoleInfoFindVO userRoleInfoFindVO) {
-        List<UserRoleInfoFindDTO> data = userRoleService.getUserRoleAlls(userRoleInfoFindVO);
-        return data;
+        List<UserRoleInfoFindDTO> dataAll = userRoleService.getUserRoleAlls(userRoleInfoFindVO);
+        List<Long> hospitalId = new ArrayList<>();
+        for (UserRoleInfoFindDTO data : dataAll) {
+            hospitalId.add(data.getHospitalId());
+        }
+        Map<Long, String> hospitalInfoData = hospitalInfoFacade.getHospitalInfoData(hospitalId);
+        for (UserRoleInfoFindDTO userData : dataAll) {
+            userData.setHospitalName(hospitalInfoData.get(userData.getHospitalId()));
+        }
+        return dataAll;
     }
 
     /**