|
@@ -0,0 +1,343 @@
|
|
1
|
+import { Component, OnInit } from "@angular/core";
|
|
2
|
+import { MainService } from 'src/app/services/main.service';
|
|
3
|
+import { ToolService } from 'src/app/services/tool.service';
|
|
4
|
+import { NzMessageService } from 'ng-zorro-antd';
|
|
5
|
+import { Subject } from 'rxjs';
|
|
6
|
+import { debounceTime } from 'rxjs/operators';
|
|
7
|
+import { format, startOfMinute } from 'date-fns';
|
|
8
|
+
|
|
9
|
+@Component({
|
|
10
|
+ selector: "app-acc-examine-set",
|
|
11
|
+ templateUrl: "./acc-examine-set.component.html",
|
|
12
|
+ styleUrls: ["./acc-examine-set.component.less"],
|
|
13
|
+})
|
|
14
|
+export class AccExamineSetComponent implements OnInit {
|
|
15
|
+ loading:boolean = false; //页面加载的loading
|
|
16
|
+ btnLoading:boolean = false; //提交按钮的loading
|
|
17
|
+ tabModalName:string = 'characteristics'; //当前选中的tab
|
|
18
|
+ surgeryField = null; //手术关联业务
|
|
19
|
+ hosId = this.tool.getCurrentHospital().id; //当前院区
|
|
20
|
+ // 接手术关联任务类型
|
|
21
|
+ tasktypeId:any;
|
|
22
|
+ taskTypes1:any[] = [];
|
|
23
|
+ taskTypes2:any[] = [];
|
|
24
|
+ // 苏醒室科室
|
|
25
|
+ recoveryDeptId:any;
|
|
26
|
+ recoveryDepts:any[] = [];
|
|
27
|
+ // 自动建单
|
|
28
|
+ autoCreateOrders:any[] = [
|
|
29
|
+ {label:'是否开启',value: 0}
|
|
30
|
+ ];
|
|
31
|
+ // 是否开通送回病房
|
|
32
|
+ autoSendWard:any[] = [
|
|
33
|
+ {label:'是否开启',value: 0}
|
|
34
|
+ ];
|
|
35
|
+ // 是否开通送回苏醒室
|
|
36
|
+ autoSendAwakeningRoom:any[] = [
|
|
37
|
+ {label:'是否开启',value: 0}
|
|
38
|
+ ];
|
|
39
|
+ // 是否开通关联手术清洁建单
|
|
40
|
+ autoRemandClean:any[] = [
|
|
41
|
+ {label:'是否开启',value: 0}
|
|
42
|
+ ];
|
|
43
|
+ // 是否开启手术即将开始通知
|
|
44
|
+ surgeryBegin:any[] = [
|
|
45
|
+ {label:'是否开启',value: 0}
|
|
46
|
+ ];
|
|
47
|
+ // 建单时间
|
|
48
|
+ autoTime:Date | null = null;
|
|
49
|
+ tasktype1Id:any;
|
|
50
|
+ tasktype2Id:any;
|
|
51
|
+ cleanTypeId:any;
|
|
52
|
+ // 配置
|
|
53
|
+ configs:any = {};
|
|
54
|
+ searchTimerSubject = new Subject();
|
|
55
|
+ constructor(private mainService: MainService,private tool: ToolService,private msg: NzMessageService) {}
|
|
56
|
+
|
|
57
|
+ ngOnInit():void {
|
|
58
|
+ // todo
|
|
59
|
+ this.searchTimerSubject.pipe(debounceTime(500)).subscribe((v) => {
|
|
60
|
+ let fun = v[0];
|
|
61
|
+ fun.call(this, v[1], v[2], v[3]);
|
|
62
|
+ });
|
|
63
|
+ this.getTaskTypes('', true, 1);
|
|
64
|
+ this.getTaskTypes('', false, 2);
|
|
65
|
+ }
|
|
66
|
+
|
|
67
|
+ // 切换tab
|
|
68
|
+ tabModal(tabModalName:string){
|
|
69
|
+ this.tabModalName = tabModalName;
|
|
70
|
+ }
|
|
71
|
+ // 修改是否自动建单
|
|
72
|
+ changeAutoCreateOrders(e){
|
|
73
|
+ console.log(e);
|
|
74
|
+ if(!e[0].checked){
|
|
75
|
+ // todo
|
|
76
|
+ this.autoTime = null;
|
|
77
|
+ }
|
|
78
|
+ }
|
|
79
|
+
|
|
80
|
+ // 修改是否开通送回病房
|
|
81
|
+ changeAutoSendWard(e){
|
|
82
|
+ console.log(e);
|
|
83
|
+ if(!e[0].checked){
|
|
84
|
+ // todo
|
|
85
|
+ this.tasktype1Id = null;
|
|
86
|
+ }
|
|
87
|
+ }
|
|
88
|
+
|
|
89
|
+ // 修改是否开通送回苏醒室
|
|
90
|
+ changeAutoSendAwakeningRoom(e){
|
|
91
|
+ console.log(e);
|
|
92
|
+ if(!e[0].checked){
|
|
93
|
+ // todo
|
|
94
|
+ this.tasktype2Id = null;
|
|
95
|
+ }
|
|
96
|
+ }
|
|
97
|
+
|
|
98
|
+ // 修改是否开通关联手术清洁建单
|
|
99
|
+ changeAutoRemandClean(e){
|
|
100
|
+ console.log(e);
|
|
101
|
+ if(!e[0].checked){
|
|
102
|
+ // todo
|
|
103
|
+ this.cleanTypeId = null;
|
|
104
|
+ }
|
|
105
|
+ }
|
|
106
|
+
|
|
107
|
+ // 保存
|
|
108
|
+ submitForm() {
|
|
109
|
+ if(!this.tasktypeId){
|
|
110
|
+ this.msg.create("warning", "请选择接手术关联任务类型!");
|
|
111
|
+ return;
|
|
112
|
+ }
|
|
113
|
+ if(!this.recoveryDeptId){
|
|
114
|
+ this.msg.create("warning", "请选择苏醒室科室!");
|
|
115
|
+ return;
|
|
116
|
+ }
|
|
117
|
+ if(this.autoCreateOrders[0].checked && !this.autoTime){
|
|
118
|
+ this.msg.create("warning", "请选择建单时间!");
|
|
119
|
+ return;
|
|
120
|
+ }
|
|
121
|
+ if(this.autoSendWard[0].checked && !this.tasktype1Id){
|
|
122
|
+ this.msg.create("warning", "请选择送回病房任务类型!");
|
|
123
|
+ return;
|
|
124
|
+ }
|
|
125
|
+ if(this.autoSendAwakeningRoom[0].checked && !this.tasktype2Id){
|
|
126
|
+ this.msg.create("warning", "请选择送回苏醒室任务类型!");
|
|
127
|
+ return;
|
|
128
|
+ }
|
|
129
|
+ if(this.autoRemandClean[0].checked && !this.cleanTypeId){
|
|
130
|
+ this.msg.create("warning", "请选择手术清洁任务类型!");
|
|
131
|
+ return;
|
|
132
|
+ }
|
|
133
|
+ let editData:any = {
|
|
134
|
+ hosId: this.hosId,
|
|
135
|
+ taskType: this.tasktypeId || undefined,
|
|
136
|
+ recoveryDeptId: this.recoveryDeptId || undefined,
|
|
137
|
+ ordinaryField: this.surgeryField,
|
|
138
|
+ autoCreate: this.autoCreateOrders[0].checked ? 1 : 0,
|
|
139
|
+ createTime: this.autoTime ? format(startOfMinute(this.autoTime), "yyyy-MM-dd HH:mm:ss") : undefined,
|
|
140
|
+ remandClinical: this.autoSendWard[0].checked ? 1 : 0,
|
|
141
|
+ clinicalTypeId: this.tasktype1Id || undefined,
|
|
142
|
+ remandRecovery: this.autoSendAwakeningRoom[0].checked ? 1 : 0,
|
|
143
|
+ recoveryTypeId: this.tasktype2Id || undefined,
|
|
144
|
+ remandClean: this.autoRemandClean[0].checked ? 1 : 0,
|
|
145
|
+ surgeryBegin: this.surgeryBegin[0].checked ? 1 : 0,
|
|
146
|
+ cleanTypeId: this.cleanTypeId || undefined,
|
|
147
|
+ };
|
|
148
|
+ let postData = Object.assign({}, this.configs, editData);
|
|
149
|
+ console.log(postData);
|
|
150
|
+ this.btnLoading = true;
|
|
151
|
+ this.mainService
|
|
152
|
+ .simplePost("addData", "taskTypeConfig", postData)
|
|
153
|
+ .subscribe((result) => {
|
|
154
|
+ this.btnLoading = false;
|
|
155
|
+ if (result.status == 200) {
|
|
156
|
+ this.getConfig();
|
|
157
|
+ }
|
|
158
|
+ });
|
|
159
|
+ }
|
|
160
|
+
|
|
161
|
+ // 用户输入搜索任务类型
|
|
162
|
+ isLoading: boolean = false;
|
|
163
|
+ changeTasktype(e, type) {
|
|
164
|
+ this.searchTimer(this.getTaskTypes, e, false, type);
|
|
165
|
+ }
|
|
166
|
+
|
|
167
|
+ changeRecoveryDepts(e) {
|
|
168
|
+ this.searchTimer(this.getRecoveryDepts, e, false);
|
|
169
|
+ }
|
|
170
|
+
|
|
171
|
+ // 边输入边搜索节流阀
|
|
172
|
+ searchTimer(fun, e, isFirst, type?) {
|
|
173
|
+ this.isLoading = true;
|
|
174
|
+ this.searchTimerSubject.next([fun, e, isFirst, type]);
|
|
175
|
+ }
|
|
176
|
+
|
|
177
|
+ //获取接手术关联任务类型
|
|
178
|
+ // 1 患者其他服务
|
|
179
|
+ // 2 其他临床服务
|
|
180
|
+ getTaskTypes(e:string = '', isFirst:boolean = false, type:number = 1) {
|
|
181
|
+ isFirst && (this.loading = true);
|
|
182
|
+ let postData:any = {
|
|
183
|
+ idx: 0,
|
|
184
|
+ sum: 10,
|
|
185
|
+ taskType: {
|
|
186
|
+ taskName: e,
|
|
187
|
+ simpleQuery: true,
|
|
188
|
+ hosId: {
|
|
189
|
+ id: this.hosId
|
|
190
|
+ }
|
|
191
|
+ }
|
|
192
|
+ };
|
|
193
|
+ if(type === 1){
|
|
194
|
+ postData.taskType.associationType = {
|
|
195
|
+ key: 'association_types',
|
|
196
|
+ value: 'patientTransport'
|
|
197
|
+ }
|
|
198
|
+ }else if(type === 2){
|
|
199
|
+ postData.taskType.associationType = {
|
|
200
|
+ key: 'association_types',
|
|
201
|
+ value: 'other'
|
|
202
|
+ }
|
|
203
|
+ }
|
|
204
|
+ this.isLoading = true;
|
|
205
|
+ this.mainService
|
|
206
|
+ .getFetchDataList("simple/data", "taskType", postData)
|
|
207
|
+ .subscribe((result) => {
|
|
208
|
+ this.isLoading = false;
|
|
209
|
+ if (result.status == 200) {
|
|
210
|
+ if(type === 1){
|
|
211
|
+ this.taskTypes1 = result.list || [];
|
|
212
|
+ }else if(type === 2){
|
|
213
|
+ this.taskTypes2 = result.list || [];
|
|
214
|
+ }
|
|
215
|
+ isFirst && this.getDeptType(true);
|
|
216
|
+ }
|
|
217
|
+ });
|
|
218
|
+ }
|
|
219
|
+
|
|
220
|
+ //获取所有科室类型
|
|
221
|
+ allDeptTypes:any[] = [];
|
|
222
|
+ getDeptType(isFirst:boolean = false) {
|
|
223
|
+ isFirst && (this.loading = true);
|
|
224
|
+ this.mainService
|
|
225
|
+ .getDictionary("list", "dept_type")
|
|
226
|
+ .subscribe((result) => {
|
|
227
|
+ this.allDeptTypes = result;
|
|
228
|
+ isFirst && this.getRecoveryDepts('', true);
|
|
229
|
+ });
|
|
230
|
+ }
|
|
231
|
+
|
|
232
|
+ //获取所有科室
|
|
233
|
+ getRecoveryDepts(e:string = '', isFirst:boolean = false) {
|
|
234
|
+ isFirst && (this.loading = true);
|
|
235
|
+ let recovery = this.allDeptTypes.find(v => v.value === 'recovery');
|
|
236
|
+ let postData = {
|
|
237
|
+ idx: 0,
|
|
238
|
+ sum: 10,
|
|
239
|
+ department: {
|
|
240
|
+ dept: e,
|
|
241
|
+ hospital: {
|
|
242
|
+ id: this.hosId
|
|
243
|
+ },
|
|
244
|
+ type: recovery || undefined
|
|
245
|
+ }
|
|
246
|
+ };
|
|
247
|
+ this.isLoading = true;
|
|
248
|
+ this.mainService
|
|
249
|
+ .getFetchDataList("data", "department", postData)
|
|
250
|
+ .subscribe((result) => {
|
|
251
|
+ this.isLoading = false;
|
|
252
|
+ if (result.status == 200) {
|
|
253
|
+ this.recoveryDepts = result.list || [];
|
|
254
|
+ isFirst && this.getConfig();
|
|
255
|
+ }
|
|
256
|
+ });
|
|
257
|
+ }
|
|
258
|
+ // 获取配置
|
|
259
|
+ getConfig() {
|
|
260
|
+ this.loading = true;
|
|
261
|
+ this.mainService
|
|
262
|
+ .getDictionary("list", "ordinary_field")
|
|
263
|
+ .subscribe((data) => {
|
|
264
|
+ this.surgeryField = data.find(v => v.value == 'surgery');
|
|
265
|
+ if(this.surgeryField){
|
|
266
|
+ let postData = {
|
|
267
|
+ idx: 0,
|
|
268
|
+ sum: 10,
|
|
269
|
+ taskTypeConfig: {
|
|
270
|
+ hosId: this.hosId,
|
|
271
|
+ ordinaryField: this.surgeryField
|
|
272
|
+ }
|
|
273
|
+ };
|
|
274
|
+ this.mainService
|
|
275
|
+ .getFetchDataList("simple/data", "taskTypeConfig", postData)
|
|
276
|
+ .subscribe((result) => {
|
|
277
|
+ this.loading = false;
|
|
278
|
+ if (result.status == 200) {
|
|
279
|
+ this.configs = result.list[0] || {};
|
|
280
|
+
|
|
281
|
+ // 接手术关联任务类型
|
|
282
|
+ this.tasktypeId = this.configs.taskTypeDTO ? this.configs.taskTypeDTO.id : null;
|
|
283
|
+ if(this.tasktypeId && this.configs.taskTypeDTO){
|
|
284
|
+ let isInArr = this.taskTypes1.some(v => v.id == this.tasktypeId);
|
|
285
|
+ if(!isInArr){
|
|
286
|
+ this.taskTypes1.unshift(this.configs.taskTypeDTO);
|
|
287
|
+ }
|
|
288
|
+ }
|
|
289
|
+
|
|
290
|
+ // 苏醒室科室
|
|
291
|
+ this.recoveryDeptId = this.configs.recoveryDeptId || null;
|
|
292
|
+ if(this.recoveryDeptId && this.configs.recoveryDeptDTO){
|
|
293
|
+ let isInArr = this.recoveryDepts.some(v => v.id == this.recoveryDeptId);
|
|
294
|
+ if(!isInArr){
|
|
295
|
+ this.recoveryDepts.unshift(this.configs.recoveryDeptDTO);
|
|
296
|
+ }
|
|
297
|
+ }
|
|
298
|
+
|
|
299
|
+ this.autoCreateOrders[0].checked = this.configs.autoCreate == 1;
|
|
300
|
+ this.autoTime = this.configs.createTime ? new Date(this.configs.createTime) : null;
|
|
301
|
+ this.autoSendWard[0].checked = this.configs.remandClinical == 1;
|
|
302
|
+
|
|
303
|
+ // 送回病房科室
|
|
304
|
+ this.tasktype1Id = this.configs.clinicalTypeId || null;
|
|
305
|
+ if(this.tasktype1Id && this.configs.clinicalTypeDTO){
|
|
306
|
+ let isInArr = this.taskTypes1.some(v => v.id == this.tasktype1Id);
|
|
307
|
+ if(!isInArr){
|
|
308
|
+ this.taskTypes1.unshift(this.configs.clinicalTypeDTO);
|
|
309
|
+ }
|
|
310
|
+ }
|
|
311
|
+ this.autoSendAwakeningRoom[0].checked = this.configs.remandRecovery == 1;
|
|
312
|
+
|
|
313
|
+ // 送回苏醒室科室
|
|
314
|
+ this.tasktype2Id = this.configs.recoveryTypeId || null;
|
|
315
|
+ if(this.tasktype2Id && this.configs.recoveryType){
|
|
316
|
+ let isInArr = this.taskTypes1.some(v => v.id == this.tasktype2Id);
|
|
317
|
+ if(!isInArr){
|
|
318
|
+ this.taskTypes1.unshift(this.configs.recoveryType);
|
|
319
|
+ }
|
|
320
|
+ }
|
|
321
|
+
|
|
322
|
+ this.autoRemandClean[0].checked = this.configs.remandClean == 1;
|
|
323
|
+
|
|
324
|
+ // 关联手术清洁
|
|
325
|
+ this.cleanTypeId = this.configs.cleanTypeId || null;
|
|
326
|
+ if(this.cleanTypeId && this.configs.cleanType){
|
|
327
|
+ let isInArr = this.taskTypes2.some(v => v.id == this.cleanTypeId);
|
|
328
|
+ if(!isInArr){
|
|
329
|
+ this.taskTypes2.unshift(this.configs.cleanType);
|
|
330
|
+ }
|
|
331
|
+ }
|
|
332
|
+
|
|
333
|
+ this.surgeryBegin[0].checked = this.configs.surgeryBegin == 1;
|
|
334
|
+ }
|
|
335
|
+ });
|
|
336
|
+ }else{
|
|
337
|
+ this.loading = false;
|
|
338
|
+ }
|
|
339
|
+ });
|
|
340
|
+ }
|
|
341
|
+}
|
|
342
|
+
|
|
343
|
+
|