Browse Source

Merge branch 'develop' into lmm

seimin 3 years ago
parent
commit
2722a3cdf6

+ 0 - 1
src/app/views/compre-statistics/compre-statistics.component.less

@@ -141,7 +141,6 @@
141 141
             .checkBox {
142 142
               position: absolute;
143 143
               right: 16px;
144
-              z-index: 9999;
145 144
             }
146 145
 
147 146
             .more {

+ 1 - 1
src/app/views/group-management/group-management.component.html

@@ -6,7 +6,7 @@
6 6
       <div *ngIf="coopBtns.edit" class="edit item" (click)="showCoopModal('edit')">编辑</div>
7 7
       <div *ngIf="coopBtns.del" class="del item" (click)="showDelModal()">删除</div>
8 8
     </div>
9
-    <div class="groups" *ngIf="!loading1">
9
+    <div class="groups" [ngStyle]="{display:!loading1?'block':'none'}">
10 10
       <overlay-scrollbars #osComponentRef1 [ngStyle]="{ height:'100%' }">
11 11
         <div [ngClass]="{'item':true,'checked':data.id==checkedGroup.id}" *ngFor="let data of groupList"
12 12
           (click)="checkGroup(data)" [title]="data.scheduleClass.name+' '+data.groupName">

+ 162 - 129
src/app/views/group-management/group-management.component.ts

@@ -1,22 +1,31 @@
1
-import { Component, OnInit, ViewChild } from '@angular/core';
2
-import { ActivatedRoute } from "@angular/router"
3
-import { FormBuilder, Validators, FormGroup } from '@angular/forms';
4
-import { NzMessageService } from 'ng-zorro-antd/message';
1
+import { Component, OnInit, ViewChild } from "@angular/core";
2
+import { ActivatedRoute } from "@angular/router";
3
+import { FormBuilder, Validators, FormGroup } from "@angular/forms";
4
+import { NzMessageService } from "ng-zorro-antd/message";
5 5
 
6 6
 import { MainService } from "../../services/main.service";
7
-import { OverlayScrollbarsComponent } from 'overlayscrollbars-ngx';
8
-import { ToolService } from '../../services/tool.service';
7
+import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx";
8
+import { ToolService } from "../../services/tool.service";
9 9
 
10 10
 @Component({
11
-  selector: 'app-group-management',
12
-  templateUrl: './group-management.component.html',
13
-  styleUrls: ['./group-management.component.less']
11
+  selector: "app-group-management",
12
+  templateUrl: "./group-management.component.html",
13
+  styleUrls: ["./group-management.component.less"],
14 14
 })
15 15
 export class GroupManagementComponent implements OnInit {
16 16
   tableHeight;
17 17
 
18
-  constructor(private fb: FormBuilder, private route: ActivatedRoute, private mainService: MainService, private msg: NzMessageService, private tool: ToolService) { }
19
-  @ViewChild('osComponentRef1', { read: OverlayScrollbarsComponent, static: false })
18
+  constructor(
19
+    private fb: FormBuilder,
20
+    private route: ActivatedRoute,
21
+    private mainService: MainService,
22
+    private msg: NzMessageService,
23
+    private tool: ToolService
24
+  ) {}
25
+  @ViewChild("osComponentRef1", {
26
+    read: OverlayScrollbarsComponent,
27
+    static: false,
28
+  })
20 29
   osComponentRef1: OverlayScrollbarsComponent;
21 30
   ngOnInit() {
22 31
     this.initCoopBtns();
@@ -26,89 +35,96 @@ export class GroupManagementComponent implements OnInit {
26 35
     this.getScheduleList();
27 36
     this.tableHeight = document.body.clientHeight - 267;
28 37
   }
29
-  menu: any = JSON.parse(localStorage.getItem('menu')) || [];//菜单
38
+  menu: any = JSON.parse(localStorage.getItem("menu")) || []; //菜单
30 39
   isAllDisplayDataChecked = false;
31 40
   isIndeterminate = false;
32 41
   listOfDisplayData: any[] = [];
33
-  allUserList: any[] = [];//所有用户
34
-  groupUserList: any[] = [];//所选组内用户
42
+  allUserList: any[] = []; //所有用户
43
+  groupUserList: any[] = []; //所选组内用户
35 44
   mapOfCheckedId: { [key: string]: boolean } = {};
36
-  checkedGroup: any = {};//选中分组
37
-  groupList: Array<any> = [];//分组信息
38
-  hospitalList: Array<any> = [];//院区列表
39
-  hosId:any;//当前选择的院区id
40
-  scheduleList: Array<any> = [];//班次列表
41
-  searchName: string = '';//用户信息搜索输入框
45
+  checkedGroup: any = {}; //选中分组
46
+  groupList: Array<any> = []; //分组信息
47
+  hospitalList: Array<any> = []; //院区列表
48
+  hosId: any; //当前选择的院区id
49
+  scheduleList: Array<any> = []; //班次列表
50
+  searchName: string = ""; //用户信息搜索输入框
42 51
 
43
-  promptContent: string;//操作提示框提示信息
44
-  ifSuccess: boolean;//操作成功/失败
45
-  promptInfo: string;//操作结果提示信息
46
-  promptModalShow: boolean;//是否展示提示框
52
+  promptContent: string; //操作提示框提示信息
53
+  ifSuccess: boolean; //操作成功/失败
54
+  promptInfo: string; //操作结果提示信息
55
+  promptModalShow: boolean; //是否展示提示框
47 56
 
48
-  btnLoading: boolean = false;//确认按钮loading状态
49
-  saveLoading: boolean = false;//批量打印按钮loading状态
57
+  btnLoading: boolean = false; //确认按钮loading状态
58
+  saveLoading: boolean = false; //批量打印按钮loading状态
50 59
 
51 60
   // 初始化增删改按钮
52 61
   coopBtns: any = {
53 62
     look: false,
54 63
     add: false,
55 64
     edit: false,
56
-    del: false
65
+    del: false,
57 66
   };
58 67
 
59 68
   initCoopBtns() {
60 69
     // 二级菜单
61
-    let secondMenus = []
62
-    this.menu.forEach(e => {
63
-      e.childrens.forEach(el => {
64
-        secondMenus.push(el)
70
+    let secondMenus = [];
71
+    this.menu.forEach((e) => {
72
+      e.childrens.forEach((el) => {
73
+        secondMenus.push(el);
65 74
       });
66 75
     });
67 76
     let link = this.route.parent.snapshot.routeConfig.path;
68
-    let btns = []
69
-    secondMenus.forEach(e => {
77
+    let btns = [];
78
+    secondMenus.forEach((e) => {
70 79
       if (e.link == link) {
71 80
         btns = e.childrens || [];
72 81
       }
73 82
     });
74
-    btns.forEach(e => {
83
+    btns.forEach((e) => {
75 84
       switch (e.link) {
76
-        case 'look':
85
+        case "look":
77 86
           this.coopBtns.look = true;
78 87
           break;
79
-        case 'add':
88
+        case "add":
80 89
           this.coopBtns.add = true;
81 90
           break;
82
-        case 'edit':
91
+        case "edit":
83 92
           this.coopBtns.edit = true;
84 93
           break;
85
-        case 'del':
94
+        case "del":
86 95
           this.coopBtns.del = true;
87 96
           break;
88 97
       }
89
-    })
98
+    });
90 99
   }
91 100
   // 分组列表
92 101
   loading1 = false;
93 102
   getGroupList() {
94 103
     let that = this;
95 104
     let arr = [];
96
-    this.hospitalList.forEach(item => {
97
-      arr.push(item['id']);
98
-    })
105
+    this.hospitalList.forEach((item) => {
106
+      arr.push(item["id"]);
107
+    });
99 108
     let data = {
100 109
       idx: 0,
101 110
       sum: 999,
102 111
       group2: {
103
-        hospitals: arr.join()
104
-      }
105
-    }
112
+        hospitals: arr.join(),
113
+      },
114
+    };
106 115
     this.loading1 = true;
107
-    that.mainService.getFetchDataList('data', 'group2', data).subscribe(data1 => {
108
-      this.loading1 = false;
109
-      that.groupList = data1.list;
110
-      this.checkGroup(data1.list[0]);
111
-    })
116
+    that.mainService
117
+      .getFetchDataList("data", "group2", data)
118
+      .subscribe((data1) => {
119
+        this.loading1 = false;
120
+        that.groupList = data1.list;
121
+        console.log(this.checkedGroup);
122
+        if (Object.keys(this.checkedGroup).length) {
123
+          this.checkGroup(this.checkedGroup);
124
+        } else {
125
+          this.checkGroup(data1.list[0]);
126
+        }
127
+      });
112 128
   }
113 129
 
114 130
   // 获取选中院区下用户列表
@@ -124,26 +140,32 @@ export class GroupManagementComponent implements OnInit {
124 140
         user: {
125 141
           name: this.searchName,
126 142
           usertype: { id: 106 },
127
-          hospital: { id: this.checkedGroup['hospital']['id'] }
128
-        }
129
-      }
143
+          hospital: { id: this.checkedGroup["hospital"]["id"] },
144
+        },
145
+      };
130 146
       this.timeNum++;
131 147
       this.loading2 = true;
132
-      this.mainService.getFetchDataList('data', 'user', data).subscribe(result => {
133
-        this.timeNum--;
134
-        if (this.timeNum === 0) {
135
-          this.loading2 = false;
136
-          this.onlyFlag = false;
137
-        }
138
-        this.allUserList = result.list;
139
-        this.allUsers = JSON.parse(JSON.stringify(result.list));
140
-        this.refreshStatus(true)
141
-      })
148
+      this.mainService
149
+        .getFetchDataList("data", "user", data)
150
+        .subscribe((result) => {
151
+          this.timeNum--;
152
+          if (this.timeNum === 0) {
153
+            this.loading2 = false;
154
+            this.onlyFlag = false;
155
+          }
156
+          this.allUserList = result.list;
157
+          this.allUsers = JSON.parse(JSON.stringify(result.list));
158
+          this.refreshStatus(true);
159
+        });
142 160
     } else {
143
-      this.allUserList = this.allUsers.filter(item => {
144
-        return item.pinYin.includes(this.searchName) || item.name.includes(this.searchName) || item.inputCode.includes(this.searchName);
145
-      })
146
-      this.refreshStatus(true)
161
+      this.allUserList = this.allUsers.filter((item) => {
162
+        return (
163
+          item.pinYin.includes(this.searchName) ||
164
+          item.name.includes(this.searchName) ||
165
+          item.inputCode.includes(this.searchName)
166
+        );
167
+      });
168
+      this.refreshStatus(true);
147 169
     }
148 170
   }
149 171
   // 获取组内用户
@@ -179,19 +201,25 @@ export class GroupManagementComponent implements OnInit {
179 201
     const data = {
180 202
       idx: 0,
181 203
       scheduleClass: { hospital: { id: this.hosId } },
182
-      sum: 999
183
-    }
184
-    this.mainService.getFetchDataList('configuration', 'scheduleClass', data).subscribe(data => {
185
-      this.scheduleList = data.list;
186
-    })
204
+      sum: 999,
205
+    };
206
+    this.mainService
207
+      .getFetchDataList("configuration", "scheduleClass", data)
208
+      .subscribe((data) => {
209
+        this.scheduleList = data.list;
210
+      });
187 211
   }
188 212
 
189 213
   // 选中分组
214
+  positionY = 0; //记录其他建单Y轴滚动距离
190 215
   checkGroup(data) {
191
-    this.searchName = '';
216
+    this.positionY = this.osComponentRef1.osInstance().scroll().position.y; //内容滚动的距离
217
+    this.searchName = "";
192 218
     this.checkedGroup = data;
193 219
     this.mapOfCheckedId = {};
194
-    this.groupUserList = this.checkedGroup['users'] ? this.checkedGroup['users'] : [];
220
+    this.groupUserList = this.checkedGroup["users"]
221
+      ? this.checkedGroup["users"]
222
+      : [];
195 223
     this.getAllUser();
196 224
   }
197 225
 
@@ -204,8 +232,8 @@ export class GroupManagementComponent implements OnInit {
204 232
     if (first) {
205 233
       for (j = 0; j < that.groupUserList.length; j++) {
206 234
         for (i = 0; i < that.allUserList.length; i++) {
207
-          if (that.allUserList[i]['id'] == that.groupUserList[j]['id']) {
208
-            that.mapOfCheckedId[that.allUserList[i]['id']] = true;
235
+          if (that.allUserList[i]["id"] == that.groupUserList[j]["id"]) {
236
+            that.mapOfCheckedId[that.allUserList[i]["id"]] = true;
209 237
             break;
210 238
           }
211 239
         }
@@ -214,7 +242,7 @@ export class GroupManagementComponent implements OnInit {
214 242
     let arr = [];
215 243
     for (var m in that.mapOfCheckedId) {
216 244
       if (that.mapOfCheckedId[m]) {
217
-        arr.push({ 'id': m })
245
+        arr.push({ id: m });
218 246
       }
219 247
     }
220 248
     that.usersArr = arr;
@@ -226,34 +254,40 @@ export class GroupManagementComponent implements OnInit {
226 254
     that.saveLoading = true;
227 255
     let postData = {
228 256
       group2: {
229
-        id: that.checkedGroup['id'],
230
-        users: that.usersArr
231
-      }
232
-    }
233
-    that.mainService.coopData('updData', 'group2', postData).subscribe(data => {
234
-      that.saveLoading = false;
235
-      if (data.status == 200) {
236
-        that.showPromptModal('保存', true, '');
237
-      } else {
238
-        that.showPromptModal('保存', false, data.msg);
239
-      }
240
-    })
257
+        id: that.checkedGroup["id"],
258
+        users: that.usersArr,
259
+      },
260
+    };
261
+    that.mainService
262
+      .coopData("updData", "group2", postData)
263
+      .subscribe((data) => {
264
+        that.saveLoading = false;
265
+        if (data.status == 200) {
266
+          that.showPromptModal("保存", true, "");
267
+        } else {
268
+          that.showPromptModal("保存", false, data.msg);
269
+        }
270
+      });
241 271
   }
242 272
 
243 273
   // 新增/编辑模态框
244
-  coopModal: boolean = false;//模态框是否展示
245
-  add: boolean = true;//true:新增;false:编辑
274
+  coopModal: boolean = false; //模态框是否展示
275
+  add: boolean = true; //true:新增;false:编辑
246 276
   showCoopModal(type) {
247 277
     let that = this;
248
-    if (type == 'edit' && !that.checkedGroup['groupName']) {
249
-      that.msg.create('warning', '请选择需要编辑的分组!');
278
+    if (type == "edit" && !that.checkedGroup["groupName"]) {
279
+      that.msg.create("warning", "请选择需要编辑的分组!");
250 280
       return;
251 281
     }
252 282
     that.coopModal = true;
253
-    that.add = type == 'add';
254
-    if (type == 'edit') {
255
-      that.validateForm.controls.classes.setValue(that.checkedGroup['scheduleClass'].id + '');
256
-      that.validateForm.controls.groupName.setValue(that.checkedGroup['groupName']);
283
+    that.add = type == "add";
284
+    if (type == "edit") {
285
+      that.validateForm.controls.classes.setValue(
286
+        that.checkedGroup["scheduleClass"].id + ""
287
+      );
288
+      that.validateForm.controls.groupName.setValue(
289
+        that.checkedGroup["groupName"]
290
+      );
257 291
     } else {
258 292
       that.validateForm.controls.classes.setValue(null);
259 293
       that.validateForm.controls.groupName.setValue(null);
@@ -268,7 +302,7 @@ export class GroupManagementComponent implements OnInit {
268 302
   initForm() {
269 303
     this.validateForm = this.fb.group({
270 304
       classes: [null, [Validators.required]],
271
-      groupName: [null, [Validators.required]]
305
+      groupName: [null, [Validators.required]],
272 306
     });
273 307
   }
274 308
 
@@ -286,29 +320,31 @@ export class GroupManagementComponent implements OnInit {
286 320
       group2: {
287 321
         groupName: that.validateForm.value.groupName,
288 322
         hospital: { id: that.hosId - 0 },
289
-        scheduleClass: { id: that.validateForm.value.classes - 0 }
290
-      }
291
-    }
323
+        scheduleClass: { id: that.validateForm.value.classes - 0 },
324
+      },
325
+    };
292 326
     if (!that.add) {
293
-      data.group2['id'] = that.checkedGroup['id'];
327
+      data.group2["id"] = that.checkedGroup["id"];
294 328
     }
295
-    that.mainService.coopData((that.add ? 'addData' : 'updData'), 'group2', data).subscribe(data => {
296
-      that.hideCoopModal();
297
-      that.btnLoading = false;
298
-      that.initForm();
299
-      if (data.status == 200) {
300
-        that.showPromptModal((that.add ? '新增' : '编辑'), true, '');
301
-      } else {
302
-        that.showPromptModal((that.add ? '新增' : '编辑'), false, data.msg);
303
-      }
304
-    })
329
+    that.mainService
330
+      .coopData(that.add ? "addData" : "updData", "group2", data)
331
+      .subscribe((data) => {
332
+        that.hideCoopModal();
333
+        that.btnLoading = false;
334
+        that.initForm();
335
+        if (data.status == 200) {
336
+          that.showPromptModal(that.add ? "新增" : "编辑", true, "");
337
+        } else {
338
+          that.showPromptModal(that.add ? "新增" : "编辑", false, data.msg);
339
+        }
340
+      });
305 341
   }
306 342
 
307 343
   //删除modal
308 344
   delModal: boolean = false;
309 345
   showDelModal() {
310
-    if (!this.checkedGroup['groupName']) {
311
-      this.msg.create('warning', '请选择需要删除的分组!');
346
+    if (!this.checkedGroup["groupName"]) {
347
+      this.msg.create("warning", "请选择需要删除的分组!");
312 348
       return;
313 349
     }
314 350
     this.delModal = true;
@@ -320,16 +356,17 @@ export class GroupManagementComponent implements OnInit {
320 356
   confirmDel() {
321 357
     let that = this;
322 358
     that.btnLoading = true;
323
-    that.mainService.coopData('rmvData', 'group2', [that.checkedGroup['id']]).subscribe(data => {
324
-      that.hideDelModal();
325
-      that.btnLoading = false;
326
-      if (data.status == 200) {
327
-        that.showPromptModal('删除', true, '');
328
-      } else {
329
-        that.showPromptModal('删除', false, data.msg);
330
-      }
331
-    })
332
-
359
+    that.mainService
360
+      .coopData("rmvData", "group2", [that.checkedGroup["id"]])
361
+      .subscribe((data) => {
362
+        that.hideDelModal();
363
+        that.btnLoading = false;
364
+        if (data.status == 200) {
365
+          that.showPromptModal("删除", true, "");
366
+        } else {
367
+          that.showPromptModal("删除", false, data.msg);
368
+        }
369
+      });
333 370
   }
334 371
 
335 372
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
@@ -338,14 +375,10 @@ export class GroupManagementComponent implements OnInit {
338 375
     this.promptContent = con;
339 376
     this.ifSuccess = success;
340 377
     this.promptInfo = promptInfo;
378
+    this.osComponentRef1.osInstance().scroll({ x: 0, y: this.positionY });
341 379
     setTimeout(() => {
342 380
       this.promptModalShow = true;
343 381
       this.getGroupList();
344 382
     }, 100);
345 383
   }
346
-
347
-
348
-
349
-
350
-
351 384
 }

+ 39 - 26
src/app/views/hushijiandan/hushijiandan.component.html

@@ -770,7 +770,6 @@
770 770
       </div>
771 771
       <div>
772 772
         <form nz-form [formGroup]="patientForm" class="patientForm">
773
-
774 773
           <nz-form-item class="datesControl">
775 774
             <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="checkedType">任务类型</nz-form-label>
776 775
             <nz-form-control nzErrorTip="请选择任务类型!" class="checkedType">
@@ -803,32 +802,50 @@
803 802
               </nz-form-control>
804 803
               <div *ngIf="!linkCheckLis.length">暂无关联的检查</div>
805 804
             </nz-form-item>
805
+            <!-- 需要预约检查 -->
806
+            <nz-form-item>
807
+              <nz-form-control>
808
+                <label nz-checkbox
809
+                  [nzDisabled]="!linkCheckLisTrue&&currentTasktype.associationType.value === 'inspect'||linkCheckLisTrue&&allowUrgent==1&&currentTasktype.associationType.value === 'inspect'||allowUrgent==1&&currentTasktype.associationType.value ==='patientTransport'"
810
+                  [(ngModel)]="isYyInspect" (ngModelChange)="yyInspectChange($event)"
811
+                  [ngModelOptions]="{standalone: true}">需要预约检查</label>
812
+              </nz-form-control>
813
+            </nz-form-item>
806 814
             <!-- 预约建单时间-患者其他服务 -->
807
-            <nz-form-item class="yyTime" [ngClass]="{yyTimeError:!yyTimeZy&&clickYYZyFlag}"
808
-              *ngIf="appointmentZyBuildFlag === '1'&&allowUrgent==0">
815
+            <nz-form-item class="yyTime" [ngClass]="{yyTimeError:(!yyTimeZy||!yyDateZy)&&clickYYZyFlag}"
816
+              *ngIf="currentTasktype.associationType.value === 'patientTransport'">
809 817
               <nz-form-label [nzSm]="24" [nzXs]="24">预约建单时间</nz-form-label>
810 818
               <nz-form-control [nzSm]="24" [nzXs]="24">
811
-                <nz-time-picker nzFormat="HH:mm" [nzMinuteStep]="30" [nzSecondStep]="60" [(ngModel)]="yyTimeZy"
812
-                  (ngModelChange)="yyTimeZyChange($event)" [ngModelOptions]="{standalone: true}"
813
-                  [nzDisabledHours]="disabledHours" [nzDisabledMinutes]="disabledMinutes"></nz-time-picker>
814
-                <label *ngIf="yyTimeZy" nz-checkbox [(ngModel)]="nextDayZy" (ngModelChange)="nextDayZyChange($event)"
815
-                  class="ml8" [ngModelOptions]="{standalone: true}">次日</label>
819
+                <nz-date-picker [nzDisabled]="!isYyInspect" [(ngModel)]="yyDateZy" [ngModelOptions]="{standalone: true}"
820
+                  [nzAllowClear]="false" [nzDisabledDate]="disabledyyDateZy"></nz-date-picker>
821
+                <nz-time-picker [nzDisabled]="!isYyInspect" class="ml8" nzFormat="HH:mm" [nzMinuteStep]="30"
822
+                  [nzSecondStep]="60" [(ngModel)]="yyTimeZy" (ngModelChange)="yyTimeZyChange($event)"
823
+                  [ngModelOptions]="{standalone: true}" [nzDisabledHours]="disabledHours"
824
+                  [nzDisabledMinutes]="disabledMinutes" [nzAllowEmpty]="false">
825
+                </nz-time-picker>
826
+                <button [disabled]="!isYyInspect||(isYyInspect&&!(yyDateZy&&yyTimeZy))" nz-button nzType="primary"
827
+                  class="ml8" (click)="nextDayZy()">下一日</button>
816 828
               </nz-form-control>
817
-              <div class="red w100" *ngIf="!yyTimeZy&&clickYYZyFlag">请填写预约建单时间!</div>
829
+              <div class="red w100" *ngIf="(!yyTimeZy||!yyDateZy)&&clickYYZyFlag">请填写预约建单时间!</div>
818 830
               <div class="red">请您在预约建单时至少在预约检查时间的基础上提前30分钟,以免错过检查!</div>
819 831
             </nz-form-item>
820 832
             <!-- 预约建单时间 -->
821
-            <nz-form-item class="yyTime" [ngClass]="{yyTimeError:!yyTime&&clickYYFlag}"
822
-              *ngIf="linkCheckLisTrue&&hasTime&&lessTime&&appointmentBuildFlag === '1'&&allowUrgent==0">
833
+            <nz-form-item class="yyTime" [ngClass]="{yyTimeError:(!yyTime||!yyDate)&&clickYYFlag}"
834
+              *ngIf="currentTasktype.associationType.value === 'inspect'">
823 835
               <nz-form-label [nzSm]="24" [nzXs]="24">预约建单时间</nz-form-label>
824 836
               <nz-form-control [nzSm]="24" [nzXs]="24">
825
-                <nz-time-picker nzFormat="HH:mm" [nzMinuteStep]="30" [nzSecondStep]="60" [(ngModel)]="yyTime"
826
-                  (ngModelChange)="yyTimeChange($event)" [ngModelOptions]="{standalone: true}"
827
-                  [nzDisabledHours]="disabledHours" [nzDisabledMinutes]="disabledMinutes"></nz-time-picker>
828
-                <label *ngIf="yyTime" nz-checkbox [(ngModel)]="nextDay" (ngModelChange)="nextDayChange($event)"
829
-                  class="ml8" [ngModelOptions]="{standalone: true}">次日</label>
837
+                <nz-date-picker [nzDisabled]="!isYyInspect" [(ngModel)]="yyDate" [ngModelOptions]="{standalone: true}"
838
+                  [nzAllowClear]="false" [nzDisabledDate]="disabledyyDate">
839
+                </nz-date-picker>
840
+                <nz-time-picker [nzDisabled]="!isYyInspect" class="ml8" nzFormat="HH:mm" [nzMinuteStep]="30"
841
+                  [nzSecondStep]="60" [(ngModel)]="yyTime" (ngModelChange)="yyTimeChange($event)"
842
+                  [ngModelOptions]="{standalone: true}" [nzDisabledHours]="disabledHours"
843
+                  [nzDisabledMinutes]="disabledMinutes" [nzAllowEmpty]="false">
844
+                </nz-time-picker>
845
+                <button [disabled]="!isYyInspect||(isYyInspect&&!(yyDate&&yyTime))" nz-button nzType="primary"
846
+                  class="ml8" (click)="nextDay()">下一日</button>
830 847
               </nz-form-control>
831
-              <div class="red w100" *ngIf="!yyTime&&clickYYFlag">请填写预约建单时间!</div>
848
+              <div class="red w100" *ngIf="(!yyTime||!yyDate)&&clickYYFlag">请填写预约建单时间!</div>
832 849
               <div class="red">请您在预约建单时至少在预约检查时间的基础上提前30分钟,以免错过检查!</div>
833 850
             </nz-form-item>
834 851
             <!-- 100009 科室任务类型状态码未配置 -->
@@ -855,7 +872,6 @@
855 872
             <!-- 100014 (护士端一键建单展示策略)取终点科室和msg 值展示 -->
856 873
             <nz-form-item
857 874
               *ngIf="(checkedShowMsg.status!=200)&&(checkedShowMsg.status==100014||checkedShowMsg.status==100015)">
858
-              <!-- <nz-form-item> -->
859 875
               <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="targetOffice">目标科室</nz-form-label>
860 876
               <nz-form-control nzErrorTip="请选择目标科室!">
861 877
                 <nz-select class="w100" formControlName="targetOffice" [nzDropdownMatchSelectWidth]="false"
@@ -888,7 +904,8 @@
888 904
             <nz-form-item *ngIf="current_allowUrgent">
889 905
               <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="allowUrgent" class="goods">是否加急</nz-form-label>
890 906
               <nz-form-control>
891
-                <nz-radio-group [(ngModel)]="allowUrgent" formControlName="allowUrgent">
907
+                <nz-radio-group [(ngModel)]="allowUrgent" (ngModelChange)="allowUrgentChange($event)"
908
+                  formControlName="allowUrgent">
892 909
                   <label nz-radio nzValue="1">是</label>
893 910
                   <label nz-radio nzValue="0">否</label>
894 911
                 </nz-radio-group>
@@ -907,13 +924,9 @@
907 924
       </div>
908 925
     </overlay-scrollbars>
909 926
     <div class="btns display_flex justify-content_flex-center">
910
-      <button *ngIf="linkCheckLisTrue&&hasTime&&lessTime&&appointmentBuildFlag === '1'&&allowUrgent==0" nz-button
911
-        nzType="primary" [nzLoading]="btnLoading1" (click)="confirmPatient1('patient-yuyue')">预约建单</button>
912
-      <button *ngIf="appointmentZyBuildFlag === '1'&&allowUrgent==0" nz-button nzType="primary"
913
-        [nzLoading]="btnLoading1" (click)="confirmPatient1('patient-zy-yuyue')">预约建单</button>
914
-      <button
915
-        *ngIf="((checkedShowMsg.data&&linkCheckLisTrue)||(!checkedShowMsg.data&&!linkCheckLisTrue))&&((allowUrgent == 1 && urgentReason.trim() !== '')||allowUrgent == 0)"
916
-        nz-button nzType="default" [nzLoading]="btnLoading" (click)="confirmPatient()" class="orderThis">直接建单</button>
927
+      <button nz-button nzType="primary" [nzLoading]="btnLoading1" (click)="confirmPatient1('patient-yuyue')" *ngIf="currentTasktype.associationType.value === 'inspect'&&isYyInspect">预约建单</button>
928
+      <button nz-button nzType="primary" [nzLoading]="btnLoading1" (click)="confirmPatient1('patient-zy-yuyue')" *ngIf="currentTasktype.associationType.value === 'patientTransport'&&isYyInspect">预约建单</button>
929
+      <button nz-button nzType="default" [nzLoading]="btnLoading" (click)="confirmPatient()" class="orderThis" *ngIf="!isYyInspect">直接建单</button>
917 930
       <button class="btn cancel" nz-button nzType="default" (click)="hidePatientOrder()">取消</button>
918 931
     </div>
919 932
   </div>

+ 2 - 1
src/app/views/hushijiandan/hushijiandan.component.less

@@ -9,7 +9,8 @@
9 9
     flex-direction: column;
10 10
   }
11 11
   .yyTimeError {
12
-    ::ng-deep .ant-time-picker-input {
12
+    ::ng-deep .ant-time-picker-input,
13
+    ::ng-deep .ant-calendar-picker-input {
13 14
       border: 1px solid red !important;
14 15
     }
15 16
   }

+ 136 - 143
src/app/views/hushijiandan/hushijiandan.component.ts

@@ -23,7 +23,14 @@ import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx";
23 23
 import { ToolService } from "../../services/tool.service";
24 24
 import { Subject } from "rxjs";
25 25
 import { debounceTime } from "rxjs/operators";
26
-import { format, getMinutes, setMinutes, setSeconds, addDays } from "date-fns";
26
+import {
27
+  format,
28
+  getMinutes,
29
+  setMinutes,
30
+  setSeconds,
31
+  addDays,
32
+  differenceInCalendarDays,
33
+} from "date-fns";
27 34
 // 日期禁用
28 35
 function range(start: number, end: number): number[] {
29 36
   const result: number[] = [];
@@ -83,7 +90,7 @@ export class HushijiandanComponent implements OnInit {
83 90
   sortableTimer = null;
84 91
   searchTabInpSubject = new Subject(); //左侧查患者信息和检查信息防抖
85 92
   otherSearchChangeSubject = new Subject(); //其他建单搜索防抖
86
-  timeDefaultValue = setSeconds(new Date(), 0);
93
+  isYyInspect = false; //需要预约检查
87 94
   constructor(
88 95
     private message: NzMessageService,
89 96
     private fb: FormBuilder,
@@ -231,8 +238,9 @@ export class HushijiandanComponent implements OnInit {
231 238
   recentInfoNum = 0;
232 239
   isRemand = true; //自动送回
233 240
   yyTime = null; //预约时间-患者列表
234
-  yyTimeInspect = null; //预约时间-检查列表
235 241
   yyTimeZy = null; //预约时间-患者列表-患者其他服务
242
+  yyDate = null; //预约日期-陪检
243
+  yyDateZy = null; //预约日期-转运
236 244
   getRecentInfo(patientCode) {
237 245
     this.recentInfo = "";
238 246
     clearTimeout(this.recentInfoTimer);
@@ -267,9 +275,8 @@ export class HushijiandanComponent implements OnInit {
267 275
   closeModel(e) {
268 276
     console.log(e);
269 277
     if (e === "other") {
270
-      this.getDeptTaskType("", "clear");
278
+      this.osComponentRef2.osInstance().scroll({ x: 0, y: this.positionY });
271 279
       this.getOrderList();
272
-      this.getSpecimenWorkOrderMsg();
273 280
     } else if (e === "bb") {
274 281
       this.getOrderList();
275 282
       this.getSpecimenWorkOrderMsg();
@@ -280,8 +287,9 @@ export class HushijiandanComponent implements OnInit {
280 287
   otherSearch = ""; //搜索的关键词
281 288
   oLoading = false;
282 289
   nLoading = false;
290
+  positionY = 0; //记录其他建单Y轴滚动距离
283 291
   otherClick(item) {
284
-    console.log(item);
292
+    this.positionY = this.osComponentRef2.osInstance().scroll().position.y; //内容滚动的距离
285 293
     this.selectOtherId = item.id;
286 294
     this.newShortcutOrder(item, "other");
287 295
   }
@@ -571,19 +579,16 @@ export class HushijiandanComponent implements OnInit {
571 579
               that.patientMsgList.push(e);
572 580
             }
573 581
           });
574
-          if (clear === "clear") {
575
-            this.otherSearch = "";
576
-            this.workOrderRemark = "";
577
-            this.customRemarks = [];
578
-            this.historyCustomRemarks = [];
579
-            this.selectOtherId = that.othersList.length
580
-              ? that.othersList[0].id
581
-              : null;
582
-            let obj = that.othersList.find(
583
-              (item) => item.id == this.selectOtherId
584
-            );
585
-            obj && this.otherClick(obj);
586
-          }
582
+          // if (clear === "clear") {
583
+          //   this.otherSearch = "";
584
+          //   this.workOrderRemark = "";
585
+          //   this.customRemarks = [];
586
+          //   this.historyCustomRemarks = [];
587
+          //   let obj = that.othersList.find(
588
+          //     (item) => item.id == this.selectOtherId
589
+          //   );
590
+          //   obj && this.otherClick(obj);
591
+          // }
587 592
           console.log(this.selectOtherId);
588 593
           if (!this.selectOtherId) {
589 594
             if (that.othersList.length) {
@@ -693,6 +698,24 @@ export class HushijiandanComponent implements OnInit {
693 698
     if (!this.deptTaskTypeRules.openInspection) return;
694 699
     this.searchTabInpSubject.next(e);
695 700
   }
701
+  // 下一日(陪检)
702
+  nextDay() {
703
+    this.yyDate = addDays(this.yyDate, 1);
704
+    this.yyTime = addDays(this.yyTime, 1);
705
+  }
706
+  // 下一日(转运)
707
+  nextDayZy() {
708
+    this.yyDateZy = addDays(this.yyDateZy, 1);
709
+    this.yyTimeZy = addDays(this.yyTimeZy, 1);
710
+  }
711
+  // 禁用日期(陪检)
712
+  disabledyyDate = (current: Date): boolean => {
713
+    return differenceInCalendarDays(current, new Date()) < 0;
714
+  };
715
+  // 禁用日期(转运)
716
+  disabledyyDateZy = (current: Date): boolean => {
717
+    return differenceInCalendarDays(current, new Date()) < 0;
718
+  };
696 719
 
697 720
   // 一键建单确认弹框
698 721
   confirmSub: boolean = false;
@@ -858,8 +881,6 @@ export class HushijiandanComponent implements OnInit {
858 881
       if (getMinutes(this.yyTime) != 30) {
859 882
         this.yyTime = setMinutes(this.yyTime, 0);
860 883
       }
861
-    } else {
862
-      this.nextDay = false;
863 884
     }
864 885
     this.clickYYFlag = false;
865 886
   }
@@ -868,8 +889,6 @@ export class HushijiandanComponent implements OnInit {
868 889
       if (getMinutes(this.yyTimeZy) != 30) {
869 890
         this.yyTimeZy = setMinutes(this.yyTimeZy, 0);
870 891
       }
871
-    } else {
872
-      this.nextDayZy = false;
873 892
     }
874 893
     this.clickYYZyFlag = false;
875 894
   }
@@ -878,87 +897,6 @@ export class HushijiandanComponent implements OnInit {
878 897
     this.clickYYFlag = false;
879 898
     this.clickYYZyFlag = false;
880 899
   }
881
-  // 次日-陪检
882
-  nextDay = false;
883
-  nextDayChange(e) {
884
-    if (this.yyTime) {
885
-      if (e) {
886
-        this.yyTime = addDays(this.yyTime, 1);
887
-        this.disabledHours = () => [];
888
-        this.disabledMinutes = (hour) => [];
889
-      } else {
890
-        // this.yyTime = addDays(this.yyTime, -1);
891
-        this.yyTime = null;
892
-        this.disabledHours = () => {
893
-          let now = new Date();
894
-          let nHour = now.getHours();
895
-          let nMinute = now.getMinutes();
896
-          if (nMinute > 30) {
897
-            return range(0, nHour + 1);
898
-          } else {
899
-            return range(0, nHour);
900
-          }
901
-        };
902
-        this.disabledMinutes = (hour) => {
903
-          let now = new Date();
904
-          let nHour = now.getHours();
905
-          let nMinute = now.getMinutes();
906
-          if (hour === nHour || hour === undefined) {
907
-            if (nMinute == 0) {
908
-              return [];
909
-            } else if (nMinute <= 30 && nMinute > 0) {
910
-              return [0];
911
-            } else {
912
-              return [0, 30];
913
-            }
914
-          } else {
915
-            return [];
916
-          }
917
-        };
918
-      }
919
-    }
920
-  }
921
-  // 次日-陪检
922
-  nextDayZy = false;
923
-  nextDayZyChange(e) {
924
-    if (this.yyTimeZy) {
925
-      if (e) {
926
-        this.yyTimeZy = addDays(this.yyTimeZy, 1);
927
-        this.disabledHours = () => [];
928
-        this.disabledMinutes = (hour) => [];
929
-      } else {
930
-        console.log("狗血");
931
-        // this.yyTimeZy = addDays(this.yyTimeZy, -1);
932
-        this.yyTimeZy = null;
933
-        this.disabledHours = () => {
934
-          let now = new Date();
935
-          let nHour = now.getHours();
936
-          let nMinute = now.getMinutes();
937
-          if (nMinute > 30) {
938
-            return range(0, nHour + 1);
939
-          } else {
940
-            return range(0, nHour);
941
-          }
942
-        };
943
-        this.disabledMinutes = (hour) => {
944
-          let now = new Date();
945
-          let nHour = now.getHours();
946
-          let nMinute = now.getMinutes();
947
-          if (hour === nHour || hour === undefined) {
948
-            if (nMinute == 0) {
949
-              return [];
950
-            } else if (nMinute <= 30 && nMinute > 0) {
951
-              return [0];
952
-            } else {
953
-              return [0, 30];
954
-            }
955
-          } else {
956
-            return [];
957
-          }
958
-        };
959
-      }
960
-    }
961
-  }
962 900
   // 预约建单
963 901
   btnLoading1 = false;
964 902
   confirmPatient1(type) {
@@ -988,8 +926,8 @@ export class HushijiandanComponent implements OnInit {
988 926
     });
989 927
     //预约时间-患者陪检不能为空
990 928
     if (
991
-      (!this.yyTime && !flag && yuyue) ||
992
-      (!this.yyTimeZy && flag && yuyue === "patient-zy-yuyue")
929
+      (!this.yyTime && !this.yyDate && !flag && yuyue === "patient-yuyue") ||
930
+      (!this.yyTimeZy && !this.yyDateZy && flag && yuyue === "patient-zy-yuyue")
993 931
     ) {
994 932
       return;
995 933
     }
@@ -1273,11 +1211,10 @@ export class HushijiandanComponent implements OnInit {
1273 1211
   currentTasktype; //当前选中的任务类型对象
1274 1212
   cLoading = false;
1275 1213
   changeCheckedType() {
1214
+    this.isYyInspect = false;
1276 1215
     this.linkCheckLisTrue = false;
1277 1216
     this.clickYYFlag = false;
1278 1217
     this.clickYYZyFlag = false;
1279
-    this.nextDay = false;
1280
-    this.nextDayZy = false;
1281 1218
     this.currentTasktype = this.checkTypeLis.find(
1282 1219
       (item) => item.id == this.patientForm.controls.checkedType.value
1283 1220
     );
@@ -1290,6 +1227,17 @@ export class HushijiandanComponent implements OnInit {
1290 1227
     if (appointmentZyBuildFlag.length) {
1291 1228
       this.appointmentZyBuildFlag =
1292 1229
         appointmentZyBuildFlag[0].appointmentOtherSwitch == 1 ? "1" : "0";
1230
+      this.yyDateZy = new Date();
1231
+      this.yyTimeZy = new Date();
1232
+      if (this.yyTimeZy.getMinutes() >= 0 && this.yyTimeZy.getMinutes() <= 30) {
1233
+        this.yyTimeZy.setMinutes(30);
1234
+      } else if (
1235
+        this.yyTimeZy.getMinutes() > 30 &&
1236
+        this.yyTimeZy.getMinutes() < 60
1237
+      ) {
1238
+        this.yyTimeZy.setMinutes(0);
1239
+        this.yyTimeZy.setHours(this.yyTimeZy.getHours() + 1);
1240
+      }
1293 1241
     } else {
1294 1242
       this.appointmentZyBuildFlag = "0";
1295 1243
     }
@@ -1352,22 +1300,62 @@ export class HushijiandanComponent implements OnInit {
1352 1300
         }
1353 1301
       });
1354 1302
   }
1303
+  // 需要预约建单-事件
1304
+  yyInspectChange(e) {
1305
+    if (this.filterLinkCheckLis.length) {
1306
+      this.showDateTime();
1307
+    } else {
1308
+      this.yyTime = null;
1309
+      this.yyDate = null;
1310
+      console.log(this.isYyInspect);
1311
+    }
1312
+  }
1313
+  //回显时间日期
1314
+  showDateTime() {
1315
+    //当前时间要大于生效时间
1316
+    let isYyInspect = this.filterLinkCheckLis.every((item) => {
1317
+      return (
1318
+        new Date(item.yyTime).getTime() - new Date().getTime() >
1319
+        this.leadTime * 60 * 1000
1320
+      );
1321
+    });
1322
+    //如果勾选需要预约检查
1323
+    if (isYyInspect) {
1324
+      //筛选离当前时间最近的
1325
+      let timeList = this.filterLinkCheckLis
1326
+        .map((item) => new Date(item.yyTime).getTime())
1327
+        .sort();
1328
+      this.yyTime = new Date(timeList[0] - this.leadTime * 60 * 1000); //回显预约时间,需要减去生效时间
1329
+      this.yyDate = new Date(timeList[0] - this.leadTime * 60 * 1000); //回显预约日期,需要减去生效时间
1330
+    } else {
1331
+      this.yyTime = null;
1332
+      this.yyDate = null;
1333
+    }
1334
+  }
1355 1335
   // 患者送检检查项目-选择检查项目
1356 1336
   linkCheckLisTrue = false; //是否有已选择(患者)
1357 1337
   isInspectPriority = false; //选择的检查是否紧急(患者)
1358
-  hasTime = false; //是否有已选择,并且是否有预约时间(患者)
1359
-  lessTime = false; //预约时间列表中预约时间少于生效时长,则是false
1338
+  filterLinkCheckLis = []; //有预约时间并且选中的
1360 1339
   linkCheckLisChange(e) {
1361 1340
     console.log(e, this.linkCheckLis);
1362 1341
     let flag = false; //检查是否紧急
1363 1342
     this.linkCheckLis.forEach((item) => {
1364
-      e.forEach((v) => {
1365
-        if (v.priority == 1) {
1366
-          flag = true;
1367
-        }
1368
-        item.checked = v.value == item.value;
1369
-      });
1343
+      if (e.length) {
1344
+        //有选中的检查
1345
+        e.forEach((v) => {
1346
+          //检查是否有紧急度
1347
+          if (v.priority == 1) {
1348
+            flag = true;
1349
+          }
1350
+          //选中的检查设置checked
1351
+          item.checked = v.value == item.value;
1352
+        });
1353
+      } else {
1354
+        item.checked = false;
1355
+      }
1370 1356
     });
1357
+
1358
+    //检查有紧急度,则加急
1371 1359
     if (flag) {
1372 1360
       this.allowUrgent = "1";
1373 1361
       this.urgentReason = "系统根据检查信息,自动进行加急";
@@ -1376,40 +1364,45 @@ export class HushijiandanComponent implements OnInit {
1376 1364
       this.urgentReason = "";
1377 1365
     }
1378 1366
     this.clickYYFlag = false;
1379
-    let linkCheckLis = this.linkCheckLis.filter(
1367
+    // 有预约时间并且选中的
1368
+    this.filterLinkCheckLis = this.linkCheckLis.filter(
1380 1369
       (item) => Boolean(item.yyTime) && item.checked
1381 1370
     );
1382
-    this.lessTime = linkCheckLis.every((item) => {
1383
-      return (
1384
-        new Date(item.yyTime).getTime() - new Date().getTime() >
1385
-        this.leadTime * 60 * 1000
1386
-      );
1387
-    });
1388
-    //回显预约时间2021年5月10日
1389
-    if (this.lessTime && linkCheckLis.length) {
1390
-      let timeList = linkCheckLis
1391
-        .map((item) => new Date(item.yyTime).getTime())
1392
-        .sort();
1393
-      this.yyTime = new Date(timeList[0] - this.leadTime * 60 * 1000);
1371
+    //有预约时间并且选中的检查数组不为空
1372
+    if (this.filterLinkCheckLis.length) {
1373
+      //当前时间要大于生效时间
1374
+      this.isYyInspect = this.filterLinkCheckLis.every((item) => {
1375
+        return (
1376
+          new Date(item.yyTime).getTime() - new Date().getTime() >
1377
+          this.leadTime * 60 * 1000
1378
+        );
1379
+      });
1380
+      this.showDateTime();
1381
+    } else {
1382
+      //有预约时间并且选中的检查数组为空
1383
+      this.isYyInspect = false;
1384
+      this.yyTime = null;
1385
+      this.yyDate = null;
1394 1386
     }
1395 1387
     this.linkCheckLisTrue = e.length > 0;
1396 1388
     this.isInspectPriority = e.some((item) => item.priority == 1);
1397
-    if (!this.linkCheckLisTrue) {
1398
-      this.hasTime = false;
1389
+  }
1390
+  // 是否加急
1391
+  allowUrgentChange(e) {
1392
+    if (this.isYyInspect) {
1393
+      this.isYyInspect = e == 0;
1394
+      if (!this.isYyInspect) {
1395
+        this.yyDate = null;
1396
+        this.yyDateZy = null;
1397
+        this.yyTime = null;
1398
+        this.yyTimeZy = null;
1399
+      }
1399 1400
     } else {
1400
-      this.hasTime = this.linkCheckLis.some(
1401
-        (item) => Boolean(item.yyTime) && item.checked
1402
-      );
1401
+      this.yyDate = null;
1402
+      this.yyDateZy = null;
1403
+      this.yyTime = null;
1404
+      this.yyTimeZy = null;
1403 1405
     }
1404
-    console.log(
1405
-      this.linkCheckLisTrue,
1406
-      this.hasTime,
1407
-      this.lessTime,
1408
-      this.appointmentBuildFlag,
1409
-      this.allowUrgent,
1410
-      this.isInspectPriority,
1411
-      this.checkedShowMsg
1412
-    );
1413 1406
   }
1414 1407
   // 禁用小时
1415 1408
   disabledHours(): number[] {