|
@@ -30,6 +30,8 @@ import {
|
30
|
30
|
setSeconds,
|
31
|
31
|
addDays,
|
32
|
32
|
differenceInCalendarDays,
|
|
33
|
+ getHours,
|
|
34
|
+ getDate,
|
33
|
35
|
} from "date-fns";
|
34
|
36
|
// 日期禁用
|
35
|
37
|
function range(start: number, end: number): number[] {
|
|
@@ -270,7 +272,52 @@ export class HushijiandanComponent implements OnInit {
|
270
|
272
|
};
|
271
|
273
|
return this.mainService.getFetchDataList("configuration", "taskType", list);
|
272
|
274
|
}
|
273
|
|
-
|
|
275
|
+ //修改预约建单时间的日期
|
|
276
|
+ yyDateChange(e) {
|
|
277
|
+ // 获取年月日
|
|
278
|
+ let yyDate = new Date(e);
|
|
279
|
+ let year = yyDate.getFullYear();
|
|
280
|
+ let month = yyDate.getMonth();
|
|
281
|
+ let date = yyDate.getDate();
|
|
282
|
+ // 获取当前时间的年月日
|
|
283
|
+ let now = new Date();
|
|
284
|
+ let nYear = now.getFullYear();
|
|
285
|
+ let nMonth = now.getMonth();
|
|
286
|
+ let nDate = now.getDate();
|
|
287
|
+ if (year != nYear || month != nMonth || date != nDate) {
|
|
288
|
+ this.disabledHours = () => [];
|
|
289
|
+ this.disabledMinutes = (hour) => [];
|
|
290
|
+ } else {
|
|
291
|
+ // 禁用小时
|
|
292
|
+ this.disabledHours = () => {
|
|
293
|
+ let now = new Date();
|
|
294
|
+ let nHour = now.getHours();
|
|
295
|
+ let nMinute = now.getMinutes();
|
|
296
|
+ if (nMinute > 30) {
|
|
297
|
+ return range(0, nHour + 1);
|
|
298
|
+ } else {
|
|
299
|
+ return range(0, nHour);
|
|
300
|
+ }
|
|
301
|
+ };
|
|
302
|
+ // 禁用分钟
|
|
303
|
+ this.disabledMinutes = (hour) => {
|
|
304
|
+ let now = new Date();
|
|
305
|
+ let nHour = now.getHours();
|
|
306
|
+ let nMinute = now.getMinutes();
|
|
307
|
+ if (hour === nHour || hour === undefined) {
|
|
308
|
+ if (nMinute == 0) {
|
|
309
|
+ return [];
|
|
310
|
+ } else if (nMinute <= 30 && nMinute > 0) {
|
|
311
|
+ return [0];
|
|
312
|
+ } else {
|
|
313
|
+ return [0, 30];
|
|
314
|
+ }
|
|
315
|
+ } else {
|
|
316
|
+ return [];
|
|
317
|
+ }
|
|
318
|
+ };
|
|
319
|
+ }
|
|
320
|
+ }
|
274
|
321
|
// 关闭其他建单保存结果
|
275
|
322
|
closeModel(e) {
|
276
|
323
|
console.log(e);
|
|
@@ -701,12 +748,12 @@ export class HushijiandanComponent implements OnInit {
|
701
|
748
|
// 下一日(陪检)
|
702
|
749
|
nextDay() {
|
703
|
750
|
this.yyDate = addDays(this.yyDate, 1);
|
704
|
|
- this.yyTime = addDays(this.yyTime, 1);
|
|
751
|
+ this.yyDateChange(this.yyDate);
|
705
|
752
|
}
|
706
|
753
|
// 下一日(转运)
|
707
|
754
|
nextDayZy() {
|
708
|
755
|
this.yyDateZy = addDays(this.yyDateZy, 1);
|
709
|
|
- this.yyTimeZy = addDays(this.yyTimeZy, 1);
|
|
756
|
+ this.yyDateChange(this.yyDateZy);
|
710
|
757
|
}
|
711
|
758
|
// 禁用日期(陪检)
|
712
|
759
|
disabledyyDate = (current: Date): boolean => {
|
|
@@ -878,7 +925,20 @@ export class HushijiandanComponent implements OnInit {
|
878
|
925
|
}
|
879
|
926
|
yyTimeChange(e) {
|
880
|
927
|
if (this.yyTime) {
|
881
|
|
- if (getMinutes(this.yyTime) != 30) {
|
|
928
|
+ let now = new Date();
|
|
929
|
+ // 禁用日期(陪检)
|
|
930
|
+ if (getHours(this.yyTime) < getHours(now)) {
|
|
931
|
+ this.disabledyyDate = (current: Date): boolean => {
|
|
932
|
+ return differenceInCalendarDays(current, new Date()) < 1;
|
|
933
|
+ };
|
|
934
|
+ } else {
|
|
935
|
+ this.disabledyyDate = (current: Date): boolean => {
|
|
936
|
+ return differenceInCalendarDays(current, new Date()) < 0;
|
|
937
|
+ };
|
|
938
|
+ }
|
|
939
|
+ if (getMinutes(this.yyTime) > 0 && getMinutes(this.yyTime) < 30) {
|
|
940
|
+ this.yyTime = setMinutes(this.yyTime, 30);
|
|
941
|
+ } else if (getMinutes(this.yyTime) > 30 && getMinutes(this.yyTime) < 60){
|
882
|
942
|
this.yyTime = setMinutes(this.yyTime, 0);
|
883
|
943
|
}
|
884
|
944
|
}
|
|
@@ -886,7 +946,20 @@ export class HushijiandanComponent implements OnInit {
|
886
|
946
|
}
|
887
|
947
|
yyTimeZyChange(e) {
|
888
|
948
|
if (this.yyTimeZy) {
|
889
|
|
- if (getMinutes(this.yyTimeZy) != 30) {
|
|
949
|
+ let now = new Date();
|
|
950
|
+ // 禁用日期(转运)
|
|
951
|
+ if (getHours(this.yyTimeZy) < getHours(now)) {
|
|
952
|
+ this.disabledyyDateZy = (current: Date): boolean => {
|
|
953
|
+ return differenceInCalendarDays(current, new Date()) < 1;
|
|
954
|
+ };
|
|
955
|
+ } else {
|
|
956
|
+ this.disabledyyDateZy = (current: Date): boolean => {
|
|
957
|
+ return differenceInCalendarDays(current, new Date()) < 0;
|
|
958
|
+ };
|
|
959
|
+ }
|
|
960
|
+ if (getMinutes(this.yyTimeZy) > 0 && getMinutes(this.yyTimeZy) < 30) {
|
|
961
|
+ this.yyTimeZy = setMinutes(this.yyTimeZy, 30);
|
|
962
|
+ } else if (getMinutes(this.yyTimeZy) > 30 && getMinutes(this.yyTimeZy) < 60) {
|
890
|
963
|
this.yyTimeZy = setMinutes(this.yyTimeZy, 0);
|
891
|
964
|
}
|
892
|
965
|
}
|
|
@@ -925,12 +998,28 @@ export class HushijiandanComponent implements OnInit {
|
925
|
998
|
);
|
926
|
999
|
});
|
927
|
1000
|
//预约时间-患者陪检不能为空
|
|
1001
|
+ console.log(this.yyTime, this.yyTimeZy, flag, yuyue);
|
928
|
1002
|
if (
|
929
|
|
- (!this.yyTime && !this.yyDate && !flag && yuyue === "patient-yuyue") ||
|
930
|
|
- (!this.yyTimeZy && !this.yyDateZy && flag && yuyue === "patient-zy-yuyue")
|
|
1003
|
+ (!this.yyTime && !flag && yuyue === "patient-yuyue") ||
|
|
1004
|
+ (!this.yyTimeZy && flag && yuyue === "patient-zy-yuyue")
|
931
|
1005
|
) {
|
932
|
1006
|
return;
|
933
|
1007
|
}
|
|
1008
|
+ if (flag) {
|
|
1009
|
+ //转运
|
|
1010
|
+ this.yyTimeZy =
|
|
1011
|
+ format(new Date(this.yyDateZy), "yyyy-MM-dd") +
|
|
1012
|
+ " " +
|
|
1013
|
+ format(new Date(this.yyTimeZy), "HH:mm") +
|
|
1014
|
+ ":00";
|
|
1015
|
+ } else {
|
|
1016
|
+ //陪检
|
|
1017
|
+ this.yyTime =
|
|
1018
|
+ format(new Date(this.yyDate), "yyyy-MM-dd") +
|
|
1019
|
+ " " +
|
|
1020
|
+ format(new Date(this.yyTime), "HH:mm") +
|
|
1021
|
+ ":00";
|
|
1022
|
+ }
|
934
|
1023
|
var that = this;
|
935
|
1024
|
for (const i in that.patientForm.controls) {
|
936
|
1025
|
that.patientForm.controls[i].markAsDirty();
|
|
@@ -1024,6 +1113,11 @@ export class HushijiandanComponent implements OnInit {
|
1024
|
1113
|
} else {
|
1025
|
1114
|
if (!yy && that.checkedShowMsg.status == 200) {
|
1026
|
1115
|
postData.workOrder["checkList"] = checkedArr;
|
|
1116
|
+ // 添加预约时间
|
|
1117
|
+ if (yuyue) {
|
|
1118
|
+ postData.workOrder.yyTime =
|
|
1119
|
+ format(new Date(this.yyTime), "yyyy-MM-dd HH:mm") + ":00";
|
|
1120
|
+ }
|
1027
|
1121
|
} else {
|
1028
|
1122
|
delete postData.workOrder["checkList"];
|
1029
|
1123
|
// 添加预约时间
|
|
@@ -1327,6 +1421,7 @@ export class HushijiandanComponent implements OnInit {
|
1327
|
1421
|
.sort();
|
1328
|
1422
|
this.yyTime = new Date(timeList[0] - this.leadTime * 60 * 1000); //回显预约时间,需要减去生效时间
|
1329
|
1423
|
this.yyDate = new Date(timeList[0] - this.leadTime * 60 * 1000); //回显预约日期,需要减去生效时间
|
|
1424
|
+ this.yyDateChange(this.yyTime);
|
1330
|
1425
|
} else {
|
1331
|
1426
|
this.yyTime = null;
|
1332
|
1427
|
this.yyDate = null;
|