|
@@ -0,0 +1,192 @@
|
|
1
|
+import { Component, OnInit } from "@angular/core";
|
|
2
|
+import { ToolService } from 'src/app/services/tool.service';
|
|
3
|
+import { NzMessageService } from 'ng-zorro-antd';
|
|
4
|
+import { Subject } from 'rxjs';
|
|
5
|
+import { debounceTime } from 'rxjs/operators';
|
|
6
|
+import { MedicalWastePageControlService } from './medical-waste-page-control.service';
|
|
7
|
+
|
|
8
|
+@Component({
|
|
9
|
+ selector: "app-medical-waste-page-control",
|
|
10
|
+ templateUrl: "./medical-waste-page-control.component.html",
|
|
11
|
+ styleUrls: ["./medical-waste-page-control.component.less"],
|
|
12
|
+})
|
|
13
|
+export class MedicalWastePageControlComponent implements OnInit {
|
|
14
|
+ loading:boolean = false; //页面加载的loading
|
|
15
|
+ btnLoading:boolean = false; //提交按钮的loading
|
|
16
|
+ tabModalName:string = 'characteristics'; //当前选中的tab
|
|
17
|
+ hosId = this.tool.getCurrentHospital().id; //当前院区
|
|
18
|
+
|
|
19
|
+ // 医废存储科室
|
|
20
|
+ wasteDept:any = null;
|
|
21
|
+ // 回收支持交接方式
|
|
22
|
+ wasteHandoverType:any = null;
|
|
23
|
+ // 配置
|
|
24
|
+ configs:any = {};
|
|
25
|
+ searchTimerSubject = new Subject();
|
|
26
|
+ constructor(private otherPageControlService: MedicalWastePageControlService, private tool: ToolService, private msg: NzMessageService) {}
|
|
27
|
+
|
|
28
|
+ ngOnInit():void {
|
|
29
|
+ // todo
|
|
30
|
+ this.searchTimerSubject.pipe(debounceTime(500)).subscribe((v) => {
|
|
31
|
+ let fun = v[0];
|
|
32
|
+ fun.call(this, v[1]);
|
|
33
|
+ });
|
|
34
|
+ this.getTaskTypes();
|
|
35
|
+ this.getDepts();
|
|
36
|
+ this.getWasteHandoverType();
|
|
37
|
+ this.getConfig();
|
|
38
|
+ }
|
|
39
|
+
|
|
40
|
+ // 边输入边搜索节流阀
|
|
41
|
+ searchTimer(fun, e) {
|
|
42
|
+ this.isLoading = true;
|
|
43
|
+ this.searchTimerSubject.next([fun, e]);
|
|
44
|
+ }
|
|
45
|
+
|
|
46
|
+ // 用户输入搜索任务类型
|
|
47
|
+ isLoading: boolean = false;
|
|
48
|
+ taskTypeId:any = null;
|
|
49
|
+ taskTypes:any[] = [];
|
|
50
|
+ changeTasktype(e) {
|
|
51
|
+ this.searchTimer(this.getTaskTypes, e);
|
|
52
|
+ }
|
|
53
|
+
|
|
54
|
+ changeDept(e) {
|
|
55
|
+ this.searchTimer(this.getDepts, e);
|
|
56
|
+ }
|
|
57
|
+
|
|
58
|
+ //获取任务类型
|
|
59
|
+ getTaskTypes(e:string = '') {
|
|
60
|
+ let postData:any = {
|
|
61
|
+ idx: 0,
|
|
62
|
+ sum: 9999,
|
|
63
|
+ taskType: {
|
|
64
|
+ taskName: e,
|
|
65
|
+ simpleQuery: true,
|
|
66
|
+ hosId: {
|
|
67
|
+ id: this.hosId
|
|
68
|
+ },
|
|
69
|
+ ordinaryField: {
|
|
70
|
+ key: 'ordinary_field',
|
|
71
|
+ value: 'clinicalWaste'
|
|
72
|
+ }
|
|
73
|
+ }
|
|
74
|
+ };
|
|
75
|
+ this.isLoading = true;
|
|
76
|
+ this.otherPageControlService
|
|
77
|
+ .getTaskTypes(postData)
|
|
78
|
+ .subscribe((result) => {
|
|
79
|
+ this.isLoading = false;
|
|
80
|
+ if (result.status == 200) {
|
|
81
|
+ this.taskTypes = result.list || [];
|
|
82
|
+ }
|
|
83
|
+ });
|
|
84
|
+ }
|
|
85
|
+
|
|
86
|
+ //获取科室
|
|
87
|
+ wasteDepts:any = [];
|
|
88
|
+ getDepts(e:string = '') {
|
|
89
|
+ this.isLoading = true;
|
|
90
|
+ let postData = {
|
|
91
|
+ idx: 0,
|
|
92
|
+ sum: 9999,
|
|
93
|
+ department: {
|
|
94
|
+ searchType: 1,// 简单查询
|
|
95
|
+ dept: e,
|
|
96
|
+ cascadeHosId: this.hosId,
|
|
97
|
+ }
|
|
98
|
+ };
|
|
99
|
+ this.otherPageControlService
|
|
100
|
+ .getDepts(postData)
|
|
101
|
+ .subscribe((result) => {
|
|
102
|
+ this.isLoading = false;
|
|
103
|
+ if (result.status == 200) {
|
|
104
|
+ this.wasteDepts = result.list || [];
|
|
105
|
+ }
|
|
106
|
+ });
|
|
107
|
+ }
|
|
108
|
+ //获取批次号生成规则
|
|
109
|
+ waste_handover_type:any = [];
|
|
110
|
+ getWasteHandoverType() {
|
|
111
|
+ this.isLoading = true;
|
|
112
|
+ this.otherPageControlService
|
|
113
|
+ .getDictionary("waste_handover_type")
|
|
114
|
+ .subscribe((data) => {
|
|
115
|
+ this.isLoading = false;
|
|
116
|
+ this.waste_handover_type = data;
|
|
117
|
+ });
|
|
118
|
+ }
|
|
119
|
+ // 切换tab
|
|
120
|
+ tabModal(tabModalName:string){
|
|
121
|
+ this.tabModalName = tabModalName;
|
|
122
|
+ }
|
|
123
|
+
|
|
124
|
+ // 保存
|
|
125
|
+ submitForm() {
|
|
126
|
+ if(!this.taskTypeId){
|
|
127
|
+ this.msg.create("warning", "请先配置关联医废任务类型!");
|
|
128
|
+ return;
|
|
129
|
+ }
|
|
130
|
+
|
|
131
|
+ if(!this.wasteHandoverType){
|
|
132
|
+ this.msg.create("warning", "请先配置回收支持交接方式!");
|
|
133
|
+ return;
|
|
134
|
+ }
|
|
135
|
+
|
|
136
|
+ if(!this.wasteDept){
|
|
137
|
+ this.msg.create("warning", "请先配置医废存储科室!");
|
|
138
|
+ return;
|
|
139
|
+ }
|
|
140
|
+
|
|
141
|
+ let postData:any = {
|
|
142
|
+ id: this.configs.id,
|
|
143
|
+ taskType: this.taskTypeId,
|
|
144
|
+ hosId: this.hosId,
|
|
145
|
+ wasteDept: this.wasteDept,
|
|
146
|
+ wasteHandoverType: { id: this.wasteHandoverType },
|
|
147
|
+ };
|
|
148
|
+ this.btnLoading = true;
|
|
149
|
+ this.otherPageControlService
|
|
150
|
+ .simplePost("addData", "taskTypeConfig", postData)
|
|
151
|
+ .subscribe((result) => {
|
|
152
|
+ this.btnLoading = false;
|
|
153
|
+ if (result.status == 200) {
|
|
154
|
+ this.getConfig();
|
|
155
|
+ }
|
|
156
|
+ });
|
|
157
|
+ }
|
|
158
|
+
|
|
159
|
+ // 获取配置
|
|
160
|
+ getConfig() {
|
|
161
|
+ this.loading = true;
|
|
162
|
+ let postData = {
|
|
163
|
+ idx: 0,
|
|
164
|
+ sum: 10,
|
|
165
|
+ taskTypeConfig: {
|
|
166
|
+ taskTypeDTO: {
|
|
167
|
+ hosId: {
|
|
168
|
+ id: this.hosId
|
|
169
|
+ },
|
|
170
|
+ ordinaryField: {
|
|
171
|
+ key: 'ordinary_field',
|
|
172
|
+ value: 'clinicalWaste'
|
|
173
|
+ }
|
|
174
|
+ }
|
|
175
|
+ }
|
|
176
|
+ };
|
|
177
|
+ this.otherPageControlService
|
|
178
|
+ .getConfig(postData)
|
|
179
|
+ .subscribe((result) => {
|
|
180
|
+ this.loading = false;
|
|
181
|
+ if (result.status == 200) {
|
|
182
|
+ this.configs = result.list[0] || {};
|
|
183
|
+ this.wasteDept = this.configs.wasteDept;
|
|
184
|
+ this.wasteHandoverType = this.configs.wasteHandoverType ? this.configs.wasteHandoverType.id : null;
|
|
185
|
+ this.taskTypeId = this.configs.taskType || null;
|
|
186
|
+ }
|
|
187
|
+ });
|
|
188
|
+ }
|
|
189
|
+}
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|