|
@@ -0,0 +1,345 @@
|
|
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
|
+ associationTypeIds:any;
|
|
53
|
+ questionnaireManagementData:any; //调查问卷数据
|
|
54
|
+ questionnaireIds:Number; //问卷参数
|
|
55
|
+ intervalTime:string = ''; //间隔时间参数
|
|
56
|
+ taskTypeIds:any = []; //任务类型参数
|
|
57
|
+ editId:'';
|
|
58
|
+ targetData:any = [];
|
|
59
|
+ stateData:any = [];
|
|
60
|
+ // 间隔时间数据
|
|
61
|
+ timeData:any[] = [
|
|
62
|
+ {label:'10',value: 10},
|
|
63
|
+ {label:'15',value: 15},
|
|
64
|
+ {label:'30',value: 30},
|
|
65
|
+ {label:'60',value: 60}
|
|
66
|
+ ];
|
|
67
|
+ // 配置
|
|
68
|
+ configs:any = {};
|
|
69
|
+ searchTimerSubject = new Subject();
|
|
70
|
+ constructor(private mainService: MainService,private tool: ToolService,private msg: NzMessageService) {}
|
|
71
|
+
|
|
72
|
+ ngOnInit():void {
|
|
73
|
+ // todo
|
|
74
|
+ this.searchTimerSubject.pipe(debounceTime(500)).subscribe((v) => {
|
|
75
|
+ let fun = v[0];
|
|
76
|
+ fun.call(this, v[1], v[2], v[3]);
|
|
77
|
+ });
|
|
78
|
+ // this.getTaskTypes('', true, 1);
|
|
79
|
+ // this.getTaskTypes('', false, 2);
|
|
80
|
+ this.getRelevanceType()
|
|
81
|
+ }
|
|
82
|
+
|
|
83
|
+ // 切换tab
|
|
84
|
+ tabModal(tabModalName:string){
|
|
85
|
+ this.tabModalName = tabModalName;
|
|
86
|
+ }
|
|
87
|
+ // 修改是否自动建单
|
|
88
|
+ changeAutoCreateOrders(e){
|
|
89
|
+ console.log(e);
|
|
90
|
+ if(!e[0].checked){
|
|
91
|
+ // todo
|
|
92
|
+ this.autoTime = null;
|
|
93
|
+ }
|
|
94
|
+ }
|
|
95
|
+
|
|
96
|
+ // 修改是否开通送回病房
|
|
97
|
+ changeAutoSendWard(e){
|
|
98
|
+ console.log(e);
|
|
99
|
+ if(!e[0].checked){
|
|
100
|
+ // todo
|
|
101
|
+ this.tasktype1Id = null;
|
|
102
|
+ }
|
|
103
|
+ }
|
|
104
|
+
|
|
105
|
+ // 修改是否开通送回苏醒室
|
|
106
|
+ changeAutoSendAwakeningRoom(e){
|
|
107
|
+ console.log(e);
|
|
108
|
+ if(!e[0].checked){
|
|
109
|
+ // todo
|
|
110
|
+ this.tasktype2Id = null;
|
|
111
|
+ }
|
|
112
|
+ }
|
|
113
|
+
|
|
114
|
+ // 修改是否开通关联手术清洁建单
|
|
115
|
+ changeAutoRemandClean(e){
|
|
116
|
+ console.log(e);
|
|
117
|
+ if(!e[0].checked){
|
|
118
|
+ // todo
|
|
119
|
+ this.cleanTypeId = null;
|
|
120
|
+ }
|
|
121
|
+ }
|
|
122
|
+
|
|
123
|
+ // 保存
|
|
124
|
+ submitForm() {
|
|
125
|
+ if(!this.questionnaireIds){
|
|
126
|
+ this.msg.create("warning", "请选择调查问卷!");
|
|
127
|
+ return;
|
|
128
|
+ }
|
|
129
|
+ if(this.taskTypeIds.length==0){
|
|
130
|
+ this.msg.create("warning", "请选择任务类型!");
|
|
131
|
+ return;
|
|
132
|
+ }
|
|
133
|
+ if(this.intervalTime==''){
|
|
134
|
+ this.msg.create("warning", "请选择间隔时间!");
|
|
135
|
+ return;
|
|
136
|
+ }
|
|
137
|
+ let taskArr = JSON.parse(JSON.stringify(this.taskTypeIds))
|
|
138
|
+ let editData = {
|
|
139
|
+ // questionnaireConfig:{
|
|
140
|
+ id:'',
|
|
141
|
+ hosId: this.hosId,
|
|
142
|
+ questionnaireIds:this.questionnaireIds,//问卷参数
|
|
143
|
+ intervalTime:this.intervalTime, //间隔时间参数
|
|
144
|
+ taskTypeIds:taskArr.join(',') //任务类型参数
|
|
145
|
+ // }
|
|
146
|
+ };
|
|
147
|
+ if(this.editId){
|
|
148
|
+ editData.id = this.editId
|
|
149
|
+ }else{
|
|
150
|
+ delete editData.id
|
|
151
|
+ }
|
|
152
|
+ this.btnLoading = true;
|
|
153
|
+ this.mainService
|
|
154
|
+ .simplePost("addData", "questionnaireConfig", editData)
|
|
155
|
+ .subscribe((result) => {
|
|
156
|
+ this.btnLoading = false;
|
|
157
|
+ if (result.status == 200) {
|
|
158
|
+ this.getConfig();
|
|
159
|
+ }
|
|
160
|
+ });
|
|
161
|
+ }
|
|
162
|
+
|
|
163
|
+ // 调查问卷搜索
|
|
164
|
+ changequestionnaire(e) {
|
|
165
|
+ this.searchTimer(this.getOneQuestionnaireManagement, e, false)
|
|
166
|
+ }
|
|
167
|
+
|
|
168
|
+ // 用户输入搜索任务类型
|
|
169
|
+ isLoading: boolean = false;
|
|
170
|
+ changeTasktype(e) {
|
|
171
|
+ this.searchTimer(this.getTaskTypes, e, false);
|
|
172
|
+ }
|
|
173
|
+
|
|
174
|
+ changeRecoveryDepts(e) {
|
|
175
|
+ this.searchTimer(this.getRecoveryDepts, e, false);
|
|
176
|
+ }
|
|
177
|
+
|
|
178
|
+ // 边输入边搜索节流阀
|
|
179
|
+ searchTimer(fun, e, isFirst, type?) {
|
|
180
|
+ this.isLoading = true;
|
|
181
|
+ this.searchTimerSubject.next([fun, e, isFirst, type]);
|
|
182
|
+ }
|
|
183
|
+
|
|
184
|
+ // 获取关联任务类型
|
|
185
|
+ getRelevanceType(){
|
|
186
|
+ this.associationTypeIds=[]
|
|
187
|
+ this.mainService.getDictionary("list", "association_types").subscribe((data) => {
|
|
188
|
+ for( let t of data){
|
|
189
|
+ if(t.value=='patientTransport' ||
|
|
190
|
+ t.value=='other' || t.value=='inspect'){
|
|
191
|
+ this.associationTypeIds.push(t)
|
|
192
|
+ }
|
|
193
|
+ }
|
|
194
|
+ this.getTaskTypes('', true, 1)
|
|
195
|
+ this.getState()
|
|
196
|
+ });
|
|
197
|
+ }
|
|
198
|
+
|
|
199
|
+ // 获取问卷状态
|
|
200
|
+ getState(){
|
|
201
|
+ this.mainService.getDictionary("list", "survey_state").subscribe((data) => {
|
|
202
|
+ this.stateData = data
|
|
203
|
+ this.getQuestionnaireTarget()
|
|
204
|
+ });
|
|
205
|
+ }
|
|
206
|
+
|
|
207
|
+ // 获取问卷调查目标
|
|
208
|
+ getQuestionnaireTarget(){
|
|
209
|
+ this.mainService.getDictionary("list", "survey_target").subscribe((data) => {
|
|
210
|
+ this.targetData = data
|
|
211
|
+ this.getOneQuestionnaireManagement()
|
|
212
|
+ });
|
|
213
|
+ }
|
|
214
|
+
|
|
215
|
+ // 获取问卷数据
|
|
216
|
+ getOneQuestionnaireManagement(e:string = '', isFirst:boolean = false,){
|
|
217
|
+ let targetId = this.targetData.find(i=>i.value==4)
|
|
218
|
+ let stateId = this.stateData.find(i=>i.value==2)
|
|
219
|
+ let query = {
|
|
220
|
+ idx: 0,
|
|
221
|
+ questionnaireManagement: {
|
|
222
|
+ title:e,
|
|
223
|
+ hosId: this.hosId,
|
|
224
|
+ surveyTarget:{ //问卷调查目标
|
|
225
|
+ id:targetId.id
|
|
226
|
+ },
|
|
227
|
+ state:{ //问卷状态
|
|
228
|
+ id:stateId.id
|
|
229
|
+ }
|
|
230
|
+ },
|
|
231
|
+ hosId: this.hosId,
|
|
232
|
+ sum: 10
|
|
233
|
+ }
|
|
234
|
+ isFirst && (this.loading = true);
|
|
235
|
+ this.isLoading = true;
|
|
236
|
+ this.mainService.getFetchDataList('api', "questionnaireManagement", query).subscribe(res=>{
|
|
237
|
+ if(res.status == 200){
|
|
238
|
+ this.isLoading = false;
|
|
239
|
+ this.questionnaireManagementData = res.list;
|
|
240
|
+ }
|
|
241
|
+ })
|
|
242
|
+ }
|
|
243
|
+
|
|
244
|
+ //获取接手术关联任务类型
|
|
245
|
+ // 1 患者其他服务
|
|
246
|
+ // 2 其他临床服务
|
|
247
|
+ getTaskTypes(e:string = '', isFirst:boolean = false, type:number = 1) {
|
|
248
|
+ let ids = []
|
|
249
|
+ for(let i of this.associationTypeIds){
|
|
250
|
+ ids.push(i.id)
|
|
251
|
+ }
|
|
252
|
+ isFirst && (this.loading = true);
|
|
253
|
+ let postData:any = {
|
|
254
|
+ idx: 0,
|
|
255
|
+ sum: 9999,
|
|
256
|
+ taskType: {
|
|
257
|
+ taskName: e,
|
|
258
|
+ simpleQuery: true,
|
|
259
|
+ associationTypeIds:ids.join(','),
|
|
260
|
+ hosId: {
|
|
261
|
+ id: this.hosId
|
|
262
|
+ }
|
|
263
|
+ }
|
|
264
|
+ };
|
|
265
|
+ this.isLoading = true;
|
|
266
|
+ this.mainService
|
|
267
|
+ .getFetchDataList("simple/data", "taskType", postData)
|
|
268
|
+ .subscribe((result) => {
|
|
269
|
+ this.isLoading = false;
|
|
270
|
+ if (result.status == 200) {
|
|
271
|
+ this.taskTypes1 = result.list || [];
|
|
272
|
+ isFirst && this.getConfig();
|
|
273
|
+ }
|
|
274
|
+ });
|
|
275
|
+ }
|
|
276
|
+
|
|
277
|
+ //获取所有科室类型
|
|
278
|
+ allDeptTypes:any[] = [];
|
|
279
|
+ getDeptType(isFirst:boolean = false) {
|
|
280
|
+ isFirst && (this.loading = true);
|
|
281
|
+ this.mainService
|
|
282
|
+ .getDictionary("list", "dept_type")
|
|
283
|
+ .subscribe((result) => {
|
|
284
|
+ this.allDeptTypes = result;
|
|
285
|
+ isFirst && this.getRecoveryDepts('', true);
|
|
286
|
+ });
|
|
287
|
+ }
|
|
288
|
+
|
|
289
|
+ //获取所有科室
|
|
290
|
+ getRecoveryDepts(e:string = '', isFirst:boolean = false) {
|
|
291
|
+ isFirst && (this.loading = true);
|
|
292
|
+ let recovery = this.allDeptTypes.find(v => v.value === 'recovery');
|
|
293
|
+ let postData = {
|
|
294
|
+ idx: 0,
|
|
295
|
+ sum: 10,
|
|
296
|
+ department: {
|
|
297
|
+ dept: e,
|
|
298
|
+ hospital: {
|
|
299
|
+ id: this.hosId
|
|
300
|
+ },
|
|
301
|
+ type: recovery || undefined
|
|
302
|
+ }
|
|
303
|
+ };
|
|
304
|
+ this.isLoading = true;
|
|
305
|
+ this.mainService
|
|
306
|
+ .getFetchDataList("data", "department", postData)
|
|
307
|
+ .subscribe((result) => {
|
|
308
|
+ this.isLoading = false;
|
|
309
|
+ if (result.status == 200) {
|
|
310
|
+ this.recoveryDepts = result.list || [];
|
|
311
|
+ isFirst && this.getConfig();
|
|
312
|
+ }
|
|
313
|
+ });
|
|
314
|
+ }
|
|
315
|
+ // 获取配置
|
|
316
|
+ getConfig() {
|
|
317
|
+ this.loading = true;
|
|
318
|
+ let postData = {
|
|
319
|
+ idx: 0,
|
|
320
|
+ sum: 10,
|
|
321
|
+ questionnaireConfig: {
|
|
322
|
+ hosId: this.hosId,
|
|
323
|
+ }
|
|
324
|
+ };
|
|
325
|
+ this.mainService
|
|
326
|
+ .getFetchDataList("simple/data", "questionnaireConfig", postData)
|
|
327
|
+ .subscribe((result) => {
|
|
328
|
+ this.loading = false;
|
|
329
|
+ if (result.status == 200) {
|
|
330
|
+ let data = result.list[0] || {};
|
|
331
|
+ this.editId = data.id
|
|
332
|
+ let questionData = data.questionnaireDTOS.map(i=>{
|
|
333
|
+ return i.id
|
|
334
|
+ })
|
|
335
|
+ this.questionnaireIds = Number(questionData.join(',')) //调查问卷
|
|
336
|
+ this.intervalTime = data.intervalTime //间隔时间
|
|
337
|
+ this.taskTypeIds = data.taskTypeDTOS.map(i=>{ //任务类型
|
|
338
|
+ return i.id
|
|
339
|
+ })
|
|
340
|
+ }
|
|
341
|
+ });
|
|
342
|
+ }
|
|
343
|
+}
|
|
344
|
+
|
|
345
|
+
|