瀏覽代碼

临床用户

seimin 1 年之前
父節點
當前提交
f5aaf336b4

+ 8 - 0
src/app/services/main.service.ts

@@ -666,4 +666,12 @@ export class MainService {
666 666
   resetpwd(id): any {
667 667
     return this.http.get(host.host + "/auth/resetpwd/" + id, {});
668 668
   }
669
+  // api接口
670
+  apiPostAll(type, data) {
671
+    return this.http.post(
672
+      host.host + "/api/" + type,
673
+      data,
674
+      { headers: this.headers }
675
+    );
676
+  }
669 677
 }

+ 22 - 0
src/app/views/clinical-users-management/clinical-users-management-routing.module.ts

@@ -0,0 +1,22 @@
1
+import { NgModule } from '@angular/core';
2
+import { Routes, RouterModule } from '@angular/router';
3
+import { ClinicalUsersManagementComponent } from './clinical-users-management.component';
4
+
5
+
6
+const routes: Routes = [{
7
+  path: '',
8
+  component: ClinicalUsersManagementComponent,
9
+  children: [
10
+    {
11
+      // 查看详情
12
+      path: 'userDetail/:id',
13
+      loadChildren: () => import('../user-detail/user-detail.module').then(m => m.UserDetailModule),
14
+    }
15
+  ]
16
+}];
17
+
18
+@NgModule({
19
+  imports: [RouterModule.forChild(routes)],
20
+  exports: [RouterModule]
21
+})
22
+export class ClinicalUsersManagementRoutingModule { }

+ 234 - 0
src/app/views/clinical-users-management/clinical-users-management.component.html

@@ -0,0 +1,234 @@
1
+<div class="list-template">
2
+  <div class="list-template__content">
3
+    <div class="list-template__top" nz-row>
4
+      <div nz-col nzXl='18' class="list-template__searchBox">
5
+        <div class="list-template__searchItem">
6
+          <span class="label">院区</span>:
7
+          <nz-select class="formItem" (nzOnSearch)="changeInpHospital(hosId,'search',$event)"
8
+            [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch nzAllowClear nzPlaceHolder="请选择院区"
9
+            [(ngModel)]="hosId" (ngModelChange)="changeHosp1($event)">
10
+            <ng-container *ngFor="let option of hospitals1">
11
+              <nz-option *ngIf="!isLoading" [nzLabel]="option.hosName" [nzValue]="option.id"></nz-option>
12
+            </ng-container>
13
+            <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
14
+              <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
15
+            </nz-option>
16
+          </nz-select>
17
+        </div>
18
+        <div class="list-template__searchItem" style="display: none;">
19
+          <span class="label">用户类型</span>:
20
+          <nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" nzShowSearch nzAllowClear
21
+            nzPlaceHolder="请选择用户类型" [(ngModel)]="userType">
22
+            <nz-option nzLabel="{{data.name}}" nzValue="{{data.id}}" *ngFor="let data of userTypes"></nz-option>
23
+          </nz-select>
24
+        </div>
25
+        <div class="list-template__searchItem">
26
+          <span class="label">所属科室</span>:
27
+          <nz-select class="formItem" (nzOnSearch)="changeInp(hosId,'search',$event)"
28
+            [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch nzAllowClear nzPlaceHolder="请选择所属科室"
29
+            [(ngModel)]="department">
30
+            <ng-container *ngFor="let option of alldepart1">
31
+              <nz-option *ngIf="!isLoading" [nzLabel]="option.dept" [nzValue]="option.id"></nz-option>
32
+            </ng-container>
33
+            <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
34
+              <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
35
+            </nz-option>
36
+          </nz-select>
37
+        </div>
38
+        <div class="list-template__searchItem">
39
+          <span class="label">所属组</span>:
40
+          <nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" nzShowSearch nzAllowClear
41
+            nzPlaceHolder="请选择所属组" [(ngModel)]="userGroup1">
42
+            <nz-option nzLabel="{{data.groupName}}" nzValue="{{data.id}}" *ngFor="let data of allUserGroup1">
43
+            </nz-option>
44
+          </nz-select>
45
+        </div>
46
+        <div class="list-template__searchItem">
47
+          <span class="label">用户名</span>:
48
+          <input nz-input class="formItem" [(ngModel)]="num" placeholder="请输入用户名" nzSize="default" />
49
+        </div>
50
+        <div class="list-template__searchItem">
51
+          <span class="label">姓名</span>:
52
+          <input nz-input class="formItem" [(ngModel)]="name" placeholder="请输入姓名" nzSize="default" />
53
+        </div>
54
+      </div>
55
+      <div nz-col nzXl='6' class="list-template__btns">
56
+        <button nz-button class="btn default" (click)='search()'>搜索</button>
57
+        <button nz-button class="btn ml8 default" (click)='reset()'>重置</button>
58
+        <button nz-button *ngIf="coopBtns.add" class="btn ml8 default" (click)="showModal()">新增</button>
59
+      </div>
60
+    </div>
61
+    <div class="list-template__bottom">
62
+      <nz-table class="list-template__nzTable" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false"
63
+        [nzLoading]="loading1">
64
+        <thead>
65
+          <tr class="thead">
66
+            <th nzWidth="5%">序号</th>
67
+            <th nzWidth="10%">姓名</th>
68
+            <th nzWidth="10%">用户名</th>
69
+            <th nzWidth="5%">性别</th>
70
+            <th nzWidth="10%">手机号码</th>
71
+            <th nzWidth="15%">所属科室</th>
72
+            <th nzWidth="15%">所属组</th>
73
+            <th nzWidth="10%">用户类型</th>
74
+            <th nzWidth="20%">操作</th>
75
+          </tr>
76
+        </thead>
77
+        <tbody>
78
+          <tr *ngFor="let data of listOfData;let index=index;">
79
+            <td>{{index+(pageIndex-1) * pageSize + 1}}</td>
80
+            <td>{{ data.name||'-' }}</td>
81
+            <td>{{ data.account||'-' }}</td>
82
+            <td>{{data.gender?data.gender.name:'-'}}</td>
83
+            <td>{{ data.phone||'-' }}</td>
84
+            <td>{{ data.dept?data.dept.dept:'-' }}</td>
85
+            <td>
86
+              <div *ngIf="data.group&&data.group.length">
87
+                <div *ngFor="let gro of data.group;let i=index;">
88
+                  <span *ngIf='i!=data.group.length-1'>{{gro.groupName}},</span>
89
+                  <span *ngIf='i==data.group.length-1'>{{gro.groupName}}</span>
90
+
91
+                </div>
92
+              </div>
93
+              <div *ngIf="!data.group||!data.group.length">
94
+                -
95
+              </div>
96
+            </td>
97
+            <td>{{ data.usertype.name }}</td>
98
+            <td>
99
+              <div class="coop">
100
+                <span *ngIf="coopBtns.look" (click)="detail(data.id)">查看</span>
101
+                <span *ngIf="coopBtns.edit" (click)="edit(data)">编辑</span>
102
+                <span *ngIf="coopBtns.del" (click)="del(data)">删除</span>
103
+                <span *ngIf="coopBtns.resetPwd" (click)="resetPwd(data)">重置密码</span>
104
+              </div>
105
+            </td>
106
+          </tr>
107
+        </tbody>
108
+      </nz-table>
109
+      <div class="list-template__pagination">
110
+        <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" nzShowSizeChanger [(nzPageSize)]="pageSize"
111
+          (nzPageIndexChange)="getList()" (nzPageSizeChange)="getList()">
112
+        </nz-pagination>
113
+      </div>
114
+    </div>
115
+  </div>
116
+</div>
117
+<!-- 新增/编辑模态框 -->
118
+<div class="save add display_flex align-items_center justify-content_flex-center" *ngIf="modal">
119
+  <div class="modalBody">
120
+    <div class="title">用户管理 - {{add?"新增":"编辑"}}<i class="icon_transport transport-guanbi" (click)="hideModal()"></i>
121
+    </div>
122
+    <overlay-scrollbars #osComponentRef1 class="content">
123
+      <form nz-form [formGroup]="validateForm" class="addForm" (ngSubmit)="submitForm()">
124
+        <nz-form-item>
125
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="name">姓名</nz-form-label>
126
+          <nz-form-control nzErrorTip="请填写姓名!">
127
+            <nz-input-group>
128
+              <input type="name" nz-input formControlName="name" placeholder="请填写姓名" />
129
+            </nz-input-group>
130
+          </nz-form-control>
131
+        </nz-form-item>
132
+        <nz-form-item>
133
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="account">用户名</nz-form-label>
134
+          <nz-form-control nzErrorTip="请填写用户名!">
135
+            <nz-input-group>
136
+              <input type="account" nz-input formControlName="account" placeholder="请填写用户名" />
137
+            </nz-input-group>
138
+          </nz-form-control>
139
+        </nz-form-item>
140
+        <nz-form-item>
141
+          <nz-form-label [nzSm]="6" [nzXs]="24" [nzRequired]="wxRequired" nzFor="weixin">微信</nz-form-label>
142
+          <nz-form-control nzErrorTip="请填写微信!">
143
+            <nz-input-group>
144
+              <input type="weixin" nz-input formControlName="weixin" placeholder="请填写微信" />
145
+            </nz-input-group>
146
+          </nz-form-control>
147
+        </nz-form-item>
148
+        <nz-form-item>
149
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="usertype">用户类型</nz-form-label>
150
+          <nz-form-control nzErrorTip="请选择用户类型!">
151
+            <nz-select [nzDropdownMatchSelectWidth]="false" type="usertype" nzShowSearch nzAllowClear
152
+              formControlName="usertype" nzPlaceHolder="请选择用户类型" (ngModelChange)="usertypeChange()">
153
+              <nz-option nzLabel="{{data.name}}" nzValue="{{data.id}}" *ngFor="let data of userTypes">
154
+              </nz-option>
155
+            </nz-select>
156
+          </nz-form-control>
157
+        </nz-form-item>
158
+        <nz-form-item>
159
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="dept">所属科室</nz-form-label>
160
+          <nz-form-control nzErrorTip="请选择所属科室!">
161
+            <nz-select (nzOnSearch)="changeInp(hosId,'add',$event)" [nzDropdownMatchSelectWidth]="false" type="dept"
162
+              nzServerSearch nzShowSearch nzAllowClear formControlName="dept" nzPlaceHolder="请选择所属科室">
163
+              <!-- <nz-option nzLabel="{{data.dept}}" nzValue="{{data.id}}" *ngFor="let data of alldepart">
164
+              </nz-option> -->
165
+              <ng-container *ngFor="let option of alldepart">
166
+                <nz-option *ngIf="!isLoading" [nzLabel]="option.dept" [nzValue]="option.id"></nz-option>
167
+              </ng-container>
168
+              <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
169
+                <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
170
+              </nz-option>
171
+            </nz-select>
172
+          </nz-form-control>
173
+        </nz-form-item>
174
+        <nz-form-item>
175
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="deptPhone">手机号码</nz-form-label>
176
+          <nz-form-control nzErrorTip="请填写正确的手机号码!">
177
+            <nz-input-group>
178
+              <input type="deptPhone" pattern="[\d-]+" nz-input formControlName="deptPhone" placeholder="请填写手机号码" />
179
+            </nz-input-group>
180
+          </nz-form-control>
181
+        </nz-form-item>
182
+        <nz-form-item>
183
+          <nz-form-label style="line-height:40px;" [nzSm]="6" [nzXs]="24" nzRequired nzFor="gender">性别</nz-form-label>
184
+          <nz-form-control nzErrorTip="请选择性别!">
185
+            <nz-radio-group type="gender" formControlName="gender">
186
+              <label nz-radio nzValue="{{data.id}}" *ngFor="let data of genders">{{data.name}}</label>
187
+            </nz-radio-group>
188
+          </nz-form-control>
189
+        </nz-form-item>
190
+        <nz-form-item>
191
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="userGroup">用户组</nz-form-label>
192
+          <nz-form-control nzErrorTip="请选择用户组!">
193
+            <nz-select [nzDropdownMatchSelectWidth]="false" type="userGroup" nzAllowClear nzMode="multiple"
194
+              formControlName="userGroup" nzPlaceHolder="请选择用户组">
195
+              <nz-option nzLabel="{{data.groupName}}" nzValue="{{data.id}}" *ngFor="let data of allUserGroup">
196
+              </nz-option>
197
+            </nz-select>
198
+          </nz-form-control>
199
+        </nz-form-item>
200
+        <nz-form-item>
201
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="role">角色</nz-form-label>
202
+          <nz-form-control nzErrorTip="请选择角色!">
203
+            <nz-select [nzDropdownMatchSelectWidth]="false" type="role" nzShowSearch nzAllowClear nzMode="multiple"
204
+              formControlName="role" nzPlaceHolder="请选择角色">
205
+              <nz-option nzLabel="{{data.role}}" nzValue="{{data.id}}" *ngFor="let data of allUserRole">
206
+              </nz-option>
207
+            </nz-select>
208
+          </nz-form-control>
209
+        </nz-form-item>
210
+      </form>
211
+    </overlay-scrollbars>
212
+    <div class="display_flex justify-content_flex-center">
213
+      <button nzType="primary" nz-button (click)="submitForm()" [nzLoading]="btnLoading">确认</button>
214
+      <button class="btn cancel" nz-button nzType="default" (click)="hideModal()">取消</button>
215
+    </div>
216
+  </div>
217
+</div>
218
+<!-- 删除模态框 -->
219
+<app-dialog-delete [delModal]="delModal" (hideDelModalEvent)="hideDelModal()" [btnLoading]="btnLoading" [cancenlLoading]="cancenlLoading"
220
+  (confirmDelEvent)="confirmDel()" (cancelDelEvent)="cancelDel()" content="是否删除企业微信同用户?" confirmTxt="是" cancelTxt="否">
221
+</app-dialog-delete>
222
+<!-- 重置密码模态框 -->
223
+<app-dialog-delete [delModal]="resetModal" (hideDelModalEvent)="hideResetModal()" [btnLoading]="btnLoading" [cancenlLoading]="cancenlLoading"
224
+  (confirmDelEvent)="confirmReset()" (cancelDelEvent)="cancelReset()" content="是否重置密码?">
225
+</app-dialog-delete>
226
+<!-- 操作成功/失败提示框 -->
227
+<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
228
+  [info]="promptInfo"></app-prompt-modal>
229
+
230
+<!-- 查看详情 -->
231
+<router-outlet></router-outlet>
232
+
233
+<!-- 遮罩 -->
234
+<app-mask *ngIf="maskFlag"></app-mask>

+ 126 - 0
src/app/views/clinical-users-management/clinical-users-management.component.less

@@ -0,0 +1,126 @@
1
+@import "../../../../src/theme.less";
2
+.save {
3
+  position: fixed;
4
+  left: 0;
5
+  top: 0;
6
+  width: 100%;
7
+  height: 100%;
8
+  background: rgba(0, 0, 0, 0.4);
9
+  z-index: 99;
10
+
11
+  .modalBody {
12
+    width: 350px;
13
+    background: #fff;
14
+    border-radius: 5px;
15
+    padding: 10px 20px;
16
+    color: #333;
17
+
18
+    .title {
19
+      width: 100%;
20
+      text-align: center;
21
+      font-size: 18px;
22
+      position: relative;
23
+
24
+      i {
25
+        position: absolute;
26
+        right: 0;
27
+        top: 0;
28
+        font-size: 20px;
29
+        color: #666;
30
+        cursor: pointer;
31
+        padding: 0 5px;
32
+      }
33
+    }
34
+
35
+    .content {
36
+      width: 100%;
37
+      height: 117px;
38
+      background: #f9fafb;
39
+      border: 1px solid #e5e9ed;
40
+      border-radius: 5px;
41
+      overflow: hidden;
42
+      margin-top: 12px;
43
+
44
+      div {
45
+        text-align: center;
46
+        margin: 0;
47
+
48
+        &.icon {
49
+          margin-top: 17px;
50
+
51
+          i {
52
+            color: #34b349;
53
+            font-size: 30px !important;
54
+
55
+            &.transport-wenhao {
56
+              color: #f5a523;
57
+            }
58
+
59
+            &.transport-shibai {
60
+              color: #ff3a52;
61
+            }
62
+          }
63
+        }
64
+
65
+        &.defeat {
66
+          color: #333;
67
+          font-size: 18px;
68
+        }
69
+
70
+        &:nth-child(3) {
71
+          font-size: 14px;
72
+          color: #666;
73
+        }
74
+      }
75
+    }
76
+
77
+    button {
78
+      margin-top: 10px;
79
+
80
+      &.btn {
81
+        margin-left: 8px;
82
+      }
83
+    }
84
+  }
85
+
86
+  // 新增
87
+  &.add {
88
+    .modalBody {
89
+      width: 480px;
90
+      height: auto;
91
+
92
+      .content {
93
+        width: 100%;
94
+        height: auto;
95
+        padding: 19px 14px 0 14px;
96
+        max-height: 500px;
97
+        overflow-y: auto;
98
+
99
+        .addForm {
100
+          .ant-form-item {
101
+            margin-bottom: 8px;
102
+
103
+            .ant-form-item-label {
104
+              line-height: 14px;
105
+              text-align: left;
106
+            }
107
+          }
108
+        }
109
+
110
+        .editForm {
111
+          .ant-form-item {
112
+            margin-bottom: 14px;
113
+
114
+            .ant-form-item-label {
115
+              line-height: 0;
116
+            }
117
+          }
118
+        }
119
+      }
120
+
121
+      button:nth-child(1) {
122
+        margin-right: 20px;
123
+      }
124
+    }
125
+  }
126
+}

+ 603 - 0
src/app/views/clinical-users-management/clinical-users-management.component.ts

@@ -0,0 +1,603 @@
1
+import { Component, OnInit, ViewChild } from "@angular/core";
2
+import { ActivatedRoute, Router } from "@angular/router";
3
+import { FormBuilder, Validators, FormGroup } from "@angular/forms";
4
+
5
+import { MainService } from "../../services/main.service";
6
+import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx";
7
+import { ToolService } from "../../services/tool.service";
8
+import { forkJoin, Subject } from "rxjs";
9
+import { debounceTime } from "rxjs/operators";
10
+import { NzMessageService } from "ng-zorro-antd";
11
+
12
+@Component({
13
+  selector: "app-clinical-users-management",
14
+  templateUrl: "./clinical-users-management.component.html",
15
+  styleUrls: ["./clinical-users-management.component.less"],
16
+})
17
+export class ClinicalUsersManagementComponent implements OnInit {
18
+  @ViewChild("osComponentRef1", {
19
+    read: OverlayScrollbarsComponent,
20
+    static: false,
21
+  })
22
+  osComponentRef1: OverlayScrollbarsComponent;
23
+  constructor(
24
+    private message: NzMessageService,
25
+    private fb: FormBuilder,
26
+    private route: ActivatedRoute,
27
+    private router: Router,
28
+    private mainService: MainService,
29
+    private tool: ToolService
30
+  ) {}
31
+
32
+  listOfData: any[] = []; //表格数据
33
+
34
+  modal: boolean = false; //新增/编辑模态框
35
+  add: boolean; //true:新增;false:编辑
36
+  validateForm: FormGroup; //新增/编辑表单
37
+  coopId: number; //表格中执行操作的id
38
+  department: any; //所属科室
39
+  num; //工号
40
+  name; //姓名
41
+  userType: any; //用户类型
42
+  hosId: any; //院区(搜索)
43
+  userGroup; //所属组
44
+  userGroup1; //所属组(搜索)
45
+  userTypes: Array<any>; //所有用户类型
46
+  alldepart: any = []; //所有所属科室
47
+  alldepart1: any = []; //所有所属科室(搜索)
48
+  hospitals1: any = []; //院区列表(搜索)
49
+  allUserGroup: Array<any>; //所有用户组
50
+  allUserGroup1: Array<any>; //用户组(搜索)
51
+  allUserRole: Array<any>; //所有角色
52
+  pageIndex: number = 1; //页码
53
+  listLength: number = 10; //总条数
54
+  pageSize: number = 10; //每页条数
55
+
56
+  promptContent: string; //操作提示框提示信息
57
+  ifSuccess: boolean; //操作成功/失败
58
+  promptInfo: string; //操作结果提示信息
59
+  promptModalShow: boolean; //操作提示框是否展示
60
+
61
+  btnLoading: boolean = false; //提交按钮loading状态
62
+  wxRequired = false; //新增或编辑用户的时候,微信号是否必填
63
+  changeInpSubject = new Subject(); //防抖
64
+  changeInpHospitalSubject = new Subject(); //防抖
65
+
66
+  ngOnInit() {
67
+    //防抖
68
+    this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
69
+      this.getDeparts(v[0], v[1], v[2]);
70
+    });
71
+    //防抖
72
+    this.changeInpHospitalSubject.pipe(debounceTime(500)).subscribe((v) => {
73
+      this.getHospitals(v[0], v[1], v[2]);
74
+    });
75
+    this.coopBtns = this.tool.initCoopBtns(this.route);
76
+    this.initForm();
77
+    this.getUserTypes();
78
+    this.getAllRole();
79
+    this.getGender();
80
+  }
81
+
82
+  // 初始化增删改按钮
83
+  coopBtns: any = {};
84
+  // 搜索
85
+  search() {
86
+    this.pageIndex = 1;
87
+    this.getList();
88
+  }
89
+  // 重置
90
+  reset() {
91
+    this.pageIndex = 1;
92
+    this.name = "";
93
+    this.num = "";
94
+    this.userType = null;
95
+    this.department = null;
96
+    this.userGroup1 = null;
97
+    this.changeHosp1(this.hosId);
98
+    this.getList();
99
+  }
100
+  // 表格数据
101
+  loading1 = false;
102
+  getList() {
103
+    let data = {
104
+      idx: this.pageIndex - 1,
105
+      sum: this.pageSize,
106
+      user: {
107
+        name: this.name || "",
108
+        dept: { id: this.department || "" },
109
+        usertype: { id: this.userType || "" },
110
+        account: this.num || "",
111
+        groupdata: { id: this.userGroup1 || "" },
112
+        hospital: { id: this.hosId || "" },
113
+      },
114
+    };
115
+    if (!data.user.dept || !data.user.dept.id) {
116
+      delete data.user.dept;
117
+    }
118
+    if (!data.user.usertype || !data.user.usertype.id) {
119
+      delete data.user.usertype;
120
+    }
121
+    if (!data.user.groupdata || !data.user.groupdata.id) {
122
+      delete data.user.groupdata;
123
+    }
124
+    if (!data.user.hospital || !data.user.hospital.id) {
125
+      delete data.user.hospital;
126
+    }
127
+    this.loading1 = true;
128
+    this.mainService
129
+      .getFetchDataList("data", "user", data)
130
+      .subscribe((data) => {
131
+        this.loading1 = false;
132
+        this.listOfData = data.list;
133
+        this.listLength = data.totalNum;
134
+      });
135
+  }
136
+
137
+  // 获取所有用户类型
138
+  getUserTypes() {
139
+    this.mainService.getDictionary("list", "usertype").subscribe((data) => {
140
+      this.userTypes = data;
141
+      let userType = data.find(v=>v.value == 1);
142
+      this.userType = userType ? String(userType.id) : null;
143
+      this.getAllHospital();
144
+    });
145
+  }
146
+
147
+  // 获取相应的院区
148
+  getAllHospital() {
149
+    let topLevelParentHosList$ = this.mainService.apiPostAll("topLevelParentHosList", {});
150
+    let topLevelParentHos$ = this.mainService.apiPostAll("topLevelParentHos", {hosId: this.tool.getCurrentHospital().id});
151
+    forkJoin(topLevelParentHosList$, topLevelParentHos$).subscribe((dataArray:any[]) => {
152
+      let [data1, data2] = dataArray;
153
+      this.hospitals1 = data1.topLevelParentHosList || [];
154
+      this.hosId = data2.topHospital ? data2.topHospital.id : null;
155
+      this.changeHosp1(this.hosId);
156
+      this.getList();
157
+    })
158
+  }
159
+
160
+  // 角色列表
161
+  getAllRole() {
162
+    var that = this;
163
+    let data = {
164
+      idx: 0,
165
+      sum: 1000,
166
+    };
167
+    that.mainService
168
+      .getFetchDataList("data", "role", data)
169
+      .subscribe((data) => {
170
+        that.allUserRole = data.list;
171
+      });
172
+  }
173
+
174
+  // 切换院区选项获取对应科室列表
175
+  changeHosp() {
176
+    let hid = this.hosId - 0;
177
+    let data = {
178
+      department: {
179
+        hospital: { id: hid },
180
+      },
181
+      idx: 0,
182
+      sum: 20,
183
+    };
184
+    let groupData = {
185
+      group2: {
186
+        hospitals: hid,
187
+        type:1
188
+      },
189
+      idx: 0,
190
+      sum: 9999,
191
+    };
192
+    this.maskFlag = this.message.loading("正在加载中..", {
193
+      nzDuration: 0,
194
+    }).messageId;
195
+    let department$ = this.mainService.getFetchDataList(
196
+      "data",
197
+      "department",
198
+      data
199
+    );
200
+    let group$ = this.mainService.getFetchDataList("data", "group2", groupData);
201
+    forkJoin(department$, group$).subscribe((res) => {
202
+      this.message.remove(this.maskFlag);
203
+      this.maskFlag = false;
204
+      this.modal = true;
205
+      this.alldepart = res[0]["list"];
206
+      this.allUserGroup = res[1]["list"];
207
+    });
208
+  }
209
+  // 切换院区选项获取对应科室列表(搜索)seimin
210
+  changeHosp1(id) {
211
+    this.department = null;
212
+    this.userGroup1 = null;
213
+    let departmentData = {
214
+      department: {
215
+        hospital: { id },
216
+      },
217
+      idx: 0,
218
+      sum: 20,
219
+    };
220
+    let groupData = {
221
+      group2: {
222
+        hospitals: id,
223
+        type:1
224
+      },
225
+      idx: 0,
226
+      sum: 9999,
227
+    };
228
+    this.mainService
229
+      .getFetchDataList("data", "department", departmentData)
230
+      .subscribe((data) => {
231
+        this.alldepart1 = data.list;
232
+      });
233
+    this.mainService
234
+      .getFetchDataList("data", "group2", groupData)
235
+      .subscribe((data) => {
236
+        this.allUserGroup1 = data.list;
237
+      });
238
+  }
239
+
240
+  // 获取性别
241
+  genders: Array<any> = [];
242
+  getGender() {
243
+    var that = this;
244
+    that.mainService.getDictionary("list", "user_gender").subscribe((data) => {
245
+      that.genders = data;
246
+    });
247
+  }
248
+
249
+  // 新增弹框
250
+  showModal() {
251
+    this.add = true;
252
+    this.initForm();
253
+    this.changeHosp();
254
+  }
255
+  hideModal() {
256
+    this.modal = false;
257
+    this.initForm();
258
+  }
259
+
260
+  // 初始化新增form表单
261
+  initForm() {
262
+    if (this.add) {
263
+      this.alldepart = [];
264
+      this.allUserGroup = [];
265
+    }
266
+    this.validateForm = this.fb.group({
267
+      name: [null, [Validators.required]],
268
+      account: [null, [Validators.required]],
269
+      usertype: [null, [Validators.required]],
270
+      dept: [null, [Validators.required]],
271
+      deptPhone: [null, [Validators.required]],
272
+      gender: [null, [Validators.required]],
273
+      userGroup: [null],
274
+      role: [null, [Validators.required]],
275
+      weixin: [null],
276
+    });
277
+  }
278
+  // 选择用户类型
279
+  usertypeChange() {
280
+    if (this.validateForm.value.usertype == 106) {
281
+      //支助人员
282
+      this.wxRequired = true;
283
+      this.validateForm.get("weixin")!.setValidators(Validators.required);
284
+      this.validateForm.get("weixin")!.markAsDirty();
285
+    } else {
286
+      this.wxRequired = false;
287
+      this.validateForm.get("weixin")!.clearValidators();
288
+      this.validateForm.get("weixin")!.markAsPristine();
289
+    }
290
+    this.validateForm.get("weixin")!.updateValueAndValidity();
291
+  }
292
+  // 表单提交
293
+  submitForm(): void {
294
+    var that = this;
295
+    for (const i in that.validateForm.controls) {
296
+      that.validateForm.controls[i].markAsDirty({ onlySelf: true });
297
+      that.validateForm.controls[i].updateValueAndValidity();
298
+    }
299
+    if (that.validateForm.invalid) return;
300
+    that.btnLoading = true;
301
+    let groups = [],
302
+      roles = [];
303
+    if (that.validateForm.value.userGroup) {
304
+      that.validateForm.value.userGroup.forEach((element) => {
305
+        groups.push({ id: element });
306
+      });
307
+    }
308
+    that.validateForm.value.role.forEach((element) => {
309
+      roles.push({ id: element });
310
+    });
311
+    let data = {
312
+      user: {
313
+        name: that.validateForm.value.name,
314
+        account: that.validateForm.value.account,
315
+        gender: { id: that.validateForm.value.gender, key: "user_gender" },
316
+        usertype: { id: that.validateForm.value.usertype },
317
+        dept: { id: that.validateForm.value.dept },
318
+        group: groups,
319
+        role: roles,
320
+        phone: that.validateForm.value.deptPhone,
321
+        hospital: { id: that.hosId },
322
+        weixin: that.validateForm.value.weixin,
323
+      },
324
+    };
325
+    if (!that.validateForm.value.userGroup) {
326
+      delete data.user.group;
327
+    } else if (that.validateForm.value.userGroup.length === 0) {
328
+      delete data.user.group;
329
+    }
330
+    if (!that.add) {
331
+      data.user["id"] = that.coopId;
332
+    }
333
+    that.mainService
334
+      .coopData(that.add ? "addData" : "updData", "user", data)
335
+      .subscribe((data) => {
336
+        that.btnLoading = false;
337
+        that.hideModal();
338
+        that.initForm();
339
+        if (data.status == 200) {
340
+          that.showPromptModal(that.add ? "新增" : "编辑", true, "");
341
+        } else {
342
+          that.showPromptModal(that.add ? "新增" : "编辑", false, data.msg);
343
+        }
344
+      });
345
+  }
346
+
347
+  // 编辑
348
+  maskFlag: any = false;
349
+  edit(data) {
350
+    // ----------------
351
+    var hid = data.hospital.id;
352
+    let departmentData = {
353
+      department: {
354
+        hospital: { id: hid },
355
+      },
356
+      idx: 0,
357
+      sum: 20,
358
+    };
359
+    let groupData = {
360
+      group2: {
361
+        hospitals: hid,
362
+        type:1
363
+      },
364
+      idx: 0,
365
+      sum: 9999,
366
+    };
367
+    this.maskFlag = this.message.loading("正在加载中..", {
368
+      nzDuration: 0,
369
+    }).messageId;
370
+    this.mainService
371
+      .getFetchDataList("data", "group2", groupData)
372
+      .subscribe((item1) => {
373
+        this.allUserGroup = item1.list;
374
+        this.mainService
375
+          .getFetchDataList("data", "department", departmentData)
376
+          .subscribe((item2) => {
377
+            this.message.remove(this.maskFlag);
378
+            this.maskFlag = false;
379
+            this.modal = true;
380
+            this.alldepart = item2.list;
381
+            if (data.dept) {
382
+              let has = item2.list.some((d) => d.id == data.dept.id);
383
+              if (!has) {
384
+                this.alldepart = [data.dept, ...item2.list];
385
+              }
386
+            }
387
+            this.isLoading = false;
388
+            // ------------------------
389
+            this.add = false;
390
+            this.coopId = data.id;
391
+            let groups = [],
392
+              roles = [];
393
+            if (data.group) {
394
+              data.group.forEach((element) => {
395
+                groups.push(element["id"] + "");
396
+              });
397
+            }
398
+            if (data.role) {
399
+              data.role.forEach((element) => {
400
+                roles.push(element["id"] + "");
401
+              });
402
+            }
403
+            this.validateForm.controls.name.setValue(data.name);
404
+            this.validateForm.controls.account.setValue(data.account);
405
+            this.validateForm.controls.usertype.setValue(data.usertype.id + "");
406
+            if (data.dept) {
407
+              this.validateForm.controls.dept.setValue(data.dept.id);
408
+            }
409
+            this.validateForm.controls.deptPhone.setValue(data.phone);
410
+            this.validateForm.controls.gender.setValue(data.gender.id + "");
411
+            this.validateForm.controls.userGroup.setValue(
412
+              groups.length ? groups : null
413
+            );
414
+            this.validateForm.controls.role.setValue(
415
+              roles.length ? roles : null
416
+            );
417
+            this.validateForm.controls.gender.setValue(data.gender.id + "");
418
+            this.validateForm.controls.weixin.setValue(data.weixin);
419
+            this.usertypeChange();
420
+          });
421
+      });
422
+    // ----------------
423
+  }
424
+
425
+  // 删除
426
+  delModal: boolean = false; //删除模态框
427
+  del(data) {
428
+    let that = this;
429
+    that.coopId = data.id;
430
+    that.delModal = true;
431
+  }
432
+  // 确认删除(删除企业微信用户)
433
+  confirmDel() {
434
+    let that = this;
435
+    that.btnLoading = true;
436
+    that.mainService
437
+      .rmvDataAndWeChatNum([that.coopId], true)
438
+      .subscribe((data) => {
439
+        that.btnLoading = false;
440
+        that.hideDelModal();
441
+        if (data["status"] == 200) {
442
+          if (
443
+            that.listOfData.length == 1 &&
444
+            that.pageIndex == Math.ceil(that.listLength / that.pageSize)
445
+          ) {
446
+            that.listLength--;
447
+            that.pageIndex = Math.ceil(that.listLength / that.pageSize);
448
+          }
449
+          that.showPromptModal("删除", true, "");
450
+        } else {
451
+          that.showPromptModal("删除", false, data["msg"]);
452
+        }
453
+      });
454
+  }
455
+  // 确认删除(不删除企业用户)
456
+  cancenlLoading = false;
457
+  cancelDel() {
458
+    let that = this;
459
+    that.cancenlLoading = true;
460
+    that.mainService
461
+      .rmvDataAndWeChatNum([that.coopId], false)
462
+      .subscribe((data) => {
463
+        that.cancenlLoading = false;
464
+        that.hideDelModal();
465
+        if (data["status"] == 200) {
466
+          if (
467
+            that.listOfData.length == 1 &&
468
+            that.pageIndex == Math.ceil(that.listLength / that.pageSize)
469
+          ) {
470
+            that.listLength--;
471
+            that.pageIndex = Math.ceil(that.listLength / that.pageSize);
472
+          }
473
+          that.showPromptModal("删除", true, "");
474
+        } else {
475
+          that.showPromptModal("删除", false, data["msg"]);
476
+        }
477
+      });
478
+  }
479
+  // 关闭删除模态框
480
+  hideDelModal() {
481
+    this.delModal = false;
482
+  }
483
+
484
+  // ==================重置密码start====================
485
+  // 重置密码
486
+  resetModal: boolean = false; //删除模态框
487
+  resetPwd(data) {
488
+    this.coopId = data.id;
489
+    this.resetModal = true;
490
+  }
491
+  // 确认重置密码
492
+  confirmReset() {
493
+    this.btnLoading = true;
494
+    this.mainService
495
+      .resetpwd(this.coopId)
496
+      .subscribe((data) => {
497
+        this.btnLoading = false;
498
+        this.hideResetModal();
499
+        if (data["status"] == 200) {
500
+          this.showPromptModal("重置密码", true, "");
501
+        } else {
502
+          this.showPromptModal("重置密码", false, data["msg"]);
503
+        }
504
+      });
505
+  }
506
+  // 取消
507
+  cancelReset() {
508
+    this.resetModal = false;
509
+  }
510
+  // 关闭删除模态框
511
+  hideResetModal() {
512
+    this.resetModal = false;
513
+  }
514
+  // ==================重置密码end====================
515
+
516
+  // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
517
+  showPromptModal(con, success, promptInfo?) {
518
+    this.promptModalShow = false;
519
+    this.promptContent = con;
520
+    this.ifSuccess = success;
521
+    this.promptInfo = promptInfo;
522
+    setTimeout(() => {
523
+      this.promptModalShow = true;
524
+    }, 100);
525
+    this.getList();
526
+  }
527
+
528
+  // 查看
529
+  detail(id) {
530
+    this.router.navigateByUrl("/main/usersManagement/userDetail/" + id);
531
+  }
532
+  // 边输边搜节流阀
533
+  isLoading = false;
534
+  changeInp(deptId, type, e) {
535
+    if (!deptId) {
536
+      if (type == "search") {
537
+        this.alldepart1 = [];
538
+      } else if (type == "add") {
539
+        this.alldepart = [];
540
+      }
541
+      return;
542
+    }
543
+    this.isLoading = true;
544
+    this.changeInpSubject.next([deptId, type, e]);
545
+  }
546
+  // 边输边搜节流阀
547
+  changeInpHospital(hosId, type, e) {
548
+    if (!hosId) {
549
+      if (type == "search") {
550
+        this.hospitals1 = [];
551
+      } else if (type == "add") {}
552
+      return;
553
+    }
554
+    this.isLoading = true;
555
+    this.changeInpHospitalSubject.next([hosId, type, e]);
556
+  }
557
+  // 获取所有科室
558
+  snum = 0;
559
+  getDeparts(deptId, type, dept) {
560
+    var that = this;
561
+    let data = {
562
+      department: {
563
+        dept,
564
+        hospital: {
565
+          id: deptId,
566
+        },
567
+      },
568
+      idx: 0,
569
+      sum: 20,
570
+    };
571
+    this.snum++;
572
+    that.mainService
573
+      .getFetchDataList("data", "department", data)
574
+      .subscribe((data) => {
575
+        this.snum--;
576
+        if (type == "search") {
577
+          that.alldepart1 = data.list;
578
+        } else if (type == "add") {
579
+          that.alldepart = data.list;
580
+        }
581
+        if (this.snum === 0) {
582
+          that.isLoading = false;
583
+        }
584
+      });
585
+  }
586
+  // 获取院区
587
+  hnum = 0;
588
+  getHospitals(hosId, type, keword) {
589
+    this.hnum++;
590
+    this.mainService
591
+      .apiPostAll("topLevelParentHosList", {})
592
+      .subscribe((data:any) => {
593
+        this.hnum--;
594
+        if (type == "search") {
595
+          this.hospitals1 = data.list;
596
+        } else if (type == "add") {}
597
+        if (this.hnum === 0) {
598
+          this.isLoading = false;
599
+        }
600
+      });
601
+  }
602
+}
603
+

+ 19 - 0
src/app/views/clinical-users-management/clinical-users-management.module.ts

@@ -0,0 +1,19 @@
1
+import { NgModule } from '@angular/core';
2
+import { CommonModule } from '@angular/common';
3
+
4
+import { ClinicalUsersManagementRoutingModule } from './clinical-users-management-routing.module';
5
+import { ClinicalUsersManagementComponent } from './clinical-users-management.component';
6
+import { ShareModule } from 'src/app/share/share.module';
7
+
8
+
9
+@NgModule({
10
+  declarations: [
11
+    ClinicalUsersManagementComponent
12
+  ],
13
+  imports: [
14
+    CommonModule,
15
+    ClinicalUsersManagementRoutingModule,
16
+    ShareModule
17
+  ]
18
+})
19
+export class ClinicalUsersManagementModule { }

+ 8 - 0
src/app/views/main/main-routing.module.ts

@@ -140,6 +140,14 @@ const routes: Routes = [
140 140
           ),
141 141
       },
142 142
       {
143
+        // 临床用户
144
+        path: "clinicalUsersManagement",
145
+        loadChildren: () =>
146
+          import("../clinical-users-management/clinical-users-management.module").then(
147
+            (m) => m.ClinicalUsersManagementModule
148
+          ),
149
+      },
150
+      {
143 151
         // 权限管理
144 152
         path: "jurisdictionManagement",
145 153
         loadChildren: () =>