Переглянути джерело

临床其他建单-等接口

seimin 1 рік тому
батько
коміт
6982109798

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

@@ -278,6 +278,11 @@ const routes: Routes = [
278 278
         path: "inspectAuto",
279 279
         loadChildren: () => import("../inspect-auto/inspect-auto.module").then((m) => m.InspectAutoModule),
280 280
       },
281
+      // 临床其他建单
282
+      {
283
+        path: "otherAuto",
284
+        loadChildren: () => import("../other-auto/other-auto.module").then((m) => m.OtherAutoModule),
285
+      },
281 286
       // 人员检查主动服务统计
282 287
       {
283 288
         path: "inspectActive",

+ 15 - 0
src/app/views/other-auto/other-auto-routing.module.ts

@@ -0,0 +1,15 @@
1
+import { NgModule } from '@angular/core';
2
+import { Routes, RouterModule } from '@angular/router';
3
+import { OtherAutoComponent } from './other-auto.component';
4
+
5
+
6
+const routes: Routes = [{
7
+  path: '',
8
+  component: OtherAutoComponent,
9
+}];
10
+
11
+@NgModule({
12
+  imports: [RouterModule.forChild(routes)],
13
+  exports: [RouterModule]
14
+})
15
+export class OtherAutoRoutingModule { }

+ 113 - 0
src/app/views/other-auto/other-auto.component.html

@@ -0,0 +1,113 @@
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>
6
+      <div nz-col nzXl='6' class="list-template__btns">
7
+        <button nz-button class="btn default" (click)='search()'>搜索</button>
8
+        <button nz-button *ngIf="coopBtns.add" class="btn ml8 default" (click)="showModal()">新增</button>
9
+      </div>
10
+    </div>
11
+    <div class="list-template__bottom">
12
+      <nz-table class="list-template__nzTable" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false"
13
+        [nzLoading]="loading1">
14
+        <thead>
15
+          <tr class="thead">
16
+            <th nzWidth="20%">自动建单名称</th>
17
+            <th nzWidth="20%">班次</th>
18
+            <th nzWidth="20%">任务类型</th>
19
+            <th nzWidth="20%">是否起始建单</th>
20
+            <th nzWidth="20%">操作</th>
21
+          </tr>
22
+        </thead>
23
+        <tbody>
24
+          <tr *ngFor="let data of listOfData;let index=index;">
25
+            <td>{{ data.name || '' }}</td>
26
+            <td>{{ data.deptDTO ? data.deptDTO.dept : '' }}</td>
27
+            <td>{{ data.code || '' }}</td>
28
+            <td>{{ data.code || '' }}</td>
29
+            <td>
30
+              <div class="coop">
31
+                <span *ngIf="coopBtns.edit" (click)="edit(data)">编辑</span>
32
+                <span *ngIf="coopBtns.del" (click)="del(data)">删除</span>
33
+              </div>
34
+            </td>
35
+          </tr>
36
+        </tbody>
37
+      </nz-table>
38
+      <div class="list-template__pagination">
39
+        <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" nzShowSizeChanger [(nzPageSize)]="pageSize"
40
+          (nzPageIndexChange)="getList()" (nzPageSizeChange)="getList()">
41
+        </nz-pagination>
42
+      </div>
43
+    </div>
44
+  </div>
45
+</div>
46
+<!-- 新增/编辑模态框 -->
47
+<div class="save add display_flex align-items_center justify-content_flex-center" *ngIf="modal">
48
+  <div class="modalBody">
49
+    <div class="title">{{add?"新增":"编辑"}}<i class="icon_transport transport-guanbi" (click)="hideModal()"></i>
50
+    </div>
51
+    <overlay-scrollbars #osComponentRef1 class="content">
52
+      <form nz-form [formGroup]="validateForm" class="addForm" (ngSubmit)="submitForm()">
53
+        <nz-form-item>
54
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="name">自动建单名称</nz-form-label>
55
+          <nz-form-control nzErrorTip="请填写自动建单名称!">
56
+            <nz-input-group>
57
+              <input type="text" nz-input formControlName="name" placeholder="请填写自动建单名称" />
58
+            </nz-input-group>
59
+          </nz-form-control>
60
+        </nz-form-item>
61
+        <nz-form-item>
62
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="deptId">班次</nz-form-label>
63
+          <nz-form-control nzErrorTip="请选择班次!">
64
+            <nz-select [nzDropdownMatchSelectWidth]="false" formControlName="deptId" nzShowSearch nzAllowClear nzPlaceHolder="请选择班次" nzServerSearch (nzOnSearch)="changeSchedule($event)" (nzOpenChange)="openSchedule($event)">
65
+              <ng-container *ngFor="let data of scheduleList">
66
+                <nz-option *ngIf="!isLoading" [nzLabel]="data.name" [nzValue]="data.id">
67
+                </nz-option>
68
+              </ng-container>
69
+              <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
70
+                <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
71
+              </nz-option>
72
+            </nz-select>
73
+          </nz-form-control>
74
+        </nz-form-item>
75
+        <nz-form-item>
76
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="taskTypes">任务类型</nz-form-label>
77
+          <nz-form-control nzErrorTip="请选择任务类型!">
78
+            <nz-select nzMode="multiple" [nzDropdownMatchSelectWidth]="false" formControlName="taskTypes" nzShowSearch nzAllowClear nzPlaceHolder="请选择任务类型" nzServerSearch (nzOnSearch)="changeInp($event)" (nzOpenChange)="openOtherTasktype($event)">
79
+              <ng-container *ngFor="let data of taskTypeList">
80
+                <nz-option *ngIf="!isLoading" [nzLabel]="data.name" [nzValue]="data.id">
81
+                </nz-option>
82
+              </ng-container>
83
+              <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
84
+                <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
85
+              </nz-option>
86
+            </nz-select>
87
+          </nz-form-control>
88
+        </nz-form-item>
89
+        <nz-form-item>
90
+          <nz-form-label style="line-height:40px;" [nzSm]="6" [nzXs]="24" nzRequired nzFor="gender">是否起始建单</nz-form-label>
91
+          <nz-form-control nzErrorTip="请选择是否起始建单!">
92
+            <nz-radio-group type="gender" formControlName="gender">
93
+              <label nz-radio [nzValue]="1">是</label>
94
+              <label nz-radio [nzValue]="0">否</label>
95
+            </nz-radio-group>
96
+          </nz-form-control>
97
+        </nz-form-item>
98
+      </form>
99
+    </overlay-scrollbars>
100
+    <div class="display_flex justify-content_flex-center">
101
+      <button nzType="primary" nz-button (click)="submitForm()" [nzLoading]="btnLoading">确认</button>
102
+      <button class="btn cancel" nz-button nzType="default" (click)="hideModal()">取消</button>
103
+    </div>
104
+  </div>
105
+</div>
106
+<!-- 删除模态框 -->
107
+<app-dialog-delete [delModal]="delModal" (hideDelModalEvent)="hideDelModal()" [btnLoading]="btnLoading" (confirmDelEvent)="confirmDel()" content="是否确认删除?"></app-dialog-delete>
108
+
109
+<!-- 操作成功/失败提示框 -->
110
+<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow" [info]="promptInfo"></app-prompt-modal>
111
+
112
+<!-- 遮罩 -->
113
+<app-mask *ngIf="maskFlag"></app-mask>

+ 126 - 0
src/app/views/other-auto/other-auto.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
+}

+ 274 - 0
src/app/views/other-auto/other-auto.component.ts

@@ -0,0 +1,274 @@
1
+import { Component, OnInit, ViewChild } from "@angular/core";
2
+import { ActivatedRoute } from "@angular/router";
3
+import { FormBuilder, Validators, FormGroup } from "@angular/forms";
4
+
5
+import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx";
6
+import { ToolService } from "../../services/tool.service";
7
+import { Subject } from "rxjs";
8
+import { debounceTime } from "rxjs/operators";
9
+import { OtherAutoService } from './other-auto.service';
10
+
11
+@Component({
12
+  selector: "app-other-auto",
13
+  templateUrl: "./other-auto.component.html",
14
+  styleUrls: ["./other-auto.component.less"],
15
+})
16
+export class OtherAutoComponent implements OnInit {
17
+  @ViewChild("osComponentRef1", {
18
+    read: OverlayScrollbarsComponent,
19
+    static: false,
20
+  })
21
+  osComponentRef1: OverlayScrollbarsComponent;
22
+  constructor(
23
+    private fb: FormBuilder,
24
+    private route: ActivatedRoute,
25
+    private tool: ToolService,
26
+    private otherAutoService: OtherAutoService,
27
+  ) {}
28
+
29
+  listOfData: any[] = []; //表格数据
30
+
31
+  modal: boolean = false; //新增/编辑模态框
32
+  add: boolean; //true:新增;false:编辑
33
+  validateForm: FormGroup; //新增/编辑表单
34
+  coopId: number; //表格中执行操作的id
35
+  department: any; //所属科室
36
+  hosId: any; //院区(搜索)
37
+  scheduleList: Array<any>; //所有班次
38
+  taskTypeList: Array<any>; //所有其他临床服务
39
+  pageIndex: number = 1; //页码
40
+  listLength: number = 10; //总条数
41
+  pageSize: number = 10; //每页条数
42
+
43
+  promptContent: string; //操作提示框提示信息
44
+  ifSuccess: boolean; //操作成功/失败
45
+  promptInfo: string; //操作结果提示信息
46
+  promptModalShow: boolean; //操作提示框是否展示
47
+
48
+  btnLoading: boolean = false; //提交按钮loading状态
49
+  changeInpSubject = new Subject(); //防抖
50
+  changeScheduleSubject = new Subject(); //防抖
51
+
52
+  // 初始化增删改按钮
53
+  coopBtns: any = {};
54
+
55
+  ngOnInit() {
56
+    //防抖
57
+    this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
58
+      this.getOtherTasktype(v[0]);
59
+    });
60
+    //防抖
61
+    this.changeScheduleSubject.pipe(debounceTime(500)).subscribe((v) => {
62
+      this.getScheduleList(v[0]);
63
+    });
64
+    this.coopBtns = this.tool.initCoopBtns(this.route);
65
+    this.initForm();
66
+    this.hosId = this.tool.getCurrentHospital().id;
67
+    this.getList(true);
68
+  }
69
+
70
+  // 搜索
71
+  search() {
72
+    this.getList(true);
73
+  }
74
+  // 表格数据
75
+  loading1 = false;
76
+  getList(isResetPageIndex = false) {
77
+    isResetPageIndex && (this.pageIndex = 1);
78
+    let data = {
79
+      pageIndex: this.pageIndex,
80
+      pageSize: this.pageSize,
81
+      hosId: this.hosId,
82
+    };
83
+    this.loading1 = true;
84
+    this.otherAutoService
85
+      .query(data)
86
+      .subscribe((result) => {
87
+        this.loading1 = false;
88
+        result.list = result.list || [];
89
+        this.listOfData = result.list;
90
+        this.listLength = result.totalNum;
91
+      });
92
+  }
93
+
94
+  // 获取任务类型列表-其他临床服务
95
+  getOtherTasktype(keywords = '') {
96
+    let hosId = this.tool.getCurrentHospital().id;
97
+    this.isLoading = true;
98
+    this.otherAutoService.queryOtherTasktype({
99
+      hosId,
100
+      keywords,
101
+    }).subscribe((res) => {
102
+      this.isLoading = false;
103
+      this.taskTypeList = res.list || [];
104
+    });
105
+  }
106
+
107
+  // 获取班次
108
+  getScheduleList(keywords = '') {
109
+    let hosId = this.tool.getCurrentHospital().id;
110
+    this.isLoading = true;
111
+    this.otherAutoService.querySchedule({
112
+      hosId,
113
+      keywords,
114
+    }).subscribe((res) => {
115
+      this.isLoading = false;
116
+      this.scheduleList = res.list || [];
117
+    });
118
+  }
119
+
120
+  // 新增弹框
121
+  showModal() {
122
+    this.add = true;
123
+    this.modal = true;
124
+    this.initForm();
125
+    this.validateForm.controls.gender.setValue(0);
126
+  }
127
+  hideModal() {
128
+    this.modal = false;
129
+    this.initForm();
130
+  }
131
+
132
+  // 初始化新增form表单
133
+  initForm() {
134
+    if (this.add) {
135
+      this.scheduleList = [];
136
+      this.taskTypeList = [];
137
+    }
138
+    this.validateForm = this.fb.group({
139
+      name: ['', [Validators.required]],
140
+      deptId: [null, [Validators.required]],
141
+      taskTypes: [null, [Validators.required]],
142
+      gender: [null, [Validators.required]],
143
+    });
144
+  }
145
+  // 表单提交
146
+  submitForm(): void {
147
+    for (const i in this.validateForm.controls) {
148
+      this.validateForm.controls[i].markAsDirty({ onlySelf: true });
149
+      this.validateForm.controls[i].updateValueAndValidity();
150
+    }
151
+    if (this.validateForm.invalid) return;
152
+    this.btnLoading = true;
153
+    if(this.add){
154
+      this.otherAutoService
155
+      .add({
156
+        name: this.validateForm.value.name,
157
+        deptId: this.validateForm.value.deptId,
158
+        hosId: this.hosId,
159
+      })
160
+      .subscribe((data) => {
161
+        this.btnLoading = false;
162
+        this.hideModal();
163
+        this.initForm();
164
+        if (data.status == 200) {
165
+          this.showPromptModal(this.add ? "新增" : "编辑", true, "");
166
+        } else {
167
+          this.showPromptModal(this.add ? "新增" : "编辑", false, data.msg);
168
+        }
169
+      });
170
+    }else{
171
+      this.otherAutoService
172
+      .update({
173
+        name: this.validateForm.value.name,
174
+        deptId: this.validateForm.value.deptId,
175
+        coopData: this.coopData,
176
+      })
177
+      .subscribe((data) => {
178
+        this.btnLoading = false;
179
+        this.hideModal();
180
+        this.initForm();
181
+        if (data.status == 200) {
182
+          this.showPromptModal(this.add ? "新增" : "编辑", true, "");
183
+        } else {
184
+          this.showPromptModal(this.add ? "新增" : "编辑", false, data.msg);
185
+        }
186
+      });
187
+    }
188
+  }
189
+
190
+  // 编辑
191
+  maskFlag: any = false;
192
+  coopData = {};
193
+  edit(data) {
194
+    this.validateForm.controls.name.setValue(data.name);
195
+    this.validateForm.controls.deptId.setValue(data.deptId);
196
+    this.modal = true;
197
+    this.add = false;
198
+    this.coopId = data.id;
199
+    this.coopData = data;
200
+    this.getOtherTasktype();
201
+    this.getScheduleList();
202
+  }
203
+
204
+  // 删除
205
+  delModal: boolean = false; //删除模态框
206
+  del(data) {
207
+    this.coopId = data.id;
208
+    this.delModal = true;
209
+  }
210
+  // 确认删除
211
+  confirmDel() {
212
+    this.btnLoading = true;
213
+    this.otherAutoService
214
+      .delete({
215
+        id: this.coopId
216
+      })
217
+      .subscribe((data) => {
218
+        this.btnLoading = false;
219
+        this.hideDelModal();
220
+        if (data.status == 200) {
221
+          if (this.listOfData.length == 1 && this.pageIndex == Math.ceil(this.listLength / this.pageSize)) {
222
+            this.listLength--;
223
+            this.pageIndex = Math.ceil(this.listLength / this.pageSize);
224
+          }
225
+          this.showPromptModal("删除", true, "");
226
+        } else {
227
+          this.showPromptModal("删除", false, data.msg);
228
+        }
229
+      });
230
+  }
231
+
232
+  // 关闭删除模态框
233
+  hideDelModal() {
234
+    this.delModal = false;
235
+  }
236
+
237
+  // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
238
+  showPromptModal(con, success, promptInfo?) {
239
+    this.promptModalShow = false;
240
+    this.promptContent = con;
241
+    this.ifSuccess = success;
242
+    this.promptInfo = promptInfo;
243
+    setTimeout(() => {
244
+      this.promptModalShow = true;
245
+    }, 100);
246
+    this.getList(true);
247
+  }
248
+
249
+  // 边输边搜节流阀
250
+  isLoading = false;
251
+  changeInp(e) {
252
+    this.changeInpSubject.next([e]);
253
+  }
254
+
255
+  // 边输边搜节流阀
256
+  changeSchedule(e) {
257
+    this.changeScheduleSubject.next([e]);
258
+  }
259
+
260
+  // 打开任务类型
261
+  openOtherTasktype(e){
262
+    if(e){
263
+      this.getOtherTasktype();
264
+    }
265
+  }
266
+
267
+  // 打开班次
268
+  openSchedule(e){
269
+    if(e){
270
+      this.getScheduleList();
271
+    }
272
+  }
273
+}
274
+

+ 19 - 0
src/app/views/other-auto/other-auto.module.ts

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

+ 98 - 0
src/app/views/other-auto/other-auto.service.ts

@@ -0,0 +1,98 @@
1
+import { Injectable } from '@angular/core';
2
+import { MainService } from 'src/app/services/main.service';
3
+import { map } from 'rxjs/operators';
4
+
5
+@Injectable({
6
+  providedIn: 'root'
7
+})
8
+export class OtherAutoService {
9
+  constructor(
10
+    private mainService: MainService,
11
+  ) { }
12
+
13
+  // 列表-查
14
+  query({pageIndex, pageSize, hosId}) {
15
+    let data = {
16
+      idx: pageIndex - 1,
17
+      sum: pageSize,
18
+      qrCode: {
19
+        hosId,
20
+      },
21
+    };
22
+    return this.mainService.getFetchDataList("simple/data", "qrCode", data);
23
+  }
24
+
25
+  // 列表-删
26
+  delete({id}) {
27
+    return this.mainService.simplePost("rmvData", "qrCode", [id]);
28
+  }
29
+
30
+  // 列表-增
31
+  add({name, deptId, hosId}) {
32
+    let data = {
33
+      name,
34
+      deptId,
35
+      hosId,
36
+    };
37
+
38
+    return this.mainService.simplePost("addData", "qrCode", data);
39
+  }
40
+
41
+  // 列表-改
42
+  update({name, deptId, coopData}) {
43
+    let data = {
44
+      name,
45
+      deptId,
46
+    };
47
+    data = {...coopData, ...data};
48
+    return this.mainService.simplePost("addData", "qrCode", data);
49
+  }
50
+
51
+  // 查询任务类型-其他临床服务
52
+  queryOtherTasktype({hosId, keywords}){
53
+    let postData = {
54
+      taskType: {
55
+        simpleQuery: true,
56
+        hosIds: hosId,
57
+        associationType: {
58
+          key: 'association_types',
59
+          value : 'other',
60
+        },
61
+        taskName: keywords,
62
+      },
63
+      idx: 0,
64
+      sum: 9999,
65
+    };
66
+    return this.mainService.getFetchDataList("configuration", "taskType", postData).pipe(map((v:any) => {
67
+      if(Array.isArray(v.list)){
68
+        v.list = v.list.map(vv => ({id: vv.id, name: vv.taskName}));
69
+      }else{
70
+        v.list = [];
71
+      }
72
+      return v;
73
+    }));
74
+  }
75
+
76
+  // 查询班次
77
+  querySchedule({hosId, keywords}){
78
+    let postData = {
79
+      scheduleClass: {
80
+        hospital: {
81
+          id: hosId
82
+        },
83
+        name: keywords,
84
+      },
85
+      idx: 0,
86
+      sum: 9999,
87
+    };
88
+    return this.mainService.getFetchDataList("configuration", "scheduleClass", postData).pipe(map((v:any) => {
89
+      if(Array.isArray(v.list)){
90
+        v.list = v.list.map(vv => ({id: vv.id, name: vv.name}));
91
+      }else{
92
+        v.list = [];
93
+      }
94
+      return v;
95
+    }));
96
+  }
97
+}
98
+