|
@@ -26,13 +26,23 @@ export class HospitalManagementComponent implements OnInit {
|
26
|
26
|
) {}
|
27
|
27
|
|
28
|
28
|
ngOnInit() {
|
29
|
|
- this.searchParentHospitalSubject.pipe(debounceTime(500)).subscribe((v: any) => {
|
30
|
|
- this.getAllParentHospital(v).subscribe((result) => {
|
31
|
|
- this.isLoading = false;
|
32
|
|
- if (result.status == 200) {
|
33
|
|
- this.parentHospitals = result.list;
|
34
|
|
- }
|
35
|
|
- });
|
|
29
|
+ this.searchParentHospitalSubject.pipe(debounceTime(500)).subscribe(({e, type}) => {
|
|
30
|
+ if(type === 'parentDept'){
|
|
31
|
+ this.getAllParentHospital(e, type === 'parentDept').subscribe((result) => {
|
|
32
|
+ this.isLoading = false;
|
|
33
|
+ if (result.status == 200) {
|
|
34
|
+ this.parentDepts = result.list;
|
|
35
|
+ }
|
|
36
|
+ });
|
|
37
|
+ }else if(type === 'parent'){
|
|
38
|
+ this.getAllParentHospital(e, type === 'parentDept').subscribe((result) => {
|
|
39
|
+ this.isLoading = false;
|
|
40
|
+ if (result.status == 200) {
|
|
41
|
+ this.parentHospitals = result.list;
|
|
42
|
+ }
|
|
43
|
+ });
|
|
44
|
+ }
|
|
45
|
+
|
36
|
46
|
});
|
37
|
47
|
this.coopBtns = this.tool.initCoopBtns(this.route);
|
38
|
48
|
this.getList();
|
|
@@ -63,11 +73,12 @@ export class HospitalManagementComponent implements OnInit {
|
63
|
73
|
coopBtns: any = {};
|
64
|
74
|
//所有院区
|
65
|
75
|
parentHospitals: any = [];
|
|
76
|
+ parentDepts: any = [];
|
66
|
77
|
searchParentHospitalSubject = new Subject();
|
67
|
78
|
//搜索父级院区
|
68
|
|
- changeInp(e) {
|
|
79
|
+ changeInp(e, type) {
|
69
|
80
|
this.isLoading = true;
|
70
|
|
- this.searchParentHospitalSubject.next(e);
|
|
81
|
+ this.searchParentHospitalSubject.next({e, type});
|
71
|
82
|
}
|
72
|
83
|
// 打开父级科室下拉框
|
73
|
84
|
isLoading = false;
|
|
@@ -82,6 +93,18 @@ export class HospitalManagementComponent implements OnInit {
|
82
|
93
|
});
|
83
|
94
|
}
|
84
|
95
|
}
|
|
96
|
+ // 打开父级部门下拉框
|
|
97
|
+ openParentDeptSelect(flag) {
|
|
98
|
+ if (flag) {
|
|
99
|
+ this.isLoading = true;
|
|
100
|
+ this.getAllParentHospital('', true).subscribe((result) => {
|
|
101
|
+ this.isLoading = false;
|
|
102
|
+ if (result.status == 200) {
|
|
103
|
+ this.parentDepts = result.list;
|
|
104
|
+ }
|
|
105
|
+ });
|
|
106
|
+ }
|
|
107
|
+ }
|
85
|
108
|
// 选择父级科室下拉框
|
86
|
109
|
changeHospitalSelect(e) {
|
87
|
110
|
if(!e){
|
|
@@ -102,19 +125,39 @@ export class HospitalManagementComponent implements OnInit {
|
102
|
125
|
}
|
103
|
126
|
}
|
104
|
127
|
//获取所有的父级院区列表
|
105
|
|
- getAllParentHospital(keyWord = "") {
|
106
|
|
- let postData: any = {
|
107
|
|
- idx: 0,
|
108
|
|
- sum: 10,
|
109
|
|
- hospital: {
|
110
|
|
- keyWord: keyWord,
|
111
|
|
- },
|
112
|
|
- };
|
113
|
|
- if (this.coopId) {
|
114
|
|
- // 过滤这个院区及其子院区
|
115
|
|
- postData.hospital.filterByHosId = this.coopId;
|
|
128
|
+ getAllParentHospital(keyWord = "", isParentDept = false) {
|
|
129
|
+ if(isParentDept){
|
|
130
|
+ this.mainService.getDictionary("list", "hospital_type").subscribe((result) => {
|
|
131
|
+ this.hospitalTypes = result || [];
|
|
132
|
+ });
|
|
133
|
+
|
|
134
|
+ let postData: any = {
|
|
135
|
+ idx: 0,
|
|
136
|
+ sum: 10,
|
|
137
|
+ hospital: {
|
|
138
|
+ keyWord: keyWord,
|
|
139
|
+ type: isParentDept ? this.hospitalTypes.find(v => v.value == 6) : undefined
|
|
140
|
+ },
|
|
141
|
+ };
|
|
142
|
+ if (this.coopId) {
|
|
143
|
+ // 过滤这个院区及其子院区
|
|
144
|
+ postData.hospital.filterByHosId = this.coopId;
|
|
145
|
+ }
|
|
146
|
+ return this.mainService.getFetchDataList("data", "hospital", postData);
|
|
147
|
+ }else{
|
|
148
|
+ let postData: any = {
|
|
149
|
+ idx: 0,
|
|
150
|
+ sum: 10,
|
|
151
|
+ hospital: {
|
|
152
|
+ keyWord: keyWord,
|
|
153
|
+ },
|
|
154
|
+ };
|
|
155
|
+ if (this.coopId) {
|
|
156
|
+ // 过滤这个院区及其子院区
|
|
157
|
+ postData.hospital.filterByHosId = this.coopId;
|
|
158
|
+ }
|
|
159
|
+ return this.mainService.getFetchDataList("data", "hospital", postData);
|
116
|
160
|
}
|
117
|
|
- return this.mainService.getFetchDataList("data", "hospital", postData);
|
118
|
161
|
}
|
119
|
162
|
|
120
|
163
|
// 表格数据
|
|
@@ -204,6 +247,7 @@ export class HospitalManagementComponent implements OnInit {
|
204
|
247
|
this.validateForm = this.fb.group({
|
205
|
248
|
hospitalType: [null],
|
206
|
249
|
parentHospital: [null],
|
|
250
|
+ parentDeptId: [null],
|
207
|
251
|
hospitalName: [null, [Validators.required]],
|
208
|
252
|
hospitalNum: [null, [Validators.required]],
|
209
|
253
|
});
|
|
@@ -227,6 +271,9 @@ export class HospitalManagementComponent implements OnInit {
|
227
|
271
|
if (this.validateForm.value.parentHospital) {
|
228
|
272
|
data.hospital.parent = { id: this.validateForm.value.parentHospital };
|
229
|
273
|
}
|
|
274
|
+ if (this.validateForm.value.parentDeptId) {
|
|
275
|
+ data.hospital.parentDeptId = this.validateForm.value.parentDeptId;
|
|
276
|
+ }
|
230
|
277
|
if (this.validateForm.value.hospitalType) {
|
231
|
278
|
data.hospital.type = { id: this.validateForm.value.hospitalType };
|
232
|
279
|
}
|
|
@@ -253,12 +300,12 @@ export class HospitalManagementComponent implements OnInit {
|
253
|
300
|
this.modal = true;
|
254
|
301
|
this.coopId = data.id;
|
255
|
302
|
if (data.parent) {
|
256
|
|
- this.getAllParentHospital(data.parent.dept).subscribe((res) => {
|
257
|
|
- if (res.status == 200) {
|
258
|
|
- this.parentHospitals = res.list;
|
259
|
|
- this.validateForm.controls.parentHospital.setValue(data.parent.id);
|
260
|
|
- }
|
261
|
|
- });
|
|
303
|
+ this.parentHospitals = [data.parent];
|
|
304
|
+ this.validateForm.controls.parentHospital.setValue(data.parent.id);
|
|
305
|
+ }
|
|
306
|
+ if (data.parentDeptId && data.parentDeptDTO) {
|
|
307
|
+ this.parentDepts = [data.parentDeptDTO];
|
|
308
|
+ this.validateForm.controls.parentDeptId.setValue(data.parentDeptId);
|
262
|
309
|
}
|
263
|
310
|
if(data.type){
|
264
|
311
|
this.mainService.getDictionary("list", "hospital_type").subscribe((result) => {
|