Browse Source

标本信息改造

seimin 2 years ago
parent
commit
ca6188d79c

+ 24 - 0
src/app/views/specimen-search/specimen-search.component.html

@@ -45,6 +45,30 @@
45 45
             [(ngModel)]="searchCriteria.parent"
46 46
           />
47 47
         </div>
48
+        <div class="list-template__searchItem">
49
+          <span class="label">状态:</span>
50
+          <nz-select
51
+            [nzDropdownMatchSelectWidth]="false"
52
+            class="formItem"
53
+            nzServerSearch
54
+            nzShowSearch
55
+            nzAllowClear
56
+            nzPlaceHolder="请选择状态"
57
+            [(ngModel)]="searchCriteria.speState"
58
+            (nzOpenChange)="changeSearch1($event)"
59
+          >
60
+            <ng-container *ngFor="let data of types">
61
+              <nz-option
62
+                *ngIf="!isLoading1"
63
+                nzLabel="{{ data.name }}"
64
+                nzValue="{{ data.id }}"
65
+              ></nz-option>
66
+            </ng-container>
67
+            <nz-option *ngIf="isLoading1" nzDisabled nzCustomContent>
68
+              <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
69
+            </nz-option>
70
+          </nz-select>
71
+        </div>
48 72
       </div>
49 73
       <div nz-col nzXl="8" class="list-template__btns">
50 74
         <button

+ 101 - 76
src/app/views/specimen-search/specimen-search.component.ts

@@ -1,45 +1,51 @@
1
-import { Component, OnInit } from '@angular/core';
2
-import { MainService } from "../../services/main.service"
3
-import { ToolService } from '../../services/tool.service';
4
-import { Subject } from 'rxjs';
5
-import { debounceTime } from 'rxjs/operators';
1
+import { Component, OnInit } from "@angular/core";
2
+import { MainService } from "../../services/main.service";
3
+import { ToolService } from "../../services/tool.service";
4
+import { Subject } from "rxjs";
5
+import { debounceTime } from "rxjs/operators";
6 6
 @Component({
7
-  selector: 'app-specimen-search',
8
-  templateUrl: './specimen-search.component.html',
9
-  styleUrls: ['./specimen-search.component.less']
7
+  selector: "app-specimen-search",
8
+  templateUrl: "./specimen-search.component.html",
9
+  styleUrls: ["./specimen-search.component.less"],
10 10
 })
11 11
 export class SpecimenSearchComponent implements OnInit {
12
+  constructor(private mainService: MainService, private tool: ToolService) {}
12 13
 
13
-  constructor(
14
-    private mainService: MainService,
15
-    private tool: ToolService
16
-  ) { }
17
-
18
-  searchCriteria = {//搜索条件
19
-    scode: '',
20
-    parent: '',
14
+  searchCriteria = {
15
+    //搜索条件
16
+    scode: "",
17
+    parent: "",
21 18
     hospital: null,
22
-    department: null
19
+    department: null,
20
+    speState: null,
23 21
   };
24
-  departmentSearch = [];// 院区下的科室列表(搜索框)
25
-  allHospital: any = [];//院区下拉框
26
-  listOfData: any[] = [];//表格数据
27
-  pageIndex: number = 1;//表格当前页码
28
-  pageSize: number = 10;//表格每页展示条数
29
-  listLength: number = 10;//表格总数据量
22
+  types = []; // 类型列表(搜索框)
23
+  departmentSearch = []; // 院区下的科室列表(搜索框)
24
+  allHospital: any = []; //院区下拉框
25
+  listOfData: any[] = []; //表格数据
26
+  pageIndex: number = 1; //表格当前页码
27
+  pageSize: number = 10; //表格每页展示条数
28
+  listLength: number = 10; //表格总数据量
30 29
   changeInpSubject = new Subject();
31 30
   ngOnInit() {
32
-    this.changeInpSubject.pipe(debounceTime(500)).subscribe(v => {
31
+    this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
33 32
       this.searchDepartment(v[0], v[1]);
34
-    })
35
-    this.getAllHospital()
33
+    });
34
+    this.getAllHospital();
35
+  }
36
+  // 搜索类型
37
+  isLoading1 = false;
38
+  searchTypes() {
39
+    this.isLoading1 = true;
40
+    this.mainService.getDictionary("list", "speState").subscribe((res) => {
41
+      this.isLoading1 = false;
42
+      this.types = res;
43
+    });
36 44
   }
37 45
   // 清空标本
38 46
   delModal: boolean = false; //删除模态框
39 47
   tipsMsg1: string; //提示框信息
40
-  showDelModal(
41
-    tipsMsg1: string
42
-  ) {
48
+  showDelModal(tipsMsg1: string) {
43 49
     this.delModal = true;
44 50
     this.tipsMsg1 = tipsMsg1;
45 51
   }
@@ -52,7 +58,7 @@ export class SpecimenSearchComponent implements OnInit {
52 58
   confirmDel() {
53 59
     this.btnLoading = true;
54 60
     this.mainService
55
-      .coopDataM("api/emptySpecimenData", {"hosId":1,"isEmpty":'ok'})
61
+      .coopDataM("api/emptySpecimenData", { hosId: 1, isEmpty: "ok" })
56 62
       .subscribe((data) => {
57 63
         this.btnLoading = false;
58 64
         this.delModal = false;
@@ -79,36 +85,44 @@ export class SpecimenSearchComponent implements OnInit {
79 85
     this.getList(0);
80 86
   }
81 87
   // 查看标本历史记录
82
-  historyPromptModalShow = false;//标本历史记录弹窗开关
83
-  scode = '';//查看历史记录携带
88
+  historyPromptModalShow = false; //标本历史记录弹窗开关
89
+  scode = ""; //查看历史记录携带
84 90
   viewSpecimenHistory(data) {
85 91
     this.scode = data.scode;
86 92
     this.historyPromptModalShow = true;
87 93
   }
88 94
   // 关闭标本历史记录弹窗
89 95
   closeModelHistory(e) {
90
-    this.historyPromptModalShow = JSON.parse(e).show
96
+    this.historyPromptModalShow = JSON.parse(e).show;
91 97
   }
92 98
   // 重置
93 99
   reset() {
94
-    this.searchCriteria = {//搜索条件
95
-      scode: '',
96
-      parent: '',
97
-      hospital: this.allHospital[0] ? this.allHospital[0]['id'] + '' : null,
98
-      department: null
100
+    this.searchCriteria = {
101
+      //搜索条件
102
+      scode: "",
103
+      parent: "",
104
+      hospital: this.allHospital[0] ? this.allHospital[0]["id"] + "" : null,
105
+      department: null,
106
+      speState: null,
99 107
     };
100 108
     this.getList(1);
101 109
   }
102 110
   // 选择院区
103 111
   changeHospital(id, type) {
104
-    if (type === 'search') {
112
+    if (type === "search") {
105 113
       this.searchCriteria.department = null;
106 114
     }
107 115
   }
108 116
   // 打开搜索框
117
+  changeSearch1(flag) {
118
+    if (flag) {
119
+      this.searchTypes();
120
+    }
121
+  }
122
+  // 打开搜索框
109 123
   changeSearch(flag) {
110 124
     if (flag) {
111
-      this.changeInp('no', 'search');
125
+      this.changeInp("no", "search");
112 126
     }
113 127
   }
114 128
   // 边输边搜节流阀
@@ -117,11 +131,11 @@ export class SpecimenSearchComponent implements OnInit {
117 131
     if (!dept) {
118 132
       return;
119 133
     }
120
-    if (dept === 'no') {
121
-      dept = '';
134
+    if (dept === "no") {
135
+      dept = "";
122 136
     }
123 137
     this.isLoading = true;
124
-    this.changeInpSubject.next([dept, type])
138
+    this.changeInpSubject.next([dept, type]);
125 139
   }
126 140
   // 搜索科室
127 141
   snum = 0;
@@ -130,24 +144,26 @@ export class SpecimenSearchComponent implements OnInit {
130 144
       department: {
131 145
         dept,
132 146
         hospital: {
133
-          id: this.searchCriteria.hospital
134
-        }
147
+          id: this.searchCriteria.hospital,
148
+        },
135 149
       },
136 150
       idx: 0,
137
-      sum: 20
138
-    }
151
+      sum: 20,
152
+    };
139 153
     this.snum++;
140
-    this.mainService.getFetchDataList('data', 'department', data).subscribe(data => {
141
-      this.snum--;
142
-      if (data.status == 200) {
143
-        if (type === 'search') {
144
-          if (this.snum === 0) {
145
-            this.isLoading = false;
154
+    this.mainService
155
+      .getFetchDataList("data", "department", data)
156
+      .subscribe((data) => {
157
+        this.snum--;
158
+        if (data.status == 200) {
159
+          if (type === "search") {
160
+            if (this.snum === 0) {
161
+              this.isLoading = false;
162
+            }
163
+            this.departmentSearch = data.list;
146 164
           }
147
-          this.departmentSearch = data.list;
148 165
         }
149
-      }
150
-    })
166
+      });
151 167
   }
152 168
 
153 169
   // 获取所有院区
@@ -158,38 +174,47 @@ export class SpecimenSearchComponent implements OnInit {
158 174
    */
159 175
   getAllHospital() {
160 176
     this.allHospital = [this.tool.getCurrentHospital()];
161
-    this.searchCriteria.hospital = this.tool.getCurrentHospital().id + '';
177
+    this.searchCriteria.hospital = this.tool.getCurrentHospital().id + "";
162 178
     this.getList(1);
163
-    this.changeHospital(this.searchCriteria.hospital, 'search');
179
+    this.changeHospital(this.searchCriteria.hospital, "search");
164 180
   }
165 181
 
166
-
167 182
   // 表格数据
168 183
   loading1 = false;
169 184
   getList(type) {
170 185
     if (type == 1) {
171
-      this.pageIndex = 1
186
+      this.pageIndex = 1;
172 187
     }
173 188
     let postData = {
174 189
       idx: this.pageIndex - 1,
175 190
       sum: this.pageSize,
176 191
       specimen: {
177
-        "hosId": this.searchCriteria.hospital,
178
-        "sickRoom": {
179
-          "id": this.searchCriteria.department
180
-        },
181
-        "scode": !this.searchCriteria.scode ? null : this.searchCriteria.scode,
182
-        "keyWord": !this.searchCriteria.parent ? null : this.searchCriteria.parent
183
-      }
184
-    }
192
+        hosId: this.searchCriteria.hospital,
193
+        sickRoom: this.searchCriteria.department
194
+          ? {
195
+              id: this.searchCriteria.department,
196
+            }
197
+          : undefined,
198
+        scode: !this.searchCriteria.scode
199
+          ? undefined
200
+          : this.searchCriteria.scode,
201
+        keyWord: !this.searchCriteria.parent
202
+          ? undefined
203
+          : this.searchCriteria.parent,
204
+        speState: this.searchCriteria.speState
205
+          ? { id: this.searchCriteria.speState }
206
+          : undefined,
207
+      },
208
+    };
185 209
     this.loading1 = true;
186
-    this.mainService.getFetchDataList('simple/data', 'specimen', postData).subscribe(data => {
187
-      this.loading1 = false;
188
-      if (data.status == 200) {
189
-        this.listOfData = data.list;
190
-        this.listLength = data.totalNum;
191
-      }
192
-    })
210
+    this.mainService
211
+      .getFetchDataList("simple/data", "specimen", postData)
212
+      .subscribe((data) => {
213
+        this.loading1 = false;
214
+        if (data.status == 200) {
215
+          this.listOfData = data.list;
216
+          this.listLength = data.totalNum;
217
+        }
218
+      });
193 219
   }
194 220
 }
195
-