|
@@ -3,6 +3,7 @@ import { MainService } from "../../services/main.service";
|
3
|
3
|
import { ToolService } from "../../services/tool.service";
|
4
|
4
|
import { Subject } from "rxjs";
|
5
|
5
|
import { debounceTime } from "rxjs/operators";
|
|
6
|
+import { format } from "date-fns";
|
6
|
7
|
@Component({
|
7
|
8
|
selector: "app-specimen-search",
|
8
|
9
|
templateUrl: "./specimen-search.component.html",
|
|
@@ -18,22 +19,30 @@ export class SpecimenSearchComponent implements OnInit {
|
18
|
19
|
hospital: null,
|
19
|
20
|
department: null,
|
20
|
21
|
speState: null,
|
|
22
|
+ receiverName: null,
|
|
23
|
+ dateRange: [],
|
|
24
|
+ checkDept: null,
|
21
|
25
|
};
|
22
|
26
|
types = []; // 类型列表(搜索框)
|
23
|
27
|
departmentSearch = []; // 院区下的科室列表(搜索框)
|
|
28
|
+ userSearch = []; // 院区下的人员列表(搜索框)
|
24
|
29
|
allHospital: any = []; //院区下拉框
|
25
|
30
|
listOfData: any[] = []; //表格数据
|
26
|
31
|
pageIndex: number = 1; //表格当前页码
|
27
|
32
|
pageSize: number = 10; //表格每页展示条数
|
28
|
33
|
listLength: number = 10; //表格总数据量
|
29
|
34
|
checkOptionsOne: Array<any> = [
|
30
|
|
- { label: "服务中心收取", value: "0", checked: false },
|
|
35
|
+ { label: "服务中心收取", value: "0", checked: true },
|
31
|
36
|
];
|
32
|
37
|
changeInpSubject = new Subject();
|
|
38
|
+ changeInp2Subject = new Subject();
|
33
|
39
|
ngOnInit() {
|
34
|
40
|
this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
|
35
|
41
|
this.searchDepartment(v[0], v[1]);
|
36
|
42
|
});
|
|
43
|
+ this.changeInp2Subject.pipe(debounceTime(500)).subscribe((v) => {
|
|
44
|
+ this.searchUser(v[0], v[1]);
|
|
45
|
+ });
|
37
|
46
|
this.getAllHospital();
|
38
|
47
|
}
|
39
|
48
|
// 表格筛选
|
|
@@ -103,6 +112,31 @@ export class SpecimenSearchComponent implements OnInit {
|
103
|
112
|
closeModelHistory(e) {
|
104
|
113
|
this.historyPromptModalShow = JSON.parse(e).show;
|
105
|
114
|
}
|
|
115
|
+ // 日期选择
|
|
116
|
+ startDate: string; //发起时间开始
|
|
117
|
+ endDate: string; //发起时间结束
|
|
118
|
+ changeDate(result?): void {
|
|
119
|
+ if (!result) {
|
|
120
|
+ this.startDate = this.endDate = "";
|
|
121
|
+ return;
|
|
122
|
+ }
|
|
123
|
+ this.startDate =
|
|
124
|
+ result[0].getFullYear() +
|
|
125
|
+ "-" +
|
|
126
|
+ (result[0].getMonth() + 1) +
|
|
127
|
+ "-" +
|
|
128
|
+ result[0].getDate() +
|
|
129
|
+ " " +
|
|
130
|
+ "00:00:00";
|
|
131
|
+ this.endDate =
|
|
132
|
+ result[1].getFullYear() +
|
|
133
|
+ "-" +
|
|
134
|
+ (result[1].getMonth() + 1) +
|
|
135
|
+ "-" +
|
|
136
|
+ result[1].getDate() +
|
|
137
|
+ " " +
|
|
138
|
+ "23:59:59";
|
|
139
|
+ }
|
106
|
140
|
// 重置
|
107
|
141
|
reset() {
|
108
|
142
|
this.searchCriteria = {
|
|
@@ -112,6 +146,9 @@ export class SpecimenSearchComponent implements OnInit {
|
112
|
146
|
hospital: this.allHospital[0] ? this.allHospital[0]["id"] + "" : null,
|
113
|
147
|
department: null,
|
114
|
148
|
speState: null,
|
|
149
|
+ receiverName: null,
|
|
150
|
+ dateRange: [],
|
|
151
|
+ checkDept: null,
|
115
|
152
|
};
|
116
|
153
|
this.getList(1);
|
117
|
154
|
}
|
|
@@ -133,8 +170,15 @@ export class SpecimenSearchComponent implements OnInit {
|
133
|
170
|
this.changeInp("no", "search");
|
134
|
171
|
}
|
135
|
172
|
}
|
|
173
|
+ // 打开搜索框
|
|
174
|
+ changeSearch2(flag) {
|
|
175
|
+ if (flag) {
|
|
176
|
+ this.changeInp2("no", "search");
|
|
177
|
+ }
|
|
178
|
+ }
|
136
|
179
|
// 边输边搜节流阀
|
137
|
180
|
isLoading = false;
|
|
181
|
+ deptKey = "";
|
138
|
182
|
changeInp(dept, type) {
|
139
|
183
|
if (!dept) {
|
140
|
184
|
return;
|
|
@@ -142,11 +186,11 @@ export class SpecimenSearchComponent implements OnInit {
|
142
|
186
|
if (dept === "no") {
|
143
|
187
|
dept = "";
|
144
|
188
|
}
|
|
189
|
+ this.deptKey = dept;
|
145
|
190
|
this.isLoading = true;
|
146
|
191
|
this.changeInpSubject.next([dept, type]);
|
147
|
192
|
}
|
148
|
193
|
// 搜索科室
|
149
|
|
- snum = 0;
|
150
|
194
|
searchDepartment(dept, type) {
|
151
|
195
|
let data = {
|
152
|
196
|
department: {
|
|
@@ -156,19 +200,56 @@ export class SpecimenSearchComponent implements OnInit {
|
156
|
200
|
},
|
157
|
201
|
},
|
158
|
202
|
idx: 0,
|
159
|
|
- sum: 20,
|
|
203
|
+ sum: 10,
|
160
|
204
|
};
|
161
|
|
- this.snum++;
|
162
|
205
|
this.mainService
|
163
|
206
|
.getFetchDataList("data", "department", data)
|
164
|
207
|
.subscribe((data) => {
|
165
|
|
- this.snum--;
|
166
|
208
|
if (data.status == 200) {
|
167
|
209
|
if (type === "search") {
|
168
|
|
- if (this.snum === 0) {
|
|
210
|
+ if (this.deptKey === dept) {
|
169
|
211
|
this.isLoading = false;
|
|
212
|
+ this.departmentSearch = data.list;
|
|
213
|
+ }
|
|
214
|
+ }
|
|
215
|
+ }
|
|
216
|
+ });
|
|
217
|
+ }
|
|
218
|
+ // 边输边搜节流阀
|
|
219
|
+ userKey = "";
|
|
220
|
+ changeInp2(keyword, type) {
|
|
221
|
+ if (!keyword) {
|
|
222
|
+ return;
|
|
223
|
+ }
|
|
224
|
+ if (keyword === "no") {
|
|
225
|
+ keyword = "";
|
|
226
|
+ }
|
|
227
|
+ this.userKey = keyword;
|
|
228
|
+ this.isLoading = true;
|
|
229
|
+ this.changeInp2Subject.next([keyword, type]);
|
|
230
|
+ }
|
|
231
|
+ // 搜索科室
|
|
232
|
+ searchUser(keyword, type) {
|
|
233
|
+ let data = {
|
|
234
|
+ user: {
|
|
235
|
+ usertype: { id: 106 },
|
|
236
|
+ name: keyword,
|
|
237
|
+ hospital: {
|
|
238
|
+ id: this.searchCriteria.hospital,
|
|
239
|
+ },
|
|
240
|
+ },
|
|
241
|
+ idx: 0,
|
|
242
|
+ sum: 10,
|
|
243
|
+ };
|
|
244
|
+ this.mainService
|
|
245
|
+ .getFetchDataList("data", "user", data)
|
|
246
|
+ .subscribe((data) => {
|
|
247
|
+ if (data.status == 200) {
|
|
248
|
+ if (type === "search") {
|
|
249
|
+ if (this.userKey === keyword) {
|
|
250
|
+ this.isLoading = false;
|
|
251
|
+ this.userSearch = data.list;
|
170
|
252
|
}
|
171
|
|
- this.departmentSearch = data.list;
|
172
|
253
|
}
|
173
|
254
|
}
|
174
|
255
|
});
|
|
@@ -190,10 +271,11 @@ export class SpecimenSearchComponent implements OnInit {
|
190
|
271
|
// 表格数据
|
191
|
272
|
loading1 = false;
|
192
|
273
|
getList(type) {
|
|
274
|
+ console.log(this.searchCriteria.dateRange);
|
193
|
275
|
if (type == 1) {
|
194
|
276
|
this.pageIndex = 1;
|
195
|
277
|
}
|
196
|
|
- let postData = {
|
|
278
|
+ let postData: any = {
|
197
|
279
|
idx: this.pageIndex - 1,
|
198
|
280
|
sum: this.pageSize,
|
199
|
281
|
specimen: {
|
|
@@ -204,6 +286,14 @@ export class SpecimenSearchComponent implements OnInit {
|
204
|
286
|
id: this.searchCriteria.department,
|
205
|
287
|
}
|
206
|
288
|
: undefined,
|
|
289
|
+ checkDept: this.searchCriteria.checkDept
|
|
290
|
+ ? {
|
|
291
|
+ id: this.searchCriteria.checkDept,
|
|
292
|
+ }
|
|
293
|
+ : undefined,
|
|
294
|
+ receiverName: this.searchCriteria.receiverName
|
|
295
|
+ ? this.searchCriteria.receiverName
|
|
296
|
+ : undefined,
|
207
|
297
|
scode: !this.searchCriteria.scode
|
208
|
298
|
? undefined
|
209
|
299
|
: this.searchCriteria.scode,
|
|
@@ -215,6 +305,12 @@ export class SpecimenSearchComponent implements OnInit {
|
215
|
305
|
: undefined,
|
216
|
306
|
},
|
217
|
307
|
};
|
|
308
|
+ if (this.searchCriteria.dateRange.length) {
|
|
309
|
+ postData.specimen.startArriveTime =
|
|
310
|
+ format(this.searchCriteria.dateRange[0], "yyyy-MM-dd ") + "00:00:00";
|
|
311
|
+ postData.specimen.endArriveTime =
|
|
312
|
+ format(this.searchCriteria.dateRange[1], "yyyy-MM-dd ") + "23:59:59";
|
|
313
|
+ }
|
218
|
314
|
this.loading1 = true;
|
219
|
315
|
this.mainService
|
220
|
316
|
.getFetchDataList("simple/data", "specimen", postData)
|