|
@@ -1,11 +1,6 @@
|
1
|
1
|
import { Component, OnInit, ViewChild } from "@angular/core";
|
2
|
|
-import { ActivatedRoute, Router } from "@angular/router";
|
3
|
|
-import {
|
4
|
|
- FormBuilder,
|
5
|
|
- Validators,
|
6
|
|
- FormGroup,
|
7
|
|
- FormControl,
|
8
|
|
-} from "@angular/forms";
|
|
2
|
+import { ActivatedRoute } from "@angular/router";
|
|
3
|
+import { FormBuilder, Validators, FormGroup } from "@angular/forms";
|
9
|
4
|
|
10
|
5
|
import { MainService } from "../../services/main.service";
|
11
|
6
|
import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx";
|
|
@@ -13,7 +8,6 @@ import { ToolService } from "../../services/tool.service";
|
13
|
8
|
import { Subject } from "rxjs";
|
14
|
9
|
import { debounceTime } from "rxjs/operators";
|
15
|
10
|
import { NzMessageService } from "ng-zorro-antd";
|
16
|
|
-import { format } from "date-fns";
|
17
|
11
|
@Component({
|
18
|
12
|
selector: "app-keep-order-config",
|
19
|
13
|
templateUrl: "./keep-order-config.component.html",
|
|
@@ -30,214 +24,82 @@ export class KeepOrderConfigComponent implements OnInit {
|
30
|
24
|
private fb: FormBuilder,
|
31
|
25
|
private mainService: MainService,
|
32
|
26
|
private route: ActivatedRoute,
|
33
|
|
- private router: Router,
|
34
|
27
|
private tool: ToolService
|
35
|
28
|
) {}
|
36
|
29
|
|
37
|
30
|
userInfo: any = JSON.parse(localStorage.getItem("user")) || {}; //登录用户信息
|
38
|
31
|
|
39
|
|
- searchCriteria = {
|
40
|
|
- //搜索条件
|
41
|
|
- name: "",
|
42
|
|
- hospital: null,
|
43
|
|
- endDepartment: null,
|
44
|
|
- };
|
45
|
|
- roundRobinTypes = []; //轮巡类型
|
46
|
|
- timeSteps = [
|
47
|
|
- // { id: "381", name: "每天轮巡" },
|
48
|
|
- { key: "day", name: "每天" },
|
49
|
|
- { key: "week", name: "每周" },
|
50
|
|
- { key: "month", name: "每月" },
|
51
|
|
- { key: "year", name: "每年" },
|
52
|
|
- ]; //轮巡类型
|
53
|
|
- createUser = "";
|
54
|
|
- dayType = ["全部", "节假日", "工作日"]; //执行策略里的复选框数据字典
|
55
|
|
- department = []; // 院区下的科室列表
|
56
|
|
- departmentSearch = []; // 院区下的科室列表(搜索框)
|
57
|
|
- allHospital: any = []; //院区下拉框
|
|
32
|
+ searchCriteria = {};
|
|
33
|
+ taskTypeList = []; //轮巡类型
|
|
34
|
+ orderRangeList:any[] = [
|
|
35
|
+ { id: 4, name: '待到达' },
|
|
36
|
+ { id: 5, name: '待送达' },
|
|
37
|
+ ];
|
|
38
|
+ hosId; //当前院区id
|
58
|
39
|
listOfData: any[] = []; //表格数据
|
59
|
40
|
pageIndex: number = 1; //表格当前页码
|
60
|
41
|
pageSize: number = 10; //表格每页展示条数
|
61
|
42
|
listLength: number = 10; //表格总数据量
|
62
|
|
- tableHeight: number; //表格动态高
|
63
|
43
|
modal: boolean = false; //新增/编辑模态框
|
64
|
44
|
add: boolean; //true:新增;false:编辑
|
65
|
45
|
validateForm: FormGroup; //新增/编辑表单
|
66
|
46
|
coopId: number; //当前操作列id
|
67
|
47
|
|
68
|
|
- hospitalList: Array<object> = []; //院区列表
|
69
|
|
- hosId: any; //当前院区id
|
70
|
|
- oneOption: any; //适用日期类型
|
71
|
48
|
btnLoading: boolean = false; //提交按钮loading状态
|
72
|
49
|
|
73
|
50
|
promptContent: string; //操作提示框提示信息
|
74
|
51
|
ifSuccess: boolean; //操作成功/失败
|
75
|
52
|
promptInfo: string; //操作结果提示信息
|
76
|
53
|
promptModalShow: boolean; //操作提示框是否展示
|
77
|
|
- demoValue: number = 0;
|
78
|
|
- changeInpSubject = new Subject();
|
79
|
54
|
changeInpTasktypeSubject = new Subject();
|
80
|
55
|
ngOnInit() {
|
81
|
|
- this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
|
82
|
|
- this.searchDepartment(v[0], v[1]);
|
|
56
|
+ this.hosId = this.tool.getCurrentHospital().id;
|
|
57
|
+ this.changeInpTasktypeSubject.pipe(debounceTime(500)).subscribe((v: any) => {
|
|
58
|
+ this.getTasktypeByValues(v);
|
83
|
59
|
});
|
84
|
|
- this.changeInpTasktypeSubject
|
85
|
|
- .pipe(debounceTime(500))
|
86
|
|
- .subscribe((v: any) => {
|
87
|
|
- this.getTasktypeByIds(v);
|
88
|
|
- });
|
89
|
60
|
this.coopBtns = this.tool.initCoopBtns(this.route);
|
90
|
|
- this.getAllHospital();
|
91
|
|
- this.initForm();
|
92
|
|
- this.getHospitalList();
|
|
61
|
+ this.getList(1);
|
|
62
|
+ this.getKeepOrderDeptTypeList();
|
|
63
|
+ this.getKeepOrderGetorderTypeList();
|
93
|
64
|
}
|
94
|
65
|
// 重置
|
95
|
66
|
reset() {
|
96
|
|
- this.searchCriteria = {
|
97
|
|
- //搜索条件
|
98
|
|
- name: "",
|
99
|
|
- hospital: this.allHospital[0] ? this.allHospital[0]["id"] + "" : null,
|
100
|
|
- endDepartment: null,
|
101
|
|
- };
|
|
67
|
+ this.searchCriteria = {};
|
102
|
68
|
this.getList(1);
|
103
|
69
|
}
|
104
|
|
- // 选择院区
|
105
|
|
- changeHospital(id, type) {
|
106
|
|
- if (type === "search") {
|
107
|
|
- this.searchCriteria.endDepartment = null;
|
108
|
|
- } else {
|
109
|
|
- if (
|
110
|
|
- this.validateForm &&
|
111
|
|
- this.validateForm.value &&
|
112
|
|
- this.validateForm.value.endDepartment
|
113
|
|
- ) {
|
114
|
|
- this.validateForm.controls.endDepartment.setValue(null);
|
115
|
|
- }
|
116
|
|
- }
|
117
|
|
- let data = {
|
118
|
|
- department: {
|
119
|
|
- hospital: { id },
|
120
|
|
- type: { id: 383 },
|
121
|
|
- },
|
122
|
|
- idx: 0,
|
123
|
|
- sum: 20,
|
124
|
|
- };
|
125
|
|
- this.mainService
|
126
|
|
- .getFetchDataList("data", "department", data)
|
127
|
|
- .subscribe((data) => {
|
128
|
|
- if (data.status == 200) {
|
129
|
|
- if (type === "search") {
|
130
|
|
- this.departmentSearch = data.list;
|
131
|
|
- } else {
|
132
|
|
- this.department = data.list;
|
133
|
|
- }
|
134
|
|
- }
|
135
|
|
- });
|
136
|
|
- }
|
137
|
|
- // 打开搜索框
|
138
|
|
- changeSearch(flag) {
|
139
|
|
- if (flag) {
|
140
|
|
- this.changeInp("no", "search");
|
141
|
|
- }
|
142
|
|
- }
|
143
|
|
- changeForm(flag) {
|
144
|
|
- if (flag) {
|
145
|
|
- this.changeInp("no", "form");
|
146
|
|
- }
|
147
|
|
- }
|
|
70
|
+
|
148
|
71
|
changeFormTasktype(flag) {
|
149
|
72
|
if (flag) {
|
150
|
73
|
this.changeInpTasktype();
|
151
|
74
|
}
|
152
|
75
|
}
|
153
|
|
- changeFormEnd(flag) {
|
154
|
|
- if (flag) {
|
155
|
|
- this.changeInp("no", "formEnd");
|
156
|
|
- }
|
157
|
|
- }
|
158
|
|
- // 选择轮巡类型
|
159
|
|
- selectedTasktype = null; //当前选中的轮巡类型
|
160
|
|
- selectedTasktypeHandler(e) {
|
161
|
|
- this.selectedTasktype = this.roundRobinTypes.find((item) => item.id == e);
|
162
|
|
- this.requiredChange(
|
163
|
|
- this.selectedTasktype.associationType.value == "specimenPlan",
|
164
|
|
- "endDepartment"
|
165
|
|
- );
|
166
|
|
- console.log(this.selectedTasktype);
|
167
|
|
- }
|
168
|
76
|
// 任务类型防抖搜索
|
169
|
77
|
changeInpTasktype(taskName = "") {
|
170
|
78
|
this.isLoading = true;
|
171
|
79
|
this.changeInpTasktypeSubject.next(taskName);
|
172
|
80
|
}
|
173
|
|
- // 边输边搜节流阀
|
174
|
81
|
isLoading = false;
|
175
|
|
- changeInp(dept, type) {
|
176
|
|
- if (dept === "no") {
|
177
|
|
- dept = "";
|
178
|
|
- }
|
179
|
|
- if (type === "form") {
|
180
|
|
- if (!this.hosId) {
|
181
|
|
- this.department = [];
|
182
|
|
- return;
|
183
|
|
- }
|
184
|
|
- }
|
185
|
|
- this.isLoading = true;
|
186
|
|
- this.changeInpSubject.next([dept, type]);
|
187
|
|
- }
|
188
|
|
- // 搜索科室
|
189
|
|
- depting = "";
|
190
|
|
- searchDepartment(dept, type) {
|
191
|
|
- this.depting = dept;
|
192
|
|
- let postData={
|
193
|
|
- department: {
|
194
|
|
- dept,
|
195
|
|
- hospital: { id: this.hosId },
|
196
|
|
- cascadeHosId: this.hosId,
|
197
|
|
- type: { id: null },
|
198
|
|
- },
|
199
|
|
- idx: 0,
|
200
|
|
- sum: 5,
|
201
|
|
- }
|
202
|
|
- if(this.selectedTasktype.associationType.value == "specimen"){
|
203
|
|
- postData.department.type.id = 282
|
204
|
|
- delete postData.department.hospital
|
205
|
|
- }else{
|
206
|
|
- postData.department.type.id = 383
|
207
|
|
- delete postData.department.cascadeHosId
|
208
|
|
- }
|
209
|
|
- this.mainService
|
210
|
|
- .getFetchDataList("data", "department", postData)
|
211
|
|
- .subscribe((result) => {
|
212
|
|
- if (result.status == 200) {
|
213
|
|
- if (type === "search" && this.depting === postData.department.dept) {
|
214
|
|
- this.isLoading = false;
|
215
|
|
- this.departmentSearch = result.list;
|
216
|
|
- } else if (
|
217
|
|
- type === "form" &&
|
218
|
|
- this.depting === postData.department.dept
|
219
|
|
- ) {
|
220
|
|
- this.isLoading = false;
|
221
|
|
- this.department = result.list;
|
222
|
|
- }
|
223
|
|
- }
|
224
|
|
- });
|
225
|
|
- }
|
226
|
82
|
|
227
|
83
|
// 初始化增删改按钮
|
228
|
84
|
coopBtns: any = {};
|
229
|
85
|
|
230
|
|
- // 获取所有院区
|
231
|
|
- /**
|
232
|
|
- *
|
233
|
|
- *
|
234
|
|
- * @memberof RoundRobinComponent
|
235
|
|
- */
|
236
|
|
- getAllHospital() {
|
237
|
|
- this.allHospital = [this.tool.getCurrentHospital()];
|
238
|
|
- this.searchCriteria.hospital = this.tool.getCurrentHospital().id + "";
|
239
|
|
- this.getList(1);
|
240
|
|
- this.changeHospital(this.searchCriteria.hospital, "search");
|
|
86
|
+ //获取起点科室|终点科室字典
|
|
87
|
+ keepOrderDeptTypeList:any[] = [];
|
|
88
|
+ getKeepOrderDeptTypeList() {
|
|
89
|
+ this.isLoading = true;
|
|
90
|
+ this.mainService.getDictionary('list', 'keep_order_dept_type').subscribe((data) => {
|
|
91
|
+ this.isLoading = false;
|
|
92
|
+ this.keepOrderDeptTypeList = data || [];
|
|
93
|
+ });
|
|
94
|
+ }
|
|
95
|
+ //获取抢接单字典
|
|
96
|
+ keepOrderGetorderTypeList:any[] = [];
|
|
97
|
+ getKeepOrderGetorderTypeList() {
|
|
98
|
+ this.isLoading = true;
|
|
99
|
+ this.mainService.getDictionary('list', 'keep_order_getorder_type').subscribe((data) => {
|
|
100
|
+ this.isLoading = false;
|
|
101
|
+ this.keepOrderGetorderTypeList = data || [];
|
|
102
|
+ });
|
241
|
103
|
}
|
242
|
104
|
|
243
|
105
|
// 表格数据
|
|
@@ -250,62 +112,40 @@ export class KeepOrderConfigComponent implements OnInit {
|
250
|
112
|
idx: this.pageIndex - 1,
|
251
|
113
|
sum: this.pageSize,
|
252
|
114
|
orderPlan: {
|
253
|
|
- hospital: this.searchCriteria.hospital,
|
254
|
|
- targetDept:
|
255
|
|
- this.searchCriteria.endDepartment === null
|
256
|
|
- ? ""
|
257
|
|
- : this.searchCriteria.endDepartment,
|
258
|
|
- title:
|
259
|
|
- this.searchCriteria.name === null ? "" : this.searchCriteria.name,
|
|
115
|
+ hosId: this.hosId,
|
260
|
116
|
},
|
261
|
117
|
};
|
262
|
118
|
this.loading1 = true;
|
263
|
119
|
this.mainService
|
264
|
|
- .getFetchDataList("configuration", "orderPlan", data)
|
|
120
|
+ .getFetchDataList("simple/data", "keepOrderConfig", data)
|
265
|
121
|
.subscribe((data) => {
|
266
|
122
|
this.loading1 = false;
|
267
|
123
|
if (data.status == 200) {
|
268
|
124
|
this.listOfData = data.list;
|
269
|
125
|
this.listLength = data.totalNum;
|
270
|
|
- this.listOfData.forEach((item) => {
|
271
|
|
- if (item.timeStep == "week") {
|
272
|
|
- let weeks = [
|
273
|
|
- "周一",
|
274
|
|
- "周二",
|
275
|
|
- "周三",
|
276
|
|
- "周四",
|
277
|
|
- "周五",
|
278
|
|
- "周六",
|
279
|
|
- "周日",
|
280
|
|
- ];
|
281
|
|
- item.weekName = weeks[item.extra1 - 1];
|
282
|
|
- }
|
283
|
|
- });
|
284
|
126
|
}
|
285
|
127
|
});
|
286
|
128
|
}
|
287
|
|
- //获取任务类型-标本检查和其他临床服务
|
|
129
|
+ //获取任务类型
|
288
|
130
|
taskNameing = "";
|
289
|
|
- getTasktypeByIds(taskName = "") {
|
|
131
|
+ getTasktypeByValues(taskName = "") {
|
290
|
132
|
this.taskNameing = taskName;
|
291
|
133
|
let postData = {
|
292
|
134
|
idx: 0,
|
293
|
|
- sum: 5,
|
|
135
|
+ sum: 10,
|
294
|
136
|
taskType: {
|
295
|
|
- hosIds: this.hosId + "",
|
296
|
|
- associationTypeIds: "380,259,256",
|
|
137
|
+ hosIds: this.hosId,
|
|
138
|
+ assTypeValues: "other,ordinary",
|
297
|
139
|
taskName,
|
|
140
|
+ simpleQuery: true,
|
298
|
141
|
},
|
299
|
142
|
};
|
300
|
143
|
this.mainService
|
301
|
144
|
.getFetchDataList("configuration", "taskType", postData)
|
302
|
145
|
.subscribe((result) => {
|
303
|
|
- if (
|
304
|
|
- result.status == 200 &&
|
305
|
|
- this.taskNameing === postData.taskType.taskName
|
306
|
|
- ) {
|
|
146
|
+ if (result.status == 200 && this.taskNameing === postData.taskType.taskName) {
|
307
|
147
|
this.isLoading = false;
|
308
|
|
- this.roundRobinTypes = result.list;
|
|
148
|
+ this.taskTypeList = result.list;
|
309
|
149
|
}
|
310
|
150
|
});
|
311
|
151
|
}
|
|
@@ -313,13 +153,11 @@ export class KeepOrderConfigComponent implements OnInit {
|
313
|
153
|
addModal() {
|
314
|
154
|
this.add = true; //新增
|
315
|
155
|
this.modal = true;
|
316
|
|
- this.selectedTasktype = null;
|
317
|
156
|
this.initForm();
|
318
|
157
|
}
|
319
|
158
|
//关闭新增/编辑弹框
|
320
|
159
|
hideAddModal() {
|
321
|
160
|
this.modal = false;
|
322
|
|
- this.initForm();
|
323
|
161
|
}
|
324
|
162
|
// 是否是必选
|
325
|
163
|
requiredChange(required: boolean, formControlName: string): void {
|
|
@@ -327,83 +165,34 @@ export class KeepOrderConfigComponent implements OnInit {
|
327
|
165
|
this.validateForm.get(formControlName)!.clearValidators();
|
328
|
166
|
this.validateForm.get(formControlName)!.markAsPristine();
|
329
|
167
|
} else {
|
330
|
|
- this.validateForm
|
331
|
|
- .get(formControlName)!
|
332
|
|
- .setValidators(Validators.required);
|
|
168
|
+ this.validateForm.get(formControlName)!.setValidators(Validators.required);
|
333
|
169
|
this.validateForm.get(formControlName)!.markAsDirty();
|
334
|
170
|
}
|
335
|
171
|
this.validateForm.get(formControlName)!.updateValueAndValidity();
|
336
|
172
|
}
|
337
|
173
|
// 初始化新增form表单
|
338
|
174
|
initForm() {
|
339
|
|
- this.createUser = this.userInfo.user.name ? this.userInfo.user.name : "";
|
340
|
|
- this.oneOption = [
|
341
|
|
- { label: "工作日", value: "工作日", checked: false },
|
342
|
|
- { label: "节假日", value: "节假日", checked: false },
|
343
|
|
- ];
|
344
|
175
|
this.validateForm = this.fb.group({
|
345
|
|
- roundRobinName: [null, [Validators.required]],
|
346
|
|
- roundRobinType: [null, [Validators.required]],
|
347
|
|
- timeStep: [null, [Validators.required]],
|
348
|
|
- datesType: [null, [this.dateValidator]],
|
349
|
|
- executeTime: [null, [Validators.required]],
|
350
|
|
- // executionTime: [null, [Validators.required]],
|
351
|
|
- // time: [null],
|
352
|
|
- endDepartment: [null, [Validators.required]],
|
353
|
|
- openDepartments: [false],
|
|
176
|
+ startTaskTypeId: [null, [Validators.required]],
|
|
177
|
+ createTaskTypeId: [null, [Validators.required]],
|
|
178
|
+ startDept: [null, [Validators.required]],
|
|
179
|
+ endDept: [null, [Validators.required]],
|
|
180
|
+ getOrderType: [null, [Validators.required]],
|
|
181
|
+ getOrderRange: [null, [Validators.required]],
|
|
182
|
+ copyRemark: [0, [Validators.required]],
|
|
183
|
+ active: [0, [Validators.required]],
|
354
|
184
|
});
|
355
|
|
- this.validateForm.controls.timeStep.setValue(this.timeSteps[0].key);
|
356
|
|
- this.timeSelectedValue = [];
|
357
|
|
- }
|
358
|
|
- // 修改轮巡策略
|
359
|
|
- months = [...Array(32).keys()].slice(1);
|
360
|
|
- timeStepChange(e) {
|
361
|
|
- switch (e) {
|
362
|
|
- case "day":
|
363
|
|
- this.validateForm.removeControl("doWeek");
|
364
|
|
- this.validateForm.removeControl("doMonth");
|
365
|
|
- this.validateForm.removeControl("doYear");
|
366
|
|
- break;
|
367
|
|
- case "week":
|
368
|
|
- this.validateForm.addControl(
|
369
|
|
- "doWeek",
|
370
|
|
- new FormControl(null, Validators.required)
|
371
|
|
- );
|
372
|
|
- this.validateForm.removeControl("doMonth");
|
373
|
|
- this.validateForm.removeControl("doYear");
|
374
|
|
- break;
|
375
|
|
- case "month":
|
376
|
|
- this.validateForm.addControl(
|
377
|
|
- "doMonth",
|
378
|
|
- new FormControl(null, Validators.required)
|
379
|
|
- );
|
380
|
|
- this.validateForm.removeControl("doWeek");
|
381
|
|
- this.validateForm.removeControl("doYear");
|
382
|
|
- break;
|
383
|
|
- case "year":
|
384
|
|
- this.validateForm.addControl(
|
385
|
|
- "doYear",
|
386
|
|
- new FormControl(null, Validators.required)
|
387
|
|
- );
|
388
|
|
- this.validateForm.removeControl("doWeek");
|
389
|
|
- this.validateForm.removeControl("doMonth");
|
390
|
|
- break;
|
391
|
|
- }
|
392
|
185
|
}
|
393
|
186
|
|
394
|
|
- //创建自定义校验规则dateValidator,用于复选框组校验时调用。
|
395
|
|
- selectedDate: any = [];
|
396
|
|
- dateValidator = (control: FormControl): { [s: string]: boolean } => {
|
397
|
|
- this.selectedDate = [];
|
398
|
|
- for (const i in control.value) {
|
399
|
|
- if (control.value[i].checked) {
|
400
|
|
- this.selectedDate.push(control.value[i]);
|
401
|
|
- }
|
402
|
|
- }
|
403
|
|
- if (this.selectedDate.length == 0) {
|
404
|
|
- return { required: true };
|
|
187
|
+ // 选择抢接单
|
|
188
|
+ changeGetOrderType(e){
|
|
189
|
+ this.validateForm.controls.getOrderRange.setValue(null);
|
|
190
|
+ if(e === '1'){
|
|
191
|
+ this.requiredChange(true, 'getOrderRange');
|
|
192
|
+ }else{
|
|
193
|
+ this.requiredChange(false, 'getOrderRange');
|
405
|
194
|
}
|
406
|
|
- };
|
|
195
|
+ }
|
407
|
196
|
|
408
|
197
|
// 新增/编辑表单提交
|
409
|
198
|
submitForm(): void {
|
|
@@ -412,23 +201,6 @@ export class KeepOrderConfigComponent implements OnInit {
|
412
|
201
|
this.validateForm.controls[i].markAsDirty();
|
413
|
202
|
this.validateForm.controls[i].updateValueAndValidity();
|
414
|
203
|
}
|
415
|
|
- if (this.selectedDate) {
|
416
|
|
- var arr = [];
|
417
|
|
- this.validateForm.value.datesType.forEach((e) => {
|
418
|
|
- if (e.checked) {
|
419
|
|
- arr.push(e.label);
|
420
|
|
- }
|
421
|
|
- });
|
422
|
|
- if (arr.length == 2) {
|
423
|
|
- this.validateForm.value.datesType = 0;
|
424
|
|
- } else {
|
425
|
|
- if (arr[0] == "工作日") {
|
426
|
|
- this.validateForm.value.datesType = 2;
|
427
|
|
- } else {
|
428
|
|
- this.validateForm.value.datesType = 1;
|
429
|
|
- }
|
430
|
|
- }
|
431
|
|
- }
|
432
|
204
|
if (this.validateForm.invalid) {
|
433
|
205
|
this.btnLoading = false;
|
434
|
206
|
return;
|
|
@@ -438,81 +210,36 @@ export class KeepOrderConfigComponent implements OnInit {
|
438
|
210
|
if (this.add) {
|
439
|
211
|
//增加
|
440
|
212
|
postData = {
|
441
|
|
- orderPlan: {
|
442
|
|
- title: this.validateForm.value.roundRobinName,
|
443
|
|
- hospital: this.hosId,
|
444
|
|
- taskType: { id: this.validateForm.value.roundRobinType },
|
445
|
|
- timeStep: this.validateForm.value.timeStep,
|
446
|
|
- dayType: this.validateForm.value.datesType,
|
447
|
|
- executeTime: new Date(this.validateForm.value.executeTime).getTime(),
|
448
|
|
- },
|
|
213
|
+ hosId: this.hosId,
|
|
214
|
+ startTaskTypeId: this.validateForm.value.startTaskTypeId || undefined,
|
|
215
|
+ createTaskTypeId: this.validateForm.value.createTaskTypeId || undefined,
|
|
216
|
+ startDept: { id: this.validateForm.value.startDept },
|
|
217
|
+ endDept: { id: this.validateForm.value.endDept },
|
|
218
|
+ getOrderType: this.validateForm.value.getOrderType ? this.keepOrderGetorderTypeList.find(v => v.value === this.validateForm.value.getOrderType) : undefined,
|
|
219
|
+ getOrderRange: this.validateForm.value.getOrderRange,
|
|
220
|
+ copyRemark: this.validateForm.value.copyRemark,
|
|
221
|
+ active: this.validateForm.value.active,
|
449
|
222
|
};
|
450
|
|
- if (this.selectedTasktype.associationType.value == "specimenPlan"||
|
451
|
|
- this.selectedTasktype.associationType.value == "specimen") {
|
452
|
|
- //标本轮巡
|
453
|
|
- postData.orderPlan.targetDept =
|
454
|
|
- this.validateForm.value.endDepartment.join();
|
455
|
|
- } else if (this.selectedTasktype.associationType.value == "other") {
|
456
|
|
- //其他配送
|
457
|
|
- postData.orderPlan.taskTypeDeptOrder =
|
458
|
|
- this.validateForm.value.openDepartments;
|
459
|
|
- }
|
460
|
|
- if (this.validateForm.value.timeStep == "day") {
|
461
|
|
- delete postData.orderPlan.extra1;
|
462
|
|
- } else if (this.validateForm.value.timeStep == "week") {
|
463
|
|
- postData.orderPlan.extra1 = this.validateForm.value.doWeek;
|
464
|
|
- } else if (this.validateForm.value.timeStep == "month") {
|
465
|
|
- postData.orderPlan.extra1 = this.validateForm.value.doMonth;
|
466
|
|
- } else if (this.validateForm.value.timeStep == "year") {
|
467
|
|
- delete postData.orderPlan.extra1;
|
468
|
|
- postData.orderPlan.executeTime = new Date(
|
469
|
|
- format(new Date(this.validateForm.value.doYear), "yyyy-MM-dd") +
|
470
|
|
- " " +
|
471
|
|
- format(new Date(this.validateForm.value.executeTime), "HH:mm:ss")
|
472
|
|
- ).getTime();
|
473
|
|
- }
|
474
|
223
|
} else {
|
475
|
224
|
//编辑
|
476
|
225
|
postData = {
|
477
|
|
- id: this.coopId,
|
478
|
|
- title: this.validateForm.value.roundRobinName,
|
479
|
|
- hospital: this.hosId,
|
480
|
|
- taskType: { id: this.validateForm.value.roundRobinType },
|
481
|
|
- timeStep: this.validateForm.value.timeStep,
|
482
|
|
- dayType: this.validateForm.value.datesType,
|
483
|
|
- executeTime: new Date(this.validateForm.value.executeTime).getTime(),
|
|
226
|
+ ...this.coopData,
|
|
227
|
+ startTaskTypeId: this.validateForm.value.startTaskTypeId || undefined,
|
|
228
|
+ createTaskTypeId: this.validateForm.value.createTaskTypeId || undefined,
|
|
229
|
+ startDept: { id: this.validateForm.value.startDept },
|
|
230
|
+ endDept: { id: this.validateForm.value.endDept },
|
|
231
|
+ getOrderType: this.validateForm.value.getOrderType ? this.keepOrderGetorderTypeList.find(v => v.value === this.validateForm.value.getOrderType) : undefined,
|
|
232
|
+ getOrderRange: this.validateForm.value.getOrderRange,
|
|
233
|
+ copyRemark: this.validateForm.value.copyRemark,
|
|
234
|
+ active: this.validateForm.value.active,
|
484
|
235
|
};
|
485
|
|
- if (this.selectedTasktype.associationType.value == "specimenPlan"||
|
486
|
|
- this.selectedTasktype.associationType.value == "specimen") {
|
487
|
|
- //标本轮巡
|
488
|
|
- postData.targetDept = this.validateForm.value.endDepartment.join();
|
489
|
|
- } else if (this.selectedTasktype.associationType.value == "other") {
|
490
|
|
- //其他配送
|
491
|
|
- postData.taskTypeDeptOrder = this.validateForm.value.openDepartments;
|
492
|
|
- }
|
493
|
|
- if (this.validateForm.value.timeStep == "day") {
|
494
|
|
- delete postData.extra1;
|
495
|
|
- } else if (this.validateForm.value.timeStep == "week") {
|
496
|
|
- postData.extra1 = this.validateForm.value.doWeek;
|
497
|
|
- } else if (this.validateForm.value.timeStep == "month") {
|
498
|
|
- postData.extra1 = this.validateForm.value.doMonth;
|
499
|
|
- } else if (this.validateForm.value.timeStep == "year") {
|
500
|
|
- delete postData.extra1;
|
501
|
|
- postData.executeTime = new Date(
|
502
|
|
- format(new Date(this.validateForm.value.doYear), "yyyy-MM-dd") +
|
503
|
|
- " " +
|
504
|
|
- format(new Date(this.validateForm.value.executeTime), "HH:mm:ss")
|
505
|
|
- ).getTime();
|
506
|
|
- }
|
507
|
236
|
}
|
508
|
237
|
console.log(postData);
|
509
|
|
- // return; //baba
|
510
|
238
|
this.mainService
|
511
|
|
- .addRoundRobin(this.add ? "addPlan" : "updatePlan", postData)
|
|
239
|
+ .simplePost("addData", "keepOrderConfig", postData)
|
512
|
240
|
.subscribe((data) => {
|
513
|
241
|
this.btnLoading = false;
|
514
|
242
|
this.hideAddModal();
|
515
|
|
- this.initForm();
|
516
|
243
|
if (data.status == 200) {
|
517
|
244
|
this.listLength++;
|
518
|
245
|
this.showPromptModal(this.add ? "新增" : "修改", true, "");
|
|
@@ -525,172 +252,26 @@ export class KeepOrderConfigComponent implements OnInit {
|
525
|
252
|
// 编辑
|
526
|
253
|
executionTimeTemporaryStorage; //暂存执行时间
|
527
|
254
|
maskFlag: any = false;
|
528
|
|
- maskFlagLoading1 = false;
|
529
|
|
- maskFlagLoading2 = false;
|
|
255
|
+ coopData: any = {};
|
530
|
256
|
edit(data) {
|
531
|
|
- this.requiredChange(
|
532
|
|
- data.taskType.associationType.value == "specimenPlan",
|
533
|
|
- "endDepartment"
|
534
|
|
- );
|
535
|
|
- this.maskFlag = this.message.loading("正在加载中..", {
|
536
|
|
- nzDuration: 0,
|
537
|
|
- }).messageId;
|
538
|
|
- this.maskFlagLoading1 = true;
|
539
|
|
- this.maskFlagLoading2 = true;
|
|
257
|
+ this.modal = true;
|
540
|
258
|
this.add = false;
|
541
|
259
|
this.coopId = data.id;
|
542
|
|
- this.createUser = data.createUser ? data.createUser.name : ""; //创建人
|
543
|
|
- this.validateForm.controls.roundRobinName.setValue(data.title); //名称
|
544
|
|
- // 轮巡类型 start
|
545
|
|
- {
|
546
|
|
- this.selectedTasktype = data.taskType;
|
547
|
|
- let postData = {
|
548
|
|
- idx: 0,
|
549
|
|
- sum: 5,
|
550
|
|
- taskType: {
|
551
|
|
- hosIds: this.hosId + "",
|
552
|
|
- associationTypeIds: "380,259,256",
|
553
|
|
- taskName: "",
|
554
|
|
- },
|
555
|
|
- };
|
556
|
|
- this.mainService
|
557
|
|
- .getFetchDataList("configuration", "taskType", postData)
|
558
|
|
- .subscribe((result) => {
|
559
|
|
- this.maskFlagLoading1 = false;
|
560
|
|
- if (!this.maskFlagLoading1 && !this.maskFlagLoading2) {
|
561
|
|
- this.message.remove(this.maskFlag);
|
562
|
|
- this.maskFlag = false;
|
563
|
|
- this.modal = true;
|
564
|
|
- }
|
565
|
|
- if (result.status == 200) {
|
566
|
|
- this.roundRobinTypes = result.list;
|
567
|
|
- let flag = this.roundRobinTypes.some(
|
568
|
|
- (item) => item.id == data.taskType.id
|
569
|
|
- );
|
570
|
|
- if (!flag) {
|
571
|
|
- this.roundRobinTypes.unshift(data.taskType);
|
572
|
|
- }
|
573
|
|
- this.validateForm.controls.roundRobinType.setValue(
|
574
|
|
- data.taskType.id
|
575
|
|
- ); //轮巡类型
|
576
|
|
- }
|
577
|
|
- });
|
578
|
|
- }
|
579
|
|
- // 轮巡类型end
|
580
|
|
- this.validateForm.controls.timeStep.setValue(data.timeStep); //轮巡策略
|
581
|
|
- this.validateForm.controls.executeTime.setValue(new Date(data.executeTime)); //轮巡策略
|
582
|
|
- this.defaultSelectTimesOption = data.executeTime;
|
583
|
|
- //轮巡策略(时间) start
|
584
|
|
- this.timeStepChange(data.timeStep);
|
585
|
|
- if (data.timeStep == "year") {
|
586
|
|
- this.validateForm.controls.doYear.setValue(
|
587
|
|
- format(data.executeTime, "yyyy-MM-dd HH:mm:ss")
|
588
|
|
- );
|
589
|
|
- } else if (data.timeStep == "month") {
|
590
|
|
- this.validateForm.controls.doMonth.setValue(data.extra1);
|
591
|
|
- } else if (data.timeStep == "week") {
|
592
|
|
- this.validateForm.controls.doWeek.setValue(data.extra1);
|
593
|
|
- }
|
594
|
|
- //轮巡策略(时间)end
|
595
|
|
- // --------终点科室---
|
596
|
|
- if (data.taskType.associationType.value == "specimenPlan" ||
|
597
|
|
- this.selectedTasktype.associationType.value == "specimen") {
|
598
|
|
- //标本轮巡,则回显
|
599
|
|
- let targetDeptArr = [];
|
600
|
|
- let targetDept = data.targetDept.split(",");
|
601
|
|
- let targetDeptShow = data.targetDeptShow.split(",");
|
602
|
|
- targetDept.forEach((item, index) => {
|
603
|
|
- targetDeptArr.push({ id: item, dept: targetDeptShow[index] });
|
604
|
|
- });
|
605
|
|
- let query={
|
606
|
|
- department: {
|
607
|
|
- hospital: { id: data.hospital },
|
608
|
|
- cascadeHosId:data.hospital,
|
609
|
|
- type: { id: null },
|
610
|
|
- },
|
611
|
|
- idx: 0,
|
612
|
|
- sum: 20,
|
613
|
|
- }
|
614
|
|
- if(this.selectedTasktype.associationType.value == "specimen"){
|
615
|
|
- query.department.type.id = 282
|
616
|
|
- delete query.department.hospital
|
617
|
|
- }else{
|
618
|
|
- query.department.type.id = 383
|
619
|
|
- delete query.department.cascadeHosId
|
620
|
|
- }
|
621
|
|
- this.mainService
|
622
|
|
- .getFetchDataList("data", "department", query)
|
623
|
|
- .subscribe((data) => {
|
624
|
|
- this.maskFlagLoading2 = false;
|
625
|
|
- if (!this.maskFlagLoading1 && !this.maskFlagLoading2) {
|
626
|
|
- this.message.remove(this.maskFlag);
|
627
|
|
- this.maskFlag = false;
|
628
|
|
- this.modal = true;
|
629
|
|
- }
|
630
|
|
- if (data.status == 200) {
|
631
|
|
- let add = targetDeptArr.filter(
|
632
|
|
- (item) => !data.list.some((ele) => ele.id == item.id)
|
633
|
|
- );
|
634
|
|
- this.department = add.concat(data.list);
|
635
|
|
- this.validateForm.controls.endDepartment.setValue(targetDept);
|
636
|
|
- }
|
637
|
|
- });
|
638
|
|
- } else {
|
639
|
|
- this.maskFlagLoading2 = false;
|
640
|
|
- if (!this.maskFlagLoading1 && !this.maskFlagLoading2) {
|
641
|
|
- this.message.remove(this.maskFlag);
|
642
|
|
- this.maskFlag = false;
|
643
|
|
- this.modal = true;
|
644
|
|
- }
|
645
|
|
- }
|
646
|
|
- // --------/终点科室---
|
647
|
|
- if (
|
648
|
|
- data.taskType.associationType.value == "other" &&
|
649
|
|
- (data.taskType.carryingCourses[0].departmentStrategy.value == 1 ||
|
650
|
|
- data.taskType.carryingCourses[1].departmentStrategy.value == 1)
|
651
|
|
- ) {
|
652
|
|
- this.validateForm.controls.openDepartments.setValue(
|
653
|
|
- data.taskTypeDeptOrder
|
654
|
|
- );
|
655
|
|
- }
|
656
|
|
- if (data.dayType == 1) {
|
657
|
|
- //节假日
|
658
|
|
- this.oneOption[1]["checked"] = true;
|
659
|
|
- } else if (data.dayType == 2) {
|
660
|
|
- //工作日
|
661
|
|
- this.oneOption[0]["checked"] = true;
|
662
|
|
- } else {
|
663
|
|
- this.oneOption[0]["checked"] = true;
|
664
|
|
- this.oneOption[1]["checked"] = true;
|
665
|
|
- }
|
666
|
|
- }
|
667
|
|
- // 立即执行
|
668
|
|
- coopItem: any = {};
|
669
|
|
- execModal: boolean = false;
|
670
|
|
- // 打开立即执行模态框
|
671
|
|
- openExecModal(item) {
|
672
|
|
- this.coopItem = item;
|
673
|
|
- this.execModal = true;
|
674
|
|
- }
|
675
|
|
- // 确认立即执行
|
676
|
|
- confirmExec() {
|
677
|
|
- this.btnLoading = true;
|
678
|
|
- this.mainService
|
679
|
|
- .executeNowOrderPlan(this.coopItem.id)
|
680
|
|
- .subscribe((result: any) => {
|
681
|
|
- this.closeExecModal();
|
682
|
|
- this.btnLoading = false;
|
683
|
|
- if (result.status == 200) {
|
684
|
|
- this.showPromptModal("立即执行", true, "");
|
685
|
|
- } else {
|
686
|
|
- this.showPromptModal("立即执行", false, result.msg);
|
687
|
|
- }
|
688
|
|
- });
|
689
|
|
- }
|
690
|
|
- // 关闭立即执行模态框
|
691
|
|
- closeExecModal() {
|
692
|
|
- this.execModal = false;
|
|
260
|
+ this.coopData = data;
|
|
261
|
+ this.initForm();
|
|
262
|
+ this.taskTypeList = [];
|
|
263
|
+ data.startTaskTypeDTO && (this.taskTypeList.push(data.startTaskTypeDTO));
|
|
264
|
+ data.createTaskTypeDTO && (this.taskTypeList.push(data.createTaskTypeDTO));
|
|
265
|
+ data.startTaskTypeId && this.validateForm.controls.startTaskTypeId.setValue(data.startTaskTypeId);
|
|
266
|
+ data.createTaskTypeId && this.validateForm.controls.createTaskTypeId.setValue(data.createTaskTypeId);
|
|
267
|
+ data.startDept && this.validateForm.controls.startDept.setValue(data.startDept.id);
|
|
268
|
+ data.endDept && this.validateForm.controls.endDept.setValue(data.endDept.id);
|
|
269
|
+ data.getOrderType && this.validateForm.controls.getOrderType.setValue(data.getOrderType.value);
|
|
270
|
+ data.getOrderRange && this.validateForm.controls.getOrderRange.setValue(data.getOrderRange);
|
|
271
|
+ data.copyRemark && this.validateForm.controls.copyRemark.setValue(data.copyRemark);
|
|
272
|
+ data.active && this.validateForm.controls.active.setValue(data.active);
|
693
|
273
|
}
|
|
274
|
+
|
694
|
275
|
// 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
|
695
|
276
|
showPromptModal(con, success, promptInfo?) {
|
696
|
277
|
this.promptModalShow = false;
|
|
@@ -732,7 +313,7 @@ export class KeepOrderConfigComponent implements OnInit {
|
732
|
313
|
this.btnLoading = true;
|
733
|
314
|
if (this.confirmDelType === "del") {
|
734
|
315
|
//删除
|
735
|
|
- this.mainService.delRoundRobin(this.coopId).subscribe((data) => {
|
|
316
|
+ this.mainService.simplePost('rmvData', 'keepOrderConfig', [this.coopId]).subscribe((data) => {
|
736
|
317
|
this.btnLoading = false;
|
737
|
318
|
this.delModal = false;
|
738
|
319
|
if (data.status == 200) {
|
|
@@ -753,71 +334,6 @@ export class KeepOrderConfigComponent implements OnInit {
|
753
|
334
|
this.showPromptModal(this.tipsMsg2, false, data.msg);
|
754
|
335
|
}
|
755
|
336
|
});
|
756
|
|
- } else if (this.confirmDelType === "switch") {
|
757
|
|
- //启用/停用
|
758
|
|
- this.mainService
|
759
|
|
- .switchRoundRobin(
|
760
|
|
- this.confirmDelIsSwitch ? "stop" : "active",
|
761
|
|
- this.coopId
|
762
|
|
- )
|
763
|
|
- .subscribe((data) => {
|
764
|
|
- this.btnLoading = false;
|
765
|
|
- this.delModal = false;
|
766
|
|
- if (data.status == 200) {
|
767
|
|
- this.showPromptModal(this.tipsMsg2, true, "");
|
768
|
|
- } else {
|
769
|
|
- this.showPromptModal(this.tipsMsg2, false, data.msg);
|
770
|
|
- }
|
771
|
|
- });
|
772
|
337
|
}
|
773
|
338
|
}
|
774
|
|
-
|
775
|
|
- // 院区列表
|
776
|
|
- getHospitalList() {
|
777
|
|
- this.hospitalList = [this.tool.getCurrentHospital()];
|
778
|
|
- this.hosId = this.tool.getCurrentHospital().id;
|
779
|
|
- }
|
780
|
|
- // 查看
|
781
|
|
- detail(id) {
|
782
|
|
- this.router.navigateByUrl("/main/roundRobin/roundRobinDetail/" + id);
|
783
|
|
- }
|
784
|
|
- //时间选择框相关
|
785
|
|
- timeSelectedValue = [];
|
786
|
|
- defaultSelectTimesOption = [];
|
787
|
|
-
|
788
|
|
- time: Date | null = null;
|
789
|
|
- defaultTimePickerOpenValue = new Date();
|
790
|
|
- timePickerOpen = false;
|
791
|
|
- timeSelectFocus() {
|
792
|
|
- this.timePickerOpen = true;
|
793
|
|
- }
|
794
|
|
- timePickerClick() {
|
795
|
|
- this.timePickerOpen = false;
|
796
|
|
- this.time = this.time || new Date();
|
797
|
|
- let hour = (this.time.getHours() + "").padStart(2, "0");
|
798
|
|
- let minute = (this.time.getMinutes() + "").padStart(2, "0");
|
799
|
|
- let str = `${hour}:${minute}`;
|
800
|
|
- if (!this.timeSelectedValue.includes(str)) {
|
801
|
|
- this.defaultSelectTimesOption.push(str);
|
802
|
|
- this.timeSelectedValue.push(str);
|
803
|
|
- }
|
804
|
|
- }
|
805
|
|
- timePickerChange() {
|
806
|
|
- if (this.timePickerOpen) {
|
807
|
|
- this.timePickerOpen = false;
|
808
|
|
- }
|
809
|
|
- }
|
810
|
|
- // -----------------------------------------------------------------------
|
811
|
|
- // 批量建单设置
|
812
|
|
- batchOrdersFlag = false; //批量建单设置的弹窗
|
813
|
|
- selectedBatchOrder = null; //当前选中的轮巡计划
|
814
|
|
- //打开批量建单设置弹窗
|
815
|
|
- batchOrdersHandler(data) {
|
816
|
|
- this.batchOrdersFlag = true;
|
817
|
|
- this.selectedBatchOrder = data;
|
818
|
|
- }
|
819
|
|
- //关闭批量建单设置弹窗
|
820
|
|
- close() {
|
821
|
|
- this.batchOrdersFlag = false;
|
822
|
|
- }
|
823
|
339
|
}
|