Browse Source

患者新增修改

seimin 2 months ago
parent
commit
c78768fbbe

+ 212 - 36
src/app/views/patient-search/patient-search.component.html

@@ -2,33 +2,59 @@
2
   <div class="list-template__content">
2
   <div class="list-template__content">
3
     <div class="list-template__top" nz-row>
3
     <div class="list-template__top" nz-row>
4
       <div nz-col nzXl='16' class="list-template__searchBox">
4
       <div nz-col nzXl='16' class="list-template__searchBox">
5
+        <div class="list-template__searchItem">
6
+          <span class="label">院区:</span>
7
+          <nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" nzPlaceHolder="请选择院区" [(ngModel)]="searchCriteria.hosId" (ngModelChange)="changeHospitalSearch($event)">
8
+            <ng-container *ngFor="let option of hospitalSearchList">
9
+              <nz-option *ngIf="!isLoading" [nzLabel]="option.hosName" [nzValue]="option.id"></nz-option>
10
+            </ng-container>
11
+            <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
12
+              <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
13
+            </nz-option>
14
+          </nz-select>
15
+        </div>
5
         <div class="list-template__searchItem">
16
         <div class="list-template__searchItem">
6
           <span class="label">患者姓名:</span>
17
           <span class="label">患者姓名:</span>
7
           <input nz-input class="formItem" placeholder="请输入患者姓名" [(ngModel)]="searchCriteria.patientName" />
18
           <input nz-input class="formItem" placeholder="请输入患者姓名" [(ngModel)]="searchCriteria.patientName" />
8
         </div>
19
         </div>
9
         <div class="list-template__searchItem">
20
         <div class="list-template__searchItem">
10
-          <span class="label">床号:</span>
11
-          <input nz-input class="formItem" placeholder="请输入床号" [(ngModel)]="searchCriteria.bedNum" />
21
+          <span class="label">当前科室:</span>
22
+          <nz-select [nzDropdownMatchSelectWidth]="false" class="formItem" nzServerSearch nzShowSearch nzAllowClear nzPlaceHolder="请选择当前科室" [(ngModel)]="searchCriteria.department" (nzOnSearch)="changeInp($event, 'departmentSearch')" (nzOpenChange)="openDepartmentSearch($event)">
23
+            <ng-container *ngFor="let data of deptSearchList">
24
+              <nz-option *ngIf="!isLoading" [nzLabel]="data.dept" [nzValue]="data.id"></nz-option>
25
+            </ng-container>
26
+            <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
27
+              <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
28
+            </nz-option>
29
+          </nz-select>
12
         </div>
30
         </div>
13
         <div class="list-template__searchItem">
31
         <div class="list-template__searchItem">
14
-          <span class="label">当前科室:</span>
15
-          <nz-select
16
-            [nzDropdownMatchSelectWidth]="false"
17
-            class="formItem"
18
-            nzServerSearch
19
-            nzShowSearch
20
-            nzAllowClear
21
-            nzPlaceHolder="请选择当前科室"
22
-            [(ngModel)]="searchCriteria.department"
23
-            (nzOnSearch)="changeInp($event, 'search')"
24
-            (nzOpenChange)="changeSearch($event)"
25
-          >
26
-            <ng-container *ngFor="let data of departmentSearch">
27
-              <nz-option
28
-                *ngIf="!isLoading"
29
-                nzLabel="{{ data.dept }}"
30
-                nzValue="{{ data.id }}"
31
-              ></nz-option>
32
+          <span class="label">患者类别:</span>
33
+          <nz-select [nzDropdownMatchSelectWidth]="false" class="formItem" nzAllowClear nzPlaceHolder="请选择患者类别" [(ngModel)]="searchCriteria.patientType">
34
+            <ng-container *ngFor="let data of patientTypeList">
35
+              <nz-option *ngIf="!isLoading" [nzLabel]="data.name" [nzValue]="data.id"></nz-option>
36
+            </ng-container>
37
+            <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
38
+              <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
39
+            </nz-option>
40
+          </nz-select>
41
+        </div>
42
+        <div class="list-template__searchItem">
43
+          <span class="label">护理等级:</span>
44
+          <nz-select [nzDropdownMatchSelectWidth]="false" class="formItem" nzAllowClear nzPlaceHolder="请选择护理等级" [(ngModel)]="searchCriteria.careLevel">
45
+            <ng-container *ngFor="let data of careLevelList">
46
+              <nz-option *ngIf="!isLoading" [nzLabel]="data.name" [nzValue]="data.id"></nz-option>
47
+            </ng-container>
48
+            <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
49
+              <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
50
+            </nz-option>
51
+          </nz-select>
52
+        </div>
53
+        <div class="list-template__searchItem">
54
+          <span class="label">病情级别:</span>
55
+          <nz-select [nzDropdownMatchSelectWidth]="false" class="formItem" nzAllowClear nzPlaceHolder="请选择病情级别" [(ngModel)]="searchCriteria.illnessState">
56
+            <ng-container *ngFor="let data of illnessStateList">
57
+              <nz-option *ngIf="!isLoading" [nzLabel]="data.name" [nzValue]="data.id"></nz-option>
32
             </ng-container>
58
             </ng-container>
33
             <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
59
             <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
34
               <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
60
               <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
@@ -39,6 +65,7 @@
39
       <div nz-col nzXl="8" class="list-template__btns">
65
       <div nz-col nzXl="8" class="list-template__btns">
40
         <button nz-button class="btn default" (click)='reset()'>重置</button>
66
         <button nz-button class="btn default" (click)='reset()'>重置</button>
41
         <button nz-button class="btn default ml8" (click)='getList(1)'>搜索</button>
67
         <button nz-button class="btn default ml8" (click)='getList(1)'>搜索</button>
68
+        <button nz-button *ngIf="coopBtns.add" class="btn ml8 default" (click)="showModal()">新增</button>
42
       </div>
69
       </div>
43
     </div>
70
     </div>
44
     <div class="list-template__bottom">
71
     <div class="list-template__bottom">
@@ -46,26 +73,38 @@
46
         [nzLoading]="loading1">
73
         [nzLoading]="loading1">
47
         <thead>
74
         <thead>
48
           <tr class="thead">
75
           <tr class="thead">
49
-            <th nzWidth="10%">序号</th>
50
-            <th nzWidth="15%">患者姓名</th>
51
-            <th nzWidth="15%">住院号</th>
52
-            <th nzWidth="15%">床号</th>
53
-            <th nzWidth="15%">当前科室</th>
54
-            <th nzWidth="15%">护理等级</th>
55
-            <th nzWidth="15%">病情级别</th>
56
-            <!-- <th nzWidth="9%">操作</th> -->
76
+            <th nzWidth="8%">患者类别</th>
77
+            <th nzWidth="8%">患者姓名</th>
78
+            <th nzWidth="8%">住院号</th>
79
+            <th nzWidth="8%">条码号</th>
80
+            <th nzWidth="8%">床号</th>
81
+            <th nzWidth="10%">院区</th>
82
+            <th nzWidth="10%">当前科室</th>
83
+            <th nzWidth="8%">护理等级</th>
84
+            <th nzWidth="8%">病情级别</th>
85
+            <th nzWidth="8%">年龄</th>
86
+            <th nzWidth="8%">性别</th>
87
+            <th nzWidth="8%">操作</th>
57
           </tr>
88
           </tr>
58
         </thead>
89
         </thead>
59
         <tbody>
90
         <tbody>
60
           <tr *ngFor="let data of listOfData;let i = index">
91
           <tr *ngFor="let data of listOfData;let i = index">
61
-            <td>{{i+(pageIndex-1) * pageSize + 1}}</td>
62
-            <td>{{ data.patientName||'-' }}</td>
63
-            <td>{{ data.residenceNo||'-' }}</td>
64
-            <td>{{ data.bedNum||'-' }}</td>
65
-            <td>{{data.department?data.department.dept:'-'}}</td>
66
-            <td>{{data.careLevel?data.careLevel.name:'-'}}</td>
67
-            <td>{{data.illnessState?data.illnessState.name:'-'}}</td>
68
-            <!-- <td><button (click)="viewSpecimenHistory(data)">查看</button></td> -->
92
+            <td>{{ data.patientType?.name }}</td>
93
+            <td>{{ data.patientName }}</td>
94
+            <td>{{ data.residenceNo }}</td>
95
+            <td>{{ data.barCode }}</td>
96
+            <td>{{ data.bedNum }}</td>
97
+            <td>{{ data.hospitalDTO?.hosName }}</td>
98
+            <td>{{ data.department?.dept }}</td>
99
+            <td>{{ data.careLevel?.name }}</td>
100
+            <td>{{ data.illnessState?.name }}</td>
101
+            <td>{{ data.age }}</td>
102
+            <td>{{ data.gender?.name }}</td>
103
+            <td>
104
+              <div class="coop">
105
+                <span *ngIf="coopBtns.edit" (click)="edit(data)">编辑</span>
106
+              </div>
107
+            </td>
69
           </tr>
108
           </tr>
70
         </tbody>
109
         </tbody>
71
       </nz-table>
110
       </nz-table>
@@ -77,3 +116,140 @@
77
     </div>
116
     </div>
78
   </div>
117
   </div>
79
 </div>
118
 </div>
119
+
120
+<!-- 新增/编辑模态框 -->
121
+<div class="save add display_flex align-items_center justify-content_flex-center" *ngIf="modal">
122
+  <div class="modalBody">
123
+    <div class="title">{{add?"新增":"编辑"}}<i class="icon_transport transport-guanbi" (click)="hideModal()"></i>
124
+    </div>
125
+    <overlay-scrollbars #osComponentRef1 class="content">
126
+      <form nz-form [formGroup]="validateForm" class="addForm" (ngSubmit)="submitForm()">
127
+        <nz-form-item>
128
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="patientName">患者姓名</nz-form-label>
129
+          <nz-form-control nzErrorTip="请填写患者姓名!">
130
+            <nz-input-group>
131
+              <input type="text" nz-input formControlName="patientName" placeholder="请填写患者姓名" />
132
+            </nz-input-group>
133
+          </nz-form-control>
134
+        </nz-form-item>
135
+        <nz-form-item>
136
+          <nz-form-label style="line-height:40px;" [nzSm]="3" [nzXs]="24" nzFor="gender">性别</nz-form-label>
137
+          <nz-form-control nzErrorTip="请选择性别!">
138
+            <nz-radio-group type="gender" formControlName="gender">
139
+              <label nz-radio [nzValue]="data.id" *ngFor="let data of genderList">{{data.name}}</label>
140
+            </nz-radio-group>
141
+          </nz-form-control>
142
+        </nz-form-item>
143
+        <nz-form-item>
144
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="age">年龄</nz-form-label>
145
+          <nz-form-control nzErrorTip="请填写年龄!">
146
+            <nz-input-group>
147
+              <nz-input-number class="w100" formControlName="age" placeholder="请填写年龄" [nzMin]="0" [nzStep]="1" [nzPrecision]="0"></nz-input-number>
148
+            </nz-input-group>
149
+          </nz-form-control>
150
+        </nz-form-item>
151
+        <nz-form-item>
152
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="residenceNo">住院号</nz-form-label>
153
+          <nz-form-control nzErrorTip="请填写住院号!">
154
+            <nz-input-group>
155
+              <input type="text" nz-input formControlName="residenceNo" placeholder="请填写住院号" />
156
+            </nz-input-group>
157
+          </nz-form-control>
158
+        </nz-form-item>
159
+        <nz-form-item>
160
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="barCode">条码号</nz-form-label>
161
+          <nz-form-control nzErrorTip="请填写条码号!">
162
+            <nz-input-group>
163
+              <input type="text" nz-input formControlName="barCode" placeholder="请填写条码号" />
164
+            </nz-input-group>
165
+          </nz-form-control>
166
+        </nz-form-item>
167
+        <nz-form-item>
168
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="bedNum">床号</nz-form-label>
169
+          <nz-form-control nzErrorTip="请填写床号!">
170
+            <nz-input-group>
171
+              <input type="text" nz-input formControlName="bedNum" placeholder="请填写床号" />
172
+            </nz-input-group>
173
+          </nz-form-control>
174
+        </nz-form-item>
175
+        <nz-form-item>
176
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="hosId">院区</nz-form-label>
177
+          <nz-form-control nzErrorTip="请选择院区!">
178
+            <nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" nzPlaceHolder="请选择院区" formControlName="hosId" (ngModelChange)="changeHospital($event)">
179
+            <ng-container *ngFor="let option of hospitalList">
180
+              <nz-option *ngIf="!isLoading" [nzLabel]="option.hosName" [nzValue]="option.id"></nz-option>
181
+            </ng-container>
182
+            <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
183
+              <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
184
+            </nz-option>
185
+          </nz-select>
186
+          </nz-form-control>
187
+        </nz-form-item>
188
+        <nz-form-item>
189
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="department">当前科室</nz-form-label>
190
+          <nz-form-control nzErrorTip="请选择当前科室!">
191
+            <nz-select [nzDropdownMatchSelectWidth]="false" formControlName="department" nzShowSearch nzAllowClear nzPlaceHolder="请选择当前科室" nzServerSearch (nzOnSearch)="changeInp($event, 'department')" (nzOpenChange)="openDepartment($event)">
192
+              <ng-container *ngFor="let data of deptList">
193
+                <nz-option *ngIf="!isLoading" [nzLabel]="data.dept" [nzValue]="data.id">
194
+                </nz-option>
195
+              </ng-container>
196
+              <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
197
+                <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
198
+              </nz-option>
199
+            </nz-select>
200
+          </nz-form-control>
201
+        </nz-form-item>
202
+        <nz-form-item>
203
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="careLevel">护理等级</nz-form-label>
204
+          <nz-form-control nzErrorTip="请选择护理等级!">
205
+            <nz-select [nzDropdownMatchSelectWidth]="false" formControlName="careLevel" nzAllowClear nzPlaceHolder="请选择护理等级">
206
+              <ng-container *ngFor="let data of careLevelList">
207
+                <nz-option *ngIf="!isLoading" [nzLabel]="data.name" [nzValue]="data.id">
208
+                </nz-option>
209
+              </ng-container>
210
+              <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
211
+                <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
212
+              </nz-option>
213
+            </nz-select>
214
+          </nz-form-control>
215
+        </nz-form-item>
216
+        <nz-form-item>
217
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="illnessState">病情级别</nz-form-label>
218
+          <nz-form-control nzErrorTip="请选择病情级别!">
219
+            <nz-select [nzDropdownMatchSelectWidth]="false" formControlName="illnessState" nzAllowClear nzPlaceHolder="请选择病情级别">
220
+              <ng-container *ngFor="let data of illnessStateList">
221
+                <nz-option *ngIf="!isLoading" [nzLabel]="data.name" [nzValue]="data.id">
222
+                </nz-option>
223
+              </ng-container>
224
+              <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
225
+                <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
226
+              </nz-option>
227
+            </nz-select>
228
+          </nz-form-control>
229
+        </nz-form-item>
230
+        <nz-form-item>
231
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="patientType">患者类别</nz-form-label>
232
+          <nz-form-control nzErrorTip="请选择患者类别!">
233
+            <nz-select [nzDropdownMatchSelectWidth]="false" formControlName="patientType" nzAllowClear nzPlaceHolder="请选择患者类别">
234
+              <ng-container *ngFor="let data of patientTypeList">
235
+                <nz-option *ngIf="!isLoading" [nzLabel]="data.name" [nzValue]="data.id">
236
+                </nz-option>
237
+              </ng-container>
238
+              <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
239
+                <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
240
+              </nz-option>
241
+            </nz-select>
242
+          </nz-form-control>
243
+        </nz-form-item>
244
+      </form>
245
+    </overlay-scrollbars>
246
+    <div class="display_flex justify-content_flex-center">
247
+      <button nzType="primary" nz-button (click)="submitForm()" [nzLoading]="btnLoading">确认</button>
248
+      <button class="btn cancel" nz-button nzType="default" (click)="hideModal()">取消</button>
249
+    </div>
250
+  </div>
251
+</div>
252
+
253
+<!-- 操作成功/失败提示框 -->
254
+<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
255
+  [info]="promptInfo"></app-prompt-modal>

+ 1 - 1
src/app/views/patient-search/patient-search.component.less

@@ -103,7 +103,7 @@
103
 
103
 
104
         .addForm {
104
         .addForm {
105
           .ant-form-item {
105
           .ant-form-item {
106
-            margin-bottom: 15px;
106
+            margin-bottom: 8px;
107
 
107
 
108
             .ant-form-item-label {
108
             .ant-form-item-label {
109
               line-height: 14px;
109
               line-height: 14px;

+ 302 - 50
src/app/views/patient-search/patient-search.component.ts

@@ -3,6 +3,8 @@ import { MainService } from "src/app/services/main.service";
3
 import { ToolService } from "src/app/services/tool.service";
3
 import { ToolService } from "src/app/services/tool.service";
4
 import { Subject } from 'rxjs';
4
 import { Subject } from 'rxjs';
5
 import { debounceTime } from 'rxjs/operators';
5
 import { debounceTime } from 'rxjs/operators';
6
+import { ActivatedRoute } from '@angular/router';
7
+import { FormGroup, FormBuilder, Validators } from '@angular/forms';
6
 
8
 
7
 @Component({
9
 @Component({
8
   selector: "app-patient-search",
10
   selector: "app-patient-search",
@@ -10,96 +12,142 @@ import { debounceTime } from 'rxjs/operators';
10
   styleUrls: ["./patient-search.component.less"],
12
   styleUrls: ["./patient-search.component.less"],
11
 })
13
 })
12
 export class PatientSearchComponent implements OnInit {
14
 export class PatientSearchComponent implements OnInit {
13
-  constructor(private mainService: MainService, private tool: ToolService) {}
14
-
15
-  searchCriteria = {
16
-    //搜索条件
17
-    patientName: "",
18
-    bedNum: "",
19
-    hospital: null,
20
-    department: null,
21
-  };
22
-  allHospital: any = []; //院区下拉框
15
+  constructor(
16
+    private mainService: MainService,
17
+    private tool: ToolService,
18
+    private route: ActivatedRoute,
19
+    private fb: FormBuilder,
20
+  ) {}
21
+
22
+  hosId = this.tool.getCurrentHospital().id; //当前院区
23
+
24
+  searchCriteria:any = {};
23
   listOfData: any[] = []; //表格数据
25
   listOfData: any[] = []; //表格数据
24
   pageIndex: number = 1; //表格当前页码
26
   pageIndex: number = 1; //表格当前页码
25
   pageSize: number = 10; //表格每页展示条数
27
   pageSize: number = 10; //表格每页展示条数
26
   listLength: number = 10; //表格总数据量
28
   listLength: number = 10; //表格总数据量
27
   changeInpSubject = new Subject();
29
   changeInpSubject = new Subject();
30
+
31
+  // 初始化增删改按钮
32
+  coopBtns: any = {};
33
+
28
   ngOnInit() {
34
   ngOnInit() {
29
     this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
35
     this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
30
-      this.searchDepartment(v[0], v[1]);
36
+      if(v[1] === 'department'){
37
+        this.getDepartmentList(v[0]);
38
+      }else if(v[1] === 'departmentSearch'){
39
+        this.getDepartmentSearchList(v[0]);
40
+      }
31
     });
41
     });
32
-    this.getAllHospital();
42
+    this.coopBtns = this.tool.initCoopBtns(this.route);
43
+    this.searchCriteria.hosId = this.tool.getCurrentHospital().id;
44
+    this.getList(1);
45
+    this.getGenderList();
46
+    this.getCareLevelList();
47
+    this.getIllnessStateList();
48
+    this.getPatientTypeList();
49
+    this.getHospitalList();
50
+    this.getHospitalSearchList();
33
   }
51
   }
34
-  // 选择院区
35
-  changeHospital(id, type) {
36
-    if (type === "search") {
37
-      this.searchCriteria.department = null;
38
-    }
52
+
53
+  // 获取院区列表
54
+  hospitalList = [];
55
+  getHospitalList() {
56
+    this.hospitalList = this.tool.getHospitalList();
57
+  }
58
+
59
+  changeHospital(e){
60
+    this.deptList = [];
61
+    this.validateForm.controls.department.setValue(null);
39
   }
62
   }
63
+
64
+  // 获取院区列表
65
+  hospitalSearchList = [];
66
+  getHospitalSearchList() {
67
+    this.hospitalSearchList = this.tool.getHospitalList();
68
+  }
69
+
70
+  changeHospitalSearch(e){
71
+    this.deptSearchList = [];
72
+    this.searchCriteria.department = undefined;
73
+  }
74
+
40
   // 搜索科室
75
   // 搜索科室
41
-  departmentSearch = []; // 院区下的科室列表(搜索框)
42
-  deptKey = "";
76
+  deptList = []; // 院区下的科室列表(搜索框)
43
   isLoading = false;
77
   isLoading = false;
44
-  searchDepartment(dept, type) {
78
+  getDepartmentList(dept) {
45
     let data = {
79
     let data = {
46
       department: {
80
       department: {
81
+        searchType: 1,// 简单查询
47
         dept,
82
         dept,
48
         hospital: {
83
         hospital: {
49
-          id: this.searchCriteria.hospital,
84
+          id: this.validateForm.value.hosId,
50
         },
85
         },
51
       },
86
       },
52
       idx: 0,
87
       idx: 0,
53
       sum: 10,
88
       sum: 10,
54
     };
89
     };
55
     this.mainService
90
     this.mainService
56
-      .getFetchDataList("data", "department", data)
91
+      .getFetchDataList("simple/data", "department", data)
57
       .subscribe((data) => {
92
       .subscribe((data) => {
93
+        this.isLoading = false;
58
         if (data.status == 200) {
94
         if (data.status == 200) {
59
-          if (type === "search") {
60
-            if (this.deptKey === dept) {
61
-              this.isLoading = false;
62
-              this.departmentSearch = data.list;
63
-            }
64
-          }
95
+          this.deptList = data.list;
96
+        }else{
97
+          this.deptList = [];
98
+        }
99
+      });
100
+  }
101
+
102
+  // 搜索科室
103
+  deptSearchList = []; // 院区下的科室列表(搜索框)
104
+  getDepartmentSearchList(dept) {
105
+    let data = {
106
+      department: {
107
+        searchType: 1,// 简单查询
108
+        dept,
109
+        hospital: {
110
+          id: this.searchCriteria.hosId,
111
+        },
112
+      },
113
+      idx: 0,
114
+      sum: 10,
115
+    };
116
+    this.mainService
117
+      .getFetchDataList("simple/data", "department", data)
118
+      .subscribe((data) => {
119
+        this.isLoading = false;
120
+        if (data.status == 200) {
121
+          this.deptSearchList = data.list;
122
+        }else{
123
+          this.deptSearchList = [];
65
         }
124
         }
66
       });
125
       });
67
   }
126
   }
68
   changeInp(dept, type) {
127
   changeInp(dept, type) {
69
-    if (!dept) {
70
-      return;
71
-    }
72
-    if (dept === "no") {
73
-      dept = "";
74
-    }
75
-    this.deptKey = dept;
76
     this.isLoading = true;
128
     this.isLoading = true;
77
     this.changeInpSubject.next([dept, type]);
129
     this.changeInpSubject.next([dept, type]);
78
   }
130
   }
79
   // 打开搜索框
131
   // 打开搜索框
80
-  changeSearch(flag) {
132
+  openDepartment(flag) {
81
     if (flag) {
133
     if (flag) {
82
-      this.changeInp("no", "search");
134
+      this.changeInp("", "department");
135
+    }
136
+  }
137
+  // 打开搜索框
138
+  openDepartmentSearch(flag) {
139
+    if (flag) {
140
+      this.changeInp("", "departmentSearch");
83
     }
141
     }
84
   }
142
   }
85
   // 重置
143
   // 重置
86
   reset() {
144
   reset() {
87
     this.searchCriteria = {
145
     this.searchCriteria = {
88
-      //搜索条件
89
-      patientName: "",
90
-      bedNum: "",
91
-      hospital: this.allHospital[0] ? this.allHospital[0]["id"] + "" : null,
92
-      department: null,
146
+      hosId: this.tool.getCurrentHospital().id,
93
     };
147
     };
94
     this.getList(1);
148
     this.getList(1);
95
   }
149
   }
96
 
150
 
97
-  // 获取所有院区
98
-  getAllHospital() {
99
-    this.allHospital = [this.tool.getCurrentHospital()];
100
-    this.searchCriteria.hospital = this.tool.getCurrentHospital().id + "";
101
-    this.getList(1);
102
-  }
103
   // 查看标本历史记录
151
   // 查看标本历史记录
104
   historyPromptModalShow = false; //标本历史记录弹窗开关
152
   historyPromptModalShow = false; //标本历史记录弹窗开关
105
   scode = ""; //查看历史记录携带
153
   scode = ""; //查看历史记录携带
@@ -121,10 +169,12 @@ export class PatientSearchComponent implements OnInit {
121
     let postData = {
169
     let postData = {
122
       idx: this.pageIndex - 1,
170
       idx: this.pageIndex - 1,
123
       sum: this.pageSize,
171
       sum: this.pageSize,
124
-      hosId: this.searchCriteria.hospital,
172
+      hosId: this.searchCriteria.hosId,
125
       patientName: this.searchCriteria.patientName,
173
       patientName: this.searchCriteria.patientName,
126
-      bedNum: this.searchCriteria.bedNum,
127
       department: this.searchCriteria.department || undefined,
174
       department: this.searchCriteria.department || undefined,
175
+      careLevel: this.searchCriteria.careLevel || undefined,
176
+      illnessState: this.searchCriteria.illnessState || undefined,
177
+      patientType: this.searchCriteria.patientType || undefined,
128
     };
178
     };
129
     this.loading1 = true;
179
     this.loading1 = true;
130
     this.mainService.listMsgByMain('listPatient',postData).subscribe((data) => {
180
     this.mainService.listMsgByMain('listPatient',postData).subscribe((data) => {
@@ -135,4 +185,206 @@ export class PatientSearchComponent implements OnInit {
135
       }
185
       }
136
     });
186
     });
137
   }
187
   }
188
+
189
+  // 新增弹框
190
+  modal: boolean = false; //新增/编辑模态框
191
+  add: boolean; //true:新增;false:编辑
192
+  validateForm: FormGroup; //新增/编辑表单
193
+  showModal() {
194
+    this.add = true;
195
+    this.modal = true;
196
+    this.initForm();
197
+    this.validateForm.controls.hosId.setValue(this.searchCriteria.hosId);
198
+  }
199
+  hideModal() {
200
+    this.modal = false;
201
+  }
202
+
203
+  // 初始化新增form表单
204
+  initForm() {
205
+    if (this.add) {
206
+      this.deptList = [];
207
+    }
208
+    this.validateForm = this.fb.group({
209
+      patientName: ['', [Validators.required]],
210
+			gender: [null],
211
+			age: [undefined],
212
+			residenceNo: ['', [Validators.required]],
213
+			barCode: ['', [Validators.required]],
214
+			bedNum: [''],
215
+      hosId: [null, [Validators.required]],
216
+      department: [null, [Validators.required]],
217
+      careLevel: [null, [Validators.required]],
218
+      illnessState: [null],
219
+      patientType: [null, [Validators.required]],
220
+    });
221
+  }
222
+  // 表单提交
223
+  btnLoading: boolean = false; //提交按钮loading状态
224
+  submitForm(): void {
225
+    for (const i in this.validateForm.controls) {
226
+      this.validateForm.controls[i].markAsDirty({ onlySelf: true });
227
+      this.validateForm.controls[i].updateValueAndValidity();
228
+    }
229
+    if (this.validateForm.invalid) return;
230
+    this.btnLoading = true;
231
+    let postData = {};
232
+    if(this.add){
233
+			postData = {
234
+        patient: {
235
+          hosId: this.validateForm.value.hosId,
236
+          patientName: this.validateForm.value.patientName,
237
+          gender: {
238
+            id: this.validateForm.value.gender
239
+          },
240
+          age: this.validateForm.value.age,
241
+          residenceNo: this.validateForm.value.residenceNo,
242
+          barCode: this.validateForm.value.barCode,
243
+          bedNum: this.validateForm.value.bedNum,
244
+          department: {
245
+            id: this.validateForm.value.department,
246
+          },
247
+          careLevel: {
248
+            id: this.validateForm.value.careLevel,
249
+          },
250
+          illnessState: this.validateForm.value.illnessState ? {
251
+            id: this.validateForm.value.illnessState,
252
+          } : undefined,
253
+          patientType: {
254
+            id: this.validateForm.value.patientType,
255
+          },
256
+        }
257
+      }
258
+    }else{
259
+			postData = {
260
+        patient: {
261
+          ...this.coopData,
262
+          hosId: this.validateForm.value.hosId,
263
+          patientName: this.validateForm.value.patientName,
264
+          gender: {
265
+            id: this.validateForm.value.gender
266
+          },
267
+          age: this.validateForm.value.age,
268
+          residenceNo: this.validateForm.value.residenceNo,
269
+          barCode: this.validateForm.value.barCode,
270
+          bedNum: this.validateForm.value.bedNum,
271
+          department: {
272
+            id: this.validateForm.value.department,
273
+          },
274
+          careLevel: {
275
+            id: this.validateForm.value.careLevel,
276
+          },
277
+          illnessState: this.validateForm.value.illnessState ? {
278
+            id: this.validateForm.value.illnessState,
279
+          } : undefined,
280
+          patientType: {
281
+            id: this.validateForm.value.patientType,
282
+          },
283
+        }
284
+      }
285
+    }
286
+
287
+    this.mainService
288
+      .coopData("addData", "patient", postData)
289
+      .subscribe((data) => {
290
+        this.btnLoading = false;
291
+        this.hideModal();
292
+        if (data.status == 200) {
293
+          this.showPromptModal(this.add ? "新增" : "编辑", true, "");
294
+        } else{
295
+					this.showPromptModal(this.add ? "新增" : "编辑", false, data.msg);
296
+				}
297
+      });
298
+  }
299
+
300
+  // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
301
+  promptContent: string; //操作提示框提示信息
302
+  ifSuccess: boolean; //操作成功/失败
303
+  promptInfo: string; //操作结果提示信息
304
+  promptModalShow: boolean; //操作提示框是否展示
305
+  showPromptModal(con, success, promptInfo?) {
306
+    this.promptModalShow = false;
307
+    this.promptContent = con;
308
+    this.ifSuccess = success;
309
+    this.promptInfo = promptInfo;
310
+    setTimeout(() => {
311
+      this.promptModalShow = true;
312
+    }, 100);
313
+    this.getList(1);
314
+  }
315
+
316
+  // 编辑
317
+  maskFlag: any = false;
318
+  coopData = {};
319
+  edit(data) {
320
+    this.initForm();
321
+    this.validateForm.controls.hosId.setValue(data.hosId);
322
+    this.validateForm.controls.patientName.setValue(data.patientName);
323
+    if(data.gender){
324
+			this.validateForm.controls.gender.setValue(data.gender.id);
325
+		}else{
326
+      this.validateForm.controls.gender.setValue(null);
327
+    }
328
+    this.validateForm.controls.age.setValue(data.age);
329
+    this.validateForm.controls.residenceNo.setValue(data.residenceNo);
330
+    this.validateForm.controls.barCode.setValue(data.barCode);
331
+    this.validateForm.controls.bedNum.setValue(data.bedNum);
332
+    if(data.department){
333
+      this.deptList = [data.department];
334
+      this.validateForm.controls.department.setValue(data.department.id);
335
+    }else{
336
+      this.validateForm.controls.department.setValue(null);
337
+    }
338
+    if(data.careLevel){
339
+      this.validateForm.controls.careLevel.setValue(data.careLevel.id);
340
+    }else{
341
+      this.validateForm.controls.careLevel.setValue(null);
342
+    }
343
+    if(data.illnessState){
344
+      this.validateForm.controls.illnessState.setValue(data.illnessState.id);
345
+    }else{
346
+      this.validateForm.controls.illnessState.setValue(null);
347
+    }
348
+    if(data.patientType){
349
+      this.validateForm.controls.patientType.setValue(data.patientType.id);
350
+    }else{
351
+      this.validateForm.controls.patientType.setValue(null);
352
+    }
353
+
354
+    this.modal = true;
355
+    this.add = false;
356
+    this.coopData = data;
357
+  }
358
+
359
+  // 获取性别
360
+	genderList: any = [];
361
+	getGenderList() {
362
+    this.mainService.getDictionary("list", "user_gender").subscribe((data) => {
363
+      this.genderList = data || [];
364
+    });
365
+	}
366
+
367
+  // 获取护理等级
368
+	careLevelList: any = [];
369
+	getCareLevelList() {
370
+    this.mainService.getDictionary("list", "levelOfCare").subscribe((data) => {
371
+      this.careLevelList = data || [];
372
+    });
373
+	}
374
+
375
+  // 获取病情级别
376
+	illnessStateList: any = [];
377
+	getIllnessStateList() {
378
+    this.mainService.getDictionary("list", "stateOfAnIllness").subscribe((data) => {
379
+      this.illnessStateList = data || [];
380
+    });
381
+	}
382
+
383
+  // 获取患者类别
384
+	patientTypeList: any = [];
385
+	getPatientTypeList() {
386
+    this.mainService.getDictionary("list", "patient_type").subscribe((data) => {
387
+      this.patientTypeList = data || [];
388
+    });
389
+	}
138
 }
390
 }