forked from kidgrow-microservices-platform

kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-biz/src/main/java/com/kidgrow/usercenter/service/impl/SysUserServiceImpl.java
@@ -156,9 +156,34 @@
            //医院信息
            DoctorUserAll doctorUserAllVo = baseMapper.findDoctorUserAllData(sysUser.getId());
            if (doctorUserAllVo != null) {
                loginAppUser.setDoctorUserAllVO(doctorUserAllVo);
                //是否医院管理员
                loginAppUser.setHAdminUser(doctorUserAllVo.getIsAdminUser());
                //1表示调用老系统接口,2表示调用新系统接口,3表示不执行接口调用
                byte state=0;
                if(doctorUserAllVo.getDepScreen()==null&&doctorUserAllVo.getDepNewScreenclient()==null){
                     state=1;
                }
                if(doctorUserAllVo.getDepScreen()!=null&&doctorUserAllVo.getDepScreen()==0){
                    state=3;
                }
                if(doctorUserAllVo.getDepScreen()!=null&&doctorUserAllVo.getDepScreen()==1){
                    if(doctorUserAllVo.getDepNewScreenclient()!=null&&doctorUserAllVo.getDepNewScreenclient()==1){
                        state=2;
                    }
                    if(doctorUserAllVo.getDepNewScreenclient()!=null&&doctorUserAllVo.getDepNewScreenclient()==0){
                        state=1;
                    }
                }
                doctorUserAllVo.setInterfaceState(state);
                loginAppUser.setDoctorUserAllVO(doctorUserAllVo);
//                1、is_screen为空时,is_new_screenclient必须为空;
//                2、is_screen不为空时,is_new_screenclient可为空,可不为空;
//                3、当两个都为空时,默认调用老系统的接口;
//                4、当is_screen为false时,不论is_new_screenclient是什么不需要调用任何接口;
//                5、当is_screen为true时,is_new_screenclient为false或空时,调用老系统的接口;
//                6、当is_screen为true时,is_new_screenclient为true时,调用新系统的接口;
            }
        }
        return loginAppUser;
@@ -704,6 +729,7 @@
                sysOrganizationH.setCreateUserId(createUserId);
                sysOrganizationH.setCreateUserName(createUserName);
                if (organizationService.save(sysOrganizationH)) {
                    organizationHos=sysOrganizationH.getId();
                    //写科室组织数据
                    SysOrganization sysOrganizationD = new SysOrganization();
                    sysOrganizationD.setOrgLevel(2);
@@ -713,6 +739,7 @@
                    sysOrganizationD.setCreateUserId(createUserId);
                    sysOrganizationD.setCreateUserName(createUserName);
                    if (organizationService.save(sysOrganizationD)) {
                        organizationDep=sysOrganizationD.getId();
                        //写医院组织数据
                        SysHospital sysHospital = new SysHospital();
                        sysHospital.setHospitalName(userRegVo.getHospitalName());
@@ -796,7 +823,11 @@
            sysUser.setType(UserType.DOCTOR.name());
        }
        sysUser.setHAdminUser(false);
        sysUser.setDefaultAuth(false);
        if(isReg){
            sysUser.setDefaultAuth(false);
        }else{
            sysUser.setDefaultAuth(true);
        }
        sysUser.setOpenId(userRegVo.getOpenId());
        sysUser.setDel(false);
        sysUser.setTenantId(CommonConstant.H_TENANT);
@@ -852,6 +883,10 @@
                        if (dicBool) {
                            //写用户组织关系表
                            SysHospital byId = hospitalService.getById(userRegVo.getHospitalId());
                            if(byId!=null){
                                organizationHos=byId.getOrgId();
                            }
                            List<SysUserOrg> sysUserOrgList = new ArrayList<SysUserOrg>();
                            sysUserOrgH.setUserId(sysUser.getId());
                            sysUserOrgH.setOrgId(organizationHos);
@@ -860,7 +895,10 @@
                            sysUserOrgH.setCreateUserId(isReg ? createUserId : sysUserd.getId());
                            sysUserOrgH.setCreateUserName(isReg ? createUserName : sysUserd.getUsername());
                            sysUserOrgList.add(sysUserOrgH);
                            SysDepartment department = departmentService.getById(userRegVo.getDepartmentId());
                            if(department!=null){
                                organizationDep=department.getOrgId();
                            }
                            sysUserOrgD.setUserId(sysUser.getId());
                            sysUserOrgD.setOrgId(organizationDep);
                            sysUserOrgD.setFromId(userRegVo.getDepartmentId());