Browse Source

管理看全部

lihong 2 years ago
parent
commit
a2a5f6be97

+ 4 - 0
src/main/java/cn/hnthyy/thmz/common/Constants.java

@@ -56,6 +56,10 @@ public class Constants {
      * 口服的用药方式
      */
     public static final String KOU_FU_SUPPLY_CODE = "001";
+    /**
+     * 管理员角色id
+     */
+    public static final Long GLY_ROLE_ID = 1L;
 //    /**
 //     * 本院记账收款方式
 //     */

+ 8 - 2
src/main/java/cn/hnthyy/thmz/controller/mz/ClinicController.java

@@ -11,6 +11,7 @@ import cn.hnthyy.thmz.entity.his.zy.APatientMi;
 import cn.hnthyy.thmz.entity.thmz.Clinic;
 import cn.hnthyy.thmz.entity.thmz.TurnToConsultation;
 import cn.hnthyy.thmz.entity.thmz.User;
+import cn.hnthyy.thmz.entity.thmz.UserRoleRelation;
 import cn.hnthyy.thmz.enums.ClinicStatusEnum;
 import cn.hnthyy.thmz.enums.GenderEnum;
 import cn.hnthyy.thmz.enums.PayMarkEnum;
@@ -70,6 +71,8 @@ public class ClinicController {
     private UserDeptRelationService userDeptRelationService;
     @Autowired
     private APatientMiService aPatientMiService;
+    @Autowired
+    private UserRoleRelationService  userRoleRelationService;
 
     /**
      * 叫号通知
@@ -431,11 +434,14 @@ public class ClinicController {
             if (StringUtils.isBlank(clinic.getDoctorCode())) {
                 User tokenUser = TokenUtil.getUser(httpServletRequest);
                 List<String> deptNos = userDeptRelationService.queryAllByUserIdCode(tokenUser.getUserIdCode());
-                Boolean isYjDept = false;
+                //Boolean isYjDept = false;
+                //管理员看全部
+                List<UserRoleRelation> userRoleRelations = userRoleRelationService.queryByUserId(tokenUser.getId());
+                boolean isGly = userRoleRelations.stream().anyMatch(userRoleRelation -> userRoleRelation.getRoleId().equals(Constants.GLY_ROLE_ID));
                 //暂时只开放医技可以可以接诊全院患者,不修改历史处方
                 //isYjDept = checkYjDept(deptNos)!=null;
                 //医技科室是可以看到全部患者信息,非医技科室需要加查询条件
-                if (!isYjDept) {
+                if (!isGly) {
                     clinic.setDoctorCode(tokenUser.getUserIdCode());
                     clinic.setDeptCodes(deptNos);
                 }