|
@@ -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);
|
|
@@ -693,6 +701,24 @@ export class HushijiandanComponent implements OnInit {
|
693
|
701
|
if (!this.deptTaskTypeRules.openInspection) return;
|
694
|
702
|
this.searchTabInpSubject.next(e);
|
695
|
703
|
}
|
|
704
|
+ // 下一日(陪检)
|
|
705
|
+ nextDay() {
|
|
706
|
+ this.yyDate = addDays(this.yyDate, 1);
|
|
707
|
+ this.yyTime = addDays(this.yyTime, 1);
|
|
708
|
+ }
|
|
709
|
+ // 下一日(转运)
|
|
710
|
+ nextDayZy() {
|
|
711
|
+ this.yyDateZy = addDays(this.yyDateZy, 1);
|
|
712
|
+ this.yyTimeZy = addDays(this.yyTimeZy, 1);
|
|
713
|
+ }
|
|
714
|
+ // 禁用日期(陪检)
|
|
715
|
+ disabledyyDate = (current: Date): boolean => {
|
|
716
|
+ return differenceInCalendarDays(current, new Date()) < 0;
|
|
717
|
+ };
|
|
718
|
+ // 禁用日期(转运)
|
|
719
|
+ disabledyyDateZy = (current: Date): boolean => {
|
|
720
|
+ return differenceInCalendarDays(current, new Date()) < 0;
|
|
721
|
+ };
|
696
|
722
|
|
697
|
723
|
// 一键建单确认弹框
|
698
|
724
|
confirmSub: boolean = false;
|
|
@@ -858,8 +884,6 @@ export class HushijiandanComponent implements OnInit {
|
858
|
884
|
if (getMinutes(this.yyTime) != 30) {
|
859
|
885
|
this.yyTime = setMinutes(this.yyTime, 0);
|
860
|
886
|
}
|
861
|
|
- } else {
|
862
|
|
- this.nextDay = false;
|
863
|
887
|
}
|
864
|
888
|
this.clickYYFlag = false;
|
865
|
889
|
}
|
|
@@ -868,8 +892,6 @@ export class HushijiandanComponent implements OnInit {
|
868
|
892
|
if (getMinutes(this.yyTimeZy) != 30) {
|
869
|
893
|
this.yyTimeZy = setMinutes(this.yyTimeZy, 0);
|
870
|
894
|
}
|
871
|
|
- } else {
|
872
|
|
- this.nextDayZy = false;
|
873
|
895
|
}
|
874
|
896
|
this.clickYYZyFlag = false;
|
875
|
897
|
}
|
|
@@ -878,87 +900,6 @@ export class HushijiandanComponent implements OnInit {
|
878
|
900
|
this.clickYYFlag = false;
|
879
|
901
|
this.clickYYZyFlag = false;
|
880
|
902
|
}
|
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
|
903
|
// 预约建单
|
963
|
904
|
btnLoading1 = false;
|
964
|
905
|
confirmPatient1(type) {
|
|
@@ -988,8 +929,8 @@ export class HushijiandanComponent implements OnInit {
|
988
|
929
|
});
|
989
|
930
|
//预约时间-患者陪检不能为空
|
990
|
931
|
if (
|
991
|
|
- (!this.yyTime && !flag && yuyue) ||
|
992
|
|
- (!this.yyTimeZy && flag && yuyue === "patient-zy-yuyue")
|
|
932
|
+ (!this.yyTime && !this.yyDate && !flag && yuyue === "patient-yuyue") ||
|
|
933
|
+ (!this.yyTimeZy && !this.yyDateZy && flag && yuyue === "patient-zy-yuyue")
|
993
|
934
|
) {
|
994
|
935
|
return;
|
995
|
936
|
}
|
|
@@ -1273,11 +1214,10 @@ export class HushijiandanComponent implements OnInit {
|
1273
|
1214
|
currentTasktype; //当前选中的任务类型对象
|
1274
|
1215
|
cLoading = false;
|
1275
|
1216
|
changeCheckedType() {
|
|
1217
|
+ this.isYyInspect = false;
|
1276
|
1218
|
this.linkCheckLisTrue = false;
|
1277
|
1219
|
this.clickYYFlag = false;
|
1278
|
1220
|
this.clickYYZyFlag = false;
|
1279
|
|
- this.nextDay = false;
|
1280
|
|
- this.nextDayZy = false;
|
1281
|
1221
|
this.currentTasktype = this.checkTypeLis.find(
|
1282
|
1222
|
(item) => item.id == this.patientForm.controls.checkedType.value
|
1283
|
1223
|
);
|
|
@@ -1290,6 +1230,17 @@ export class HushijiandanComponent implements OnInit {
|
1290
|
1230
|
if (appointmentZyBuildFlag.length) {
|
1291
|
1231
|
this.appointmentZyBuildFlag =
|
1292
|
1232
|
appointmentZyBuildFlag[0].appointmentOtherSwitch == 1 ? "1" : "0";
|
|
1233
|
+ this.yyDateZy = new Date();
|
|
1234
|
+ this.yyTimeZy = new Date();
|
|
1235
|
+ if (this.yyTimeZy.getMinutes() >= 0 && this.yyTimeZy.getMinutes() <= 30) {
|
|
1236
|
+ this.yyTimeZy.setMinutes(30);
|
|
1237
|
+ } else if (
|
|
1238
|
+ this.yyTimeZy.getMinutes() > 30 &&
|
|
1239
|
+ this.yyTimeZy.getMinutes() < 60
|
|
1240
|
+ ) {
|
|
1241
|
+ this.yyTimeZy.setMinutes(0);
|
|
1242
|
+ this.yyTimeZy.setHours(this.yyTimeZy.getHours() + 1);
|
|
1243
|
+ }
|
1293
|
1244
|
} else {
|
1294
|
1245
|
this.appointmentZyBuildFlag = "0";
|
1295
|
1246
|
}
|
|
@@ -1352,22 +1303,62 @@ export class HushijiandanComponent implements OnInit {
|
1352
|
1303
|
}
|
1353
|
1304
|
});
|
1354
|
1305
|
}
|
|
1306
|
+ // 需要预约建单-事件
|
|
1307
|
+ yyInspectChange(e) {
|
|
1308
|
+ if (this.filterLinkCheckLis.length) {
|
|
1309
|
+ this.showDateTime();
|
|
1310
|
+ } else {
|
|
1311
|
+ this.yyTime = null;
|
|
1312
|
+ this.yyDate = null;
|
|
1313
|
+ console.log(this.isYyInspect);
|
|
1314
|
+ }
|
|
1315
|
+ }
|
|
1316
|
+ //回显时间日期
|
|
1317
|
+ showDateTime() {
|
|
1318
|
+ //当前时间要大于生效时间
|
|
1319
|
+ let isYyInspect = this.filterLinkCheckLis.every((item) => {
|
|
1320
|
+ return (
|
|
1321
|
+ new Date(item.yyTime).getTime() - new Date().getTime() >
|
|
1322
|
+ this.leadTime * 60 * 1000
|
|
1323
|
+ );
|
|
1324
|
+ });
|
|
1325
|
+ //如果勾选需要预约检查
|
|
1326
|
+ if (isYyInspect) {
|
|
1327
|
+ //筛选离当前时间最近的
|
|
1328
|
+ let timeList = this.filterLinkCheckLis
|
|
1329
|
+ .map((item) => new Date(item.yyTime).getTime())
|
|
1330
|
+ .sort();
|
|
1331
|
+ this.yyTime = new Date(timeList[0] - this.leadTime * 60 * 1000); //回显预约时间,需要减去生效时间
|
|
1332
|
+ this.yyDate = new Date(timeList[0] - this.leadTime * 60 * 1000); //回显预约日期,需要减去生效时间
|
|
1333
|
+ } else {
|
|
1334
|
+ this.yyTime = null;
|
|
1335
|
+ this.yyDate = null;
|
|
1336
|
+ }
|
|
1337
|
+ }
|
1355
|
1338
|
// 患者送检检查项目-选择检查项目
|
1356
|
1339
|
linkCheckLisTrue = false; //是否有已选择(患者)
|
1357
|
1340
|
isInspectPriority = false; //选择的检查是否紧急(患者)
|
1358
|
|
- hasTime = false; //是否有已选择,并且是否有预约时间(患者)
|
1359
|
|
- lessTime = false; //预约时间列表中预约时间少于生效时长,则是false
|
|
1341
|
+ filterLinkCheckLis = []; //有预约时间并且选中的
|
1360
|
1342
|
linkCheckLisChange(e) {
|
1361
|
1343
|
console.log(e, this.linkCheckLis);
|
1362
|
1344
|
let flag = false; //检查是否紧急
|
1363
|
1345
|
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
|
|
- });
|
|
1346
|
+ if (e.length) {
|
|
1347
|
+ //有选中的检查
|
|
1348
|
+ e.forEach((v) => {
|
|
1349
|
+ //检查是否有紧急度
|
|
1350
|
+ if (v.priority == 1) {
|
|
1351
|
+ flag = true;
|
|
1352
|
+ }
|
|
1353
|
+ //选中的检查设置checked
|
|
1354
|
+ item.checked = v.value == item.value;
|
|
1355
|
+ });
|
|
1356
|
+ } else {
|
|
1357
|
+ item.checked = false;
|
|
1358
|
+ }
|
1370
|
1359
|
});
|
|
1360
|
+
|
|
1361
|
+ //检查有紧急度,则加急
|
1371
|
1362
|
if (flag) {
|
1372
|
1363
|
this.allowUrgent = "1";
|
1373
|
1364
|
this.urgentReason = "系统根据检查信息,自动进行加急";
|
|
@@ -1376,40 +1367,45 @@ export class HushijiandanComponent implements OnInit {
|
1376
|
1367
|
this.urgentReason = "";
|
1377
|
1368
|
}
|
1378
|
1369
|
this.clickYYFlag = false;
|
1379
|
|
- let linkCheckLis = this.linkCheckLis.filter(
|
|
1370
|
+ // 有预约时间并且选中的
|
|
1371
|
+ this.filterLinkCheckLis = this.linkCheckLis.filter(
|
1380
|
1372
|
(item) => Boolean(item.yyTime) && item.checked
|
1381
|
1373
|
);
|
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);
|
|
1374
|
+ //有预约时间并且选中的检查数组不为空
|
|
1375
|
+ if (this.filterLinkCheckLis.length) {
|
|
1376
|
+ //当前时间要大于生效时间
|
|
1377
|
+ this.isYyInspect = this.filterLinkCheckLis.every((item) => {
|
|
1378
|
+ return (
|
|
1379
|
+ new Date(item.yyTime).getTime() - new Date().getTime() >
|
|
1380
|
+ this.leadTime * 60 * 1000
|
|
1381
|
+ );
|
|
1382
|
+ });
|
|
1383
|
+ this.showDateTime();
|
|
1384
|
+ } else {
|
|
1385
|
+ //有预约时间并且选中的检查数组为空
|
|
1386
|
+ this.isYyInspect = false;
|
|
1387
|
+ this.yyTime = null;
|
|
1388
|
+ this.yyDate = null;
|
1394
|
1389
|
}
|
1395
|
1390
|
this.linkCheckLisTrue = e.length > 0;
|
1396
|
1391
|
this.isInspectPriority = e.some((item) => item.priority == 1);
|
1397
|
|
- if (!this.linkCheckLisTrue) {
|
1398
|
|
- this.hasTime = false;
|
|
1392
|
+ }
|
|
1393
|
+ // 是否加急
|
|
1394
|
+ allowUrgentChange(e) {
|
|
1395
|
+ if (this.isYyInspect) {
|
|
1396
|
+ this.isYyInspect = e == 0;
|
|
1397
|
+ if (!this.isYyInspect) {
|
|
1398
|
+ this.yyDate = null;
|
|
1399
|
+ this.yyDateZy = null;
|
|
1400
|
+ this.yyTime = null;
|
|
1401
|
+ this.yyTimeZy = null;
|
|
1402
|
+ }
|
1399
|
1403
|
} else {
|
1400
|
|
- this.hasTime = this.linkCheckLis.some(
|
1401
|
|
- (item) => Boolean(item.yyTime) && item.checked
|
1402
|
|
- );
|
|
1404
|
+ this.yyDate = null;
|
|
1405
|
+ this.yyDateZy = null;
|
|
1406
|
+ this.yyTime = null;
|
|
1407
|
+ this.yyTimeZy = null;
|
1403
|
1408
|
}
|
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
|
1409
|
}
|
1414
|
1410
|
// 禁用小时
|
1415
|
1411
|
disabledHours(): number[] {
|