Browse Source

标本信息增加筛选条件

seimin 2 years ago
parent
commit
87366e02f9

+ 59 - 3
src/app/views/specimen-search/specimen-search.component.html

@@ -1,7 +1,7 @@
1 1
 <div class="list-template">
2 2
   <div class="list-template__content">
3 3
     <div class="list-template__top" nz-row>
4
-      <div nz-col nzXl="16" class="list-template__searchBox">
4
+      <div nz-col nzXl="18" class="list-template__searchBox">
5 5
         <div class="list-template__searchItem">
6 6
           <span class="label">收取科室:</span>
7 7
           <nz-select
@@ -28,6 +28,31 @@
28 28
           </nz-select>
29 29
         </div>
30 30
         <div class="list-template__searchItem">
31
+          <span class="label">终点科室:</span>
32
+          <nz-select
33
+            [nzDropdownMatchSelectWidth]="false"
34
+            class="formItem"
35
+            nzServerSearch
36
+            nzShowSearch
37
+            nzAllowClear
38
+            nzPlaceHolder="请选择终点科室"
39
+            [(ngModel)]="searchCriteria.checkDept"
40
+            (nzOnSearch)="changeInp($event, 'search')"
41
+            (nzOpenChange)="changeSearch($event)"
42
+          >
43
+            <ng-container *ngFor="let data of departmentSearch">
44
+              <nz-option
45
+                *ngIf="!isLoading"
46
+                nzLabel="{{ data.dept }}"
47
+                nzValue="{{ data.id }}"
48
+              ></nz-option>
49
+            </ng-container>
50
+            <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
51
+              <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
52
+            </nz-option>
53
+          </nz-select>
54
+        </div>
55
+        <div class="list-template__searchItem">
31 56
           <span class="label">标本编码:</span>
32 57
           <input
33 58
             nz-input
@@ -69,8 +94,38 @@
69 94
             </nz-option>
70 95
           </nz-select>
71 96
         </div>
97
+        <div class="list-template__searchItem">
98
+          <span class="label">收取人:</span>
99
+          <nz-select
100
+            [nzDropdownMatchSelectWidth]="false"
101
+            class="formItem"
102
+            nzServerSearch
103
+            nzShowSearch
104
+            nzAllowClear
105
+            nzPlaceHolder="请选择收取人:"
106
+            [(ngModel)]="searchCriteria.receiverName"
107
+            (nzOnSearch)="changeInp2($event, 'search')"
108
+            (nzOpenChange)="changeSearch2($event)"
109
+          >
110
+            <ng-container *ngFor="let data of userSearch">
111
+              <nz-option
112
+                *ngIf="!isLoading"
113
+                nzLabel="{{ data.name }}"
114
+                nzValue="{{ data.id }}"
115
+              ></nz-option>
116
+            </ng-container>
117
+            <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
118
+              <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
119
+            </nz-option>
120
+          </nz-select>
121
+        </div>
122
+        <div class="list-template__searchItem">
123
+          <span class="label">收取时间:</span>
124
+          <nz-range-picker [(ngModel)]="searchCriteria.dateRange" (ngModelChange)="changeDate($event)"></nz-range-picker>
125
+        </div>
126
+        
72 127
       </div>
73
-      <div nz-col nzXl="8" class="list-template__btns">
128
+      <div nz-col nzXl="6" class="list-template__btns">
74 129
         <button
75 130
           nz-button
76 131
           class="btn default"
@@ -87,7 +142,8 @@
87 142
       </div>
88 143
     </div>
89 144
     <div class="list-template__checkBoxes">
90
-      <nz-checkbox-group [(ngModel)]="checkOptionsOne" (ngModelChange)="log(checkOptionsOne)"></nz-checkbox-group>
145
+      <div><nz-checkbox-group [(ngModel)]="checkOptionsOne" (ngModelChange)="log(checkOptionsOne)"></nz-checkbox-group></div>
146
+      <div>合计:{{listLength}}</div>
91 147
     </div>
92 148
     <div class="list-template__bottom">
93 149
       <nz-table

+ 4 - 1
src/app/views/specimen-search/specimen-search.component.less

@@ -1,5 +1,8 @@
1 1
 @import "../../../../src/theme.less";
2
-
2
+.list-template__checkBoxes{
3
+  display: flex;
4
+  justify-content: space-between;
5
+}
3 6
 .save {
4 7
   position: fixed;
5 8
   left: 0;

+ 104 - 8
src/app/views/specimen-search/specimen-search.component.ts

@@ -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)

+ 1 - 1
src/main.ts

@@ -8,7 +8,7 @@ if (environment.production) {
8 8
   enableProdMode();
9 9
   if (window) {
10 10
     window.console.log = function () { };
11
-    console.info('v2.4.8');
11
+    console.info('v2.4.9');
12 12
   }
13 13
 }
14 14
 platformBrowserDynamic().bootstrapModule(AppModule)