|
@@ -498,6 +498,42 @@ func (c *ScheduleApiController) BatchPostSmartSch() {
|
498
|
498
|
return
|
499
|
499
|
}
|
500
|
500
|
|
|
501
|
+ //daySchedule, err := service.GetDaySchedule(adminInfo.CurrentOrgId, theTime.Unix(), theTime.Unix(), patient_id)
|
|
502
|
+ //if daySchedule.ID > 0 && daySchedule.ID != schedule.ID {
|
|
503
|
+ // week_type, _ := items["week_type"].(string)
|
|
504
|
+ // week_name, _ := items["week_name"].(string)
|
|
505
|
+ //
|
|
506
|
+ // switch week_type {
|
|
507
|
+ // case "1":
|
|
508
|
+ // json := make(map[string]interface{})
|
|
509
|
+ // json["msg"] = "本周" + week_name + "该床位已经有人排班,无法保存"
|
|
510
|
+ // json["state"] = 0
|
|
511
|
+ // c.Data["json"] = json
|
|
512
|
+ // c.ServeJSON()
|
|
513
|
+ // break
|
|
514
|
+ // case "2":
|
|
515
|
+ // json := make(map[string]interface{})
|
|
516
|
+ // json["msg"] = "下周" + week_name + "当天该患者已经排班,无法保存"
|
|
517
|
+ // json["state"] = 0
|
|
518
|
+ // c.Data["json"] = json
|
|
519
|
+ // c.ServeJSON()
|
|
520
|
+ // break
|
|
521
|
+ // case "3":
|
|
522
|
+ // json := make(map[string]interface{})
|
|
523
|
+ // json["msg"] = "下下周" + week_name + "当天该患者已经排班,无法保存"
|
|
524
|
+ // json["state"] = 0
|
|
525
|
+ // c.Data["json"] = json
|
|
526
|
+ // c.ServeJSON()
|
|
527
|
+ // break
|
|
528
|
+ // }
|
|
529
|
+ //
|
|
530
|
+ // return
|
|
531
|
+ //
|
|
532
|
+ //
|
|
533
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCantSetScheduleAgainOneDay)
|
|
534
|
+ // return
|
|
535
|
+ //}
|
|
536
|
+ //
|
501
|
537
|
}
|
502
|
538
|
|
503
|
539
|
}
|
|
@@ -629,21 +665,29 @@ func (c *ScheduleApiController) BatchPostSmartSch() {
|
629
|
665
|
|
630
|
666
|
if filedRecordOne.IsShow == 1 {
|
631
|
667
|
schedule.DialysisMachineName = so.DialysisDialyszers
|
632
|
|
- //service.UpdateSchDName(schedule)
|
633
|
668
|
}
|
634
|
|
- if filedRecordTwo.IsShow == 1 {
|
635
|
|
- schedule.DialysisMachineName = so.DialysisIrrigation
|
636
|
|
- //service.UpdateSchDName(schedule)
|
|
669
|
+ if filedRecordThree.IsShow == 1 {
|
|
670
|
+ if len(schedule.DialysisMachineName) > 0 {
|
|
671
|
+ schedule.DialysisMachineName = schedule.DialysisMachineName + "," + so.DialysisIrrigation
|
|
672
|
+
|
|
673
|
+ } else {
|
|
674
|
+ schedule.DialysisMachineName = so.DialyzerPerfusionApparatus
|
|
675
|
+
|
|
676
|
+ }
|
637
|
677
|
}
|
|
678
|
+ if filedRecordTwo.IsShow == 1 {
|
|
679
|
+ if len(schedule.DialysisMachineName) > 0 {
|
|
680
|
+ schedule.DialysisMachineName = schedule.DialysisMachineName + "," + so.DialysisIrrigation
|
638
|
681
|
|
639
|
|
- if filedRecordThree.IsShow == 1 {
|
640
|
|
- schedule.DialysisMachineName = so.DialyzerPerfusionApparatus
|
641
|
|
- //service.UpdateSchDName(schedule)
|
|
682
|
+ } else {
|
|
683
|
+ schedule.DialysisMachineName = so.DialysisIrrigation
|
|
684
|
+
|
|
685
|
+ }
|
642
|
686
|
}
|
643
|
687
|
|
644
|
688
|
service.SaveSch(schedule)
|
645
|
|
-
|
646
|
689
|
} else { //新的排班信息
|
|
690
|
+
|
647
|
691
|
if items["schedule_date"] == nil || reflect.TypeOf(items["schedule_date"]).String() != "string" {
|
648
|
692
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
649
|
693
|
return
|
|
@@ -663,6 +707,7 @@ func (c *ScheduleApiController) BatchPostSmartSch() {
|
663
|
707
|
return
|
664
|
708
|
}
|
665
|
709
|
schedule.ScheduleDate = theTime.Unix()
|
|
710
|
+
|
666
|
711
|
timeNow := time.Now().Format("2006-01-02")
|
667
|
712
|
if timeNow > scheduleDate {
|
668
|
713
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCantSetScheduleBeforeNow)
|
|
@@ -751,20 +796,37 @@ func (c *ScheduleApiController) BatchPostSmartSch() {
|
751
|
796
|
|
752
|
797
|
if filedRecordOne.IsShow == 1 {
|
753
|
798
|
schedule.DialysisMachineName = so.DialysisDialyszers
|
754
|
|
- //service.UpdateSchDName(schedule)
|
755
|
799
|
}
|
756
|
|
- if filedRecordTwo.IsShow == 1 {
|
757
|
|
- schedule.DialysisMachineName = so.DialysisIrrigation
|
758
|
|
- //service.UpdateSchDName(schedule)
|
759
|
|
- }
|
760
|
|
-
|
761
|
800
|
if filedRecordThree.IsShow == 1 {
|
762
|
|
- schedule.DialysisMachineName = so.DialyzerPerfusionApparatus
|
763
|
|
- //service.UpdateSchDName(schedule)
|
|
801
|
+ if len(schedule.DialysisMachineName) > 0 {
|
|
802
|
+ schedule.DialysisMachineName = schedule.DialysisMachineName + "," + so.DialyzerPerfusionApparatus
|
|
803
|
+
|
|
804
|
+ } else {
|
|
805
|
+ schedule.DialysisMachineName = so.DialyzerPerfusionApparatus
|
|
806
|
+
|
|
807
|
+ }
|
764
|
808
|
}
|
|
809
|
+ if filedRecordTwo.IsShow == 1 {
|
|
810
|
+ if len(schedule.DialysisMachineName) > 0 {
|
|
811
|
+ schedule.DialysisMachineName = schedule.DialysisMachineName + "," + so.DialysisIrrigation
|
765
|
812
|
|
766
|
|
- service.CreateSchedule(&schedule)
|
|
813
|
+ } else {
|
|
814
|
+ schedule.DialysisMachineName = so.DialysisIrrigation
|
767
|
815
|
|
|
816
|
+ }
|
|
817
|
+ }
|
|
818
|
+
|
|
819
|
+ daySchedule, err := service.GetDaySchedule(adminInfo.CurrentOrgId, theTime.Unix(), theTime.Unix(), patient_id)
|
|
820
|
+ if daySchedule.ID > 0 {
|
|
821
|
+ daySchedule.ModeId = schedule.ModeId
|
|
822
|
+ daySchedule.ScheduleType = schedule.ScheduleType
|
|
823
|
+ daySchedule.PartitionId = schedule.PartitionId
|
|
824
|
+ daySchedule.BedId = schedule.BedId
|
|
825
|
+ daySchedule.DialysisMachineName = schedule.DialysisMachineName
|
|
826
|
+ service.SaveSch(daySchedule)
|
|
827
|
+ } else {
|
|
828
|
+ service.CreateSchedule(&schedule)
|
|
829
|
+ }
|
768
|
830
|
}
|
769
|
831
|
c.ServeSuccessJSON(map[string]interface{}{
|
770
|
832
|
"msg": "保存成功",
|
|
@@ -919,12 +981,27 @@ func (c *ScheduleApiController) GetDevicesNumbers() {
|
919
|
981
|
func (c *ScheduleApiController) GetWeekPanels() {
|
920
|
982
|
|
921
|
983
|
data, _ := c.GetInt64("data", 1)
|
922
|
|
- patitionId, _ := c.GetInt64("patitionid")
|
|
984
|
+ patitionIdStr := c.GetString("patitionid")
|
|
985
|
+ var ids []string
|
|
986
|
+ if len(patitionIdStr) > 0 {
|
|
987
|
+ ids = strings.Split(patitionIdStr, ",")
|
|
988
|
+ }
|
|
989
|
+
|
923
|
990
|
adminInfo := c.GetAdminUserInfo()
|
924
|
991
|
thisTime := time.Now()
|
925
|
992
|
year, monthTime, day := thisTime.Date()
|
926
|
993
|
month := int(monthTime)
|
927
|
994
|
_, theWeek := thisTime.ISOWeek()
|
|
995
|
+
|
|
996
|
+ lastWeek := thisTime.AddDate(0, 0, -7)
|
|
997
|
+
|
|
998
|
+ nextWeek := thisTime.AddDate(0, 0, 7)
|
|
999
|
+ nextSecWeek := thisTime.AddDate(0, 0, 14)
|
|
1000
|
+
|
|
1001
|
+ _, theLastWeek := lastWeek.ISOWeek()
|
|
1002
|
+ _, theNextWeek := nextWeek.ISOWeek()
|
|
1003
|
+ _, theNextSecWeek := nextSecWeek.ISOWeek()
|
|
1004
|
+
|
928
|
1005
|
weekDay := int(thisTime.Weekday())
|
929
|
1006
|
if weekDay == 0 {
|
930
|
1007
|
weekDay = 7
|
|
@@ -941,16 +1018,24 @@ func (c *ScheduleApiController) GetWeekPanels() {
|
941
|
1018
|
}
|
942
|
1019
|
|
943
|
1020
|
returnData := map[string]interface{}{
|
944
|
|
- "year": year,
|
945
|
|
- "month": month,
|
946
|
|
- "day": day,
|
947
|
|
- "theWeek": theWeek,
|
948
|
|
- "weekDay": weekDay,
|
949
|
|
- "weekDays": weekDays,
|
|
1021
|
+ "year": year,
|
|
1022
|
+ "month": month,
|
|
1023
|
+ "day": day,
|
|
1024
|
+ "theWeek": theWeek,
|
|
1025
|
+ "theNextWeek": theNextWeek,
|
|
1026
|
+ "theNextSecWeek": theNextSecWeek,
|
|
1027
|
+ "theLastWeek": theLastWeek,
|
|
1028
|
+ "weekDay": weekDay,
|
|
1029
|
+ "weekDays": weekDays,
|
950
|
1030
|
}
|
951
|
1031
|
|
952
|
1032
|
if data == 1 {
|
953
|
|
- partitions, _ := service.GetSchedulePartitionPanelOne(adminInfo.CurrentOrgId, patitionId)
|
|
1033
|
+ fmt.Println(ids)
|
|
1034
|
+
|
|
1035
|
+ partitions, _ := service.GetSchedulePartitionPanelOne(adminInfo.CurrentOrgId, ids)
|
|
1036
|
+ fmt.Println("````~~")
|
|
1037
|
+ fmt.Println(partitions)
|
|
1038
|
+
|
954
|
1039
|
returnData["partitions"] = partitions
|
955
|
1040
|
}
|
956
|
1041
|
|
|
@@ -1184,17 +1269,26 @@ func (c *ScheduleApiController) CreateSchedule() {
|
1184
|
1269
|
|
1185
|
1270
|
if filedRecordOne.IsShow == 1 {
|
1186
|
1271
|
schedule.DialysisMachineName = so.DialysisDialyszers
|
1187
|
|
- //service.UpdateSchDName(schedule)
|
1188
|
1272
|
}
|
1189
|
|
- if filedRecordTwo.IsShow == 1 {
|
1190
|
|
- schedule.DialysisMachineName = so.DialysisIrrigation
|
1191
|
|
- //service.UpdateSchDName(schedule)
|
|
1273
|
+ if filedRecordThree.IsShow == 1 {
|
|
1274
|
+ if len(schedule.DialysisMachineName) > 0 {
|
|
1275
|
+ schedule.DialysisMachineName = schedule.DialysisMachineName + "," + so.DialyzerPerfusionApparatus
|
|
1276
|
+
|
|
1277
|
+ } else {
|
|
1278
|
+ schedule.DialysisMachineName = so.DialyzerPerfusionApparatus
|
|
1279
|
+
|
|
1280
|
+ }
|
1192
|
1281
|
}
|
|
1282
|
+ if filedRecordTwo.IsShow == 1 {
|
|
1283
|
+ if len(schedule.DialysisMachineName) > 0 {
|
|
1284
|
+ schedule.DialysisMachineName = schedule.DialysisMachineName + "," + so.DialysisIrrigation
|
1193
|
1285
|
|
1194
|
|
- if filedRecordThree.IsShow == 1 {
|
1195
|
|
- schedule.DialysisMachineName = so.DialyzerPerfusionApparatus
|
1196
|
|
- //service.UpdateSchDName(schedule)
|
|
1286
|
+ } else {
|
|
1287
|
+ schedule.DialysisMachineName = so.DialysisIrrigation
|
|
1288
|
+
|
|
1289
|
+ }
|
1197
|
1290
|
}
|
|
1291
|
+
|
1198
|
1292
|
bed, _ := service.GetDeviceNumberByID(adminUserInfo.CurrentOrgId, schedule.BedId)
|
1199
|
1293
|
if bed == nil {
|
1200
|
1294
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDeviceNumberNotExist)
|
|
@@ -1383,13 +1477,13 @@ func (c *ScheduleApiController) ChangeSchedule() {
|
1383
|
1477
|
if changeAction == "change_mode" {
|
1384
|
1478
|
if dataBody["mode_id"] == nil || reflect.TypeOf(dataBody["mode_id"]).String() != "float64" {
|
1385
|
1479
|
utils.ErrorLog("mode_id")
|
1386
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
1480
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrongForSchMode)
|
1387
|
1481
|
return
|
1388
|
1482
|
}
|
1389
|
1483
|
modeId := int64(dataBody["mode_id"].(float64))
|
1390
|
1484
|
if modeId < 1 {
|
1391
|
1485
|
utils.ErrorLog("modeId < 1")
|
1392
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
1486
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrongForSchMode)
|
1393
|
1487
|
return
|
1394
|
1488
|
}
|
1395
|
1489
|
schedule.ModeId = modeId
|
|
@@ -1401,16 +1495,24 @@ func (c *ScheduleApiController) ChangeSchedule() {
|
1401
|
1495
|
|
1402
|
1496
|
if filedRecordOne.IsShow == 1 {
|
1403
|
1497
|
schedule.DialysisMachineName = so.DialysisDialyszers
|
1404
|
|
- //service.UpdateSchDName(schedule)
|
1405
|
1498
|
}
|
1406
|
|
- if filedRecordTwo.IsShow == 1 {
|
1407
|
|
- schedule.DialysisMachineName = so.DialysisIrrigation
|
1408
|
|
- //service.UpdateSchDName(schedule)
|
|
1499
|
+ if filedRecordThree.IsShow == 1 {
|
|
1500
|
+ if len(schedule.DialysisMachineName) > 0 {
|
|
1501
|
+ schedule.DialysisMachineName = schedule.DialysisMachineName + "," + so.DialyzerPerfusionApparatus
|
|
1502
|
+
|
|
1503
|
+ } else {
|
|
1504
|
+ schedule.DialysisMachineName = so.DialyzerPerfusionApparatus
|
|
1505
|
+
|
|
1506
|
+ }
|
1409
|
1507
|
}
|
|
1508
|
+ if filedRecordTwo.IsShow == 1 {
|
|
1509
|
+ if len(schedule.DialysisMachineName) > 0 {
|
|
1510
|
+ schedule.DialysisMachineName = schedule.DialysisMachineName + "," + so.DialysisIrrigation
|
1410
|
1511
|
|
1411
|
|
- if filedRecordThree.IsShow == 1 {
|
1412
|
|
- schedule.DialysisMachineName = so.DialyzerPerfusionApparatus
|
1413
|
|
- //service.UpdateSchDName(schedule)
|
|
1512
|
+ } else {
|
|
1513
|
+ schedule.DialysisMachineName = so.DialysisIrrigation
|
|
1514
|
+
|
|
1515
|
+ }
|
1414
|
1516
|
}
|
1415
|
1517
|
|
1416
|
1518
|
order, err := service.GetOneDialysisOrder(adminINfo.CurrentOrgId, schedule.ScheduleDate, schedule.PatientId)
|
|
@@ -2321,17 +2423,26 @@ func (this *ScheduleApiController) ExportSchedule() {
|
2321
|
2423
|
|
2322
|
2424
|
if filedRecordOne.IsShow == 1 {
|
2323
|
2425
|
sch.DialysisMachineName = so.DialysisDialyszers
|
2324
|
|
- //service.UpdateSchDName(schedule)
|
2325
|
2426
|
}
|
2326
|
|
- if filedRecordTwo.IsShow == 1 {
|
2327
|
|
- sch.DialysisMachineName = so.DialysisIrrigation
|
2328
|
|
- //service.UpdateSchDName(schedule)
|
|
2427
|
+ if filedRecordThree.IsShow == 1 {
|
|
2428
|
+ if len(sch.DialysisMachineName) > 0 {
|
|
2429
|
+ sch.DialysisMachineName = sch.DialysisMachineName + "," + so.DialyzerPerfusionApparatus
|
|
2430
|
+
|
|
2431
|
+ } else {
|
|
2432
|
+ sch.DialysisMachineName = so.DialyzerPerfusionApparatus
|
|
2433
|
+
|
|
2434
|
+ }
|
2329
|
2435
|
}
|
|
2436
|
+ if filedRecordTwo.IsShow == 1 {
|
|
2437
|
+ if len(sch.DialysisMachineName) > 0 {
|
|
2438
|
+ sch.DialysisMachineName = sch.DialysisMachineName + "," + so.DialysisIrrigation
|
2330
|
2439
|
|
2331
|
|
- if filedRecordThree.IsShow == 1 {
|
2332
|
|
- sch.DialysisMachineName = so.DialyzerPerfusionApparatus
|
2333
|
|
- //service.UpdateSchDName(schedule)
|
|
2440
|
+ } else {
|
|
2441
|
+ sch.DialysisMachineName = so.DialysisIrrigation
|
|
2442
|
+
|
|
2443
|
+ }
|
2334
|
2444
|
}
|
|
2445
|
+
|
2335
|
2446
|
schedules = append(schedules, &sch)
|
2336
|
2447
|
}
|
2337
|
2448
|
|
|
@@ -2785,10 +2896,11 @@ func (this *ScheduleApiController) ExportScheduleTemplate() {
|
2785
|
2896
|
sch.Weekday = int8(schedule_week)
|
2786
|
2897
|
|
2787
|
2898
|
}
|
2788
|
|
-
|
|
2899
|
+ treat_mode, _ := schMapM["treat_mode"].(string)
|
|
2900
|
+ treat_mode_int, _ := strconv.ParseInt(treat_mode, 10, 64)
|
2789
|
2901
|
sch.CreateTime = time.Now().Unix()
|
2790
|
2902
|
sch.ModifyTime = time.Now().Unix()
|
2791
|
|
- sch.TreatMode = 1
|
|
2903
|
+ sch.TreatMode = treat_mode_int
|
2792
|
2904
|
sch.Status = 1
|
2793
|
2905
|
sch.OrgID = this.GetAdminUserInfo().CurrentOrgId
|
2794
|
2906
|
sch.IsExport = 1
|
|
@@ -2797,22 +2909,26 @@ func (this *ScheduleApiController) ExportScheduleTemplate() {
|
2797
|
2909
|
|
2798
|
2910
|
errLogs, _ := service.FindSchedualTemplateExportLog(this.GetAdminUserInfo().CurrentOrgId, export_time)
|
2799
|
2911
|
|
|
2912
|
+ //for _, item := range schedules {
|
|
2913
|
+ //
|
|
2914
|
+ //}
|
|
2915
|
+
|
2800
|
2916
|
if len(schedules) > 0 {
|
2801
|
2917
|
err := service.UpdateScheduleTemplateStatus(this.GetAdminUserInfo().CurrentOrgId)
|
2802
|
2918
|
if err == nil {
|
2803
|
2919
|
for _, item := range schedules {
|
2804
|
2920
|
service.CreateScheduleTemplate(item)
|
2805
|
2921
|
}
|
2806
|
|
- //查询已经转出或者死亡的患者
|
2807
|
|
- patientList, _ := service.GetDeathPatient(this.GetAdminUserInfo().CurrentOrgId)
|
2808
|
|
- for _, it := range patientList {
|
2809
|
|
- timeStr := time.Now().Format("2006-01-02")
|
2810
|
|
- timeLayout := "2006-01-02 15:04:05"
|
2811
|
|
- timeStringToTime, _ := utils.ParseTimeStringToTime(timeLayout, timeStr+" 00:00:00")
|
2812
|
|
- timenow := timeStringToTime.Unix()
|
2813
|
|
- service.UpdateScheduleByDeathTime(it.ID, timenow)
|
2814
|
|
- service.UpdateScheduleItemByPatientId(it.ID)
|
2815
|
|
- }
|
|
2922
|
+ ////查询已经转出或者死亡的患者
|
|
2923
|
+ //patientList, _ := service.GetDeathPatient(this.GetAdminUserInfo().CurrentOrgId)
|
|
2924
|
+ //for _, it := range patientList {
|
|
2925
|
+ // timeStr := time.Now().Format("2006-01-02")
|
|
2926
|
+ // timeLayout := "2006-01-02 15:04:05"
|
|
2927
|
+ // timeStringToTime, _ := utils.ParseTimeStringToTime(timeLayout, timeStr+" 00:00:00")
|
|
2928
|
+ // timenow := timeStringToTime.Unix()
|
|
2929
|
+ // service.UpdateScheduleByDeathTime(it.ID, timenow)
|
|
2930
|
+ // service.UpdateScheduleItemByPatientId(it.ID)
|
|
2931
|
+ //}
|
2816
|
2932
|
log := models.ExportLog{
|
2817
|
2933
|
LogType: 3,
|
2818
|
2934
|
UserOrgId: this.GetAdminUserInfo().CurrentOrgId,
|
|
@@ -2883,9 +2999,13 @@ func (c *ScheduleApiController) GetInitExcelInitDate() {
|
2883
|
2999
|
thisTime := time.Now()
|
2884
|
3000
|
thisTime1 := time.Now()
|
2885
|
3001
|
thisTime2 := time.Now()
|
|
3002
|
+ thisTime3 := time.Now()
|
|
3003
|
+ thisTime4 := time.Now()
|
2886
|
3004
|
|
2887
|
3005
|
thisTime1 = thisTime1.AddDate(0, 0, 7)
|
2888
|
3006
|
thisTime2 = thisTime2.AddDate(0, 0, 14)
|
|
3007
|
+ thisTime3 = thisTime3.AddDate(0, 0, 21)
|
|
3008
|
+ thisTime4 = thisTime4.AddDate(0, 0, 28)
|
2889
|
3009
|
|
2890
|
3010
|
weekDay := int(thisTime.Weekday())
|
2891
|
3011
|
if weekDay == 0 {
|
|
@@ -2921,6 +3041,28 @@ func (c *ScheduleApiController) GetInitExcelInitDate() {
|
2921
|
3041
|
days = append(days, theDay.Format("2006-01-02"))
|
2922
|
3042
|
}
|
2923
|
3043
|
|
|
3044
|
+ weekDay3 := int(thisTime3.Weekday())
|
|
3045
|
+ if weekDay3 == 0 {
|
|
3046
|
+ weekDay3 = 7
|
|
3047
|
+ }
|
|
3048
|
+ weekEnd3 := 7 - weekDay3
|
|
3049
|
+ weekStart3 := weekEnd3 - 6
|
|
3050
|
+ for index := weekStart3; index <= weekEnd3; index++ {
|
|
3051
|
+ theDay := thisTime3.AddDate(0, 0, index)
|
|
3052
|
+ days = append(days, theDay.Format("2006-01-02"))
|
|
3053
|
+ }
|
|
3054
|
+
|
|
3055
|
+ weekDay4 := int(thisTime4.Weekday())
|
|
3056
|
+ if weekDay4 == 0 {
|
|
3057
|
+ weekDay4 = 7
|
|
3058
|
+ }
|
|
3059
|
+ weekEnd4 := 7 - weekDay4
|
|
3060
|
+ weekStart4 := weekEnd4 - 6
|
|
3061
|
+ for index := weekStart4; index <= weekEnd4; index++ {
|
|
3062
|
+ theDay := thisTime4.AddDate(0, 0, index)
|
|
3063
|
+ days = append(days, theDay.Format("2006-01-02"))
|
|
3064
|
+ }
|
|
3065
|
+
|
2924
|
3066
|
c.ServeSuccessJSON(map[string]interface{}{
|
2925
|
3067
|
"days": days,
|
2926
|
3068
|
})
|
|
@@ -3135,6 +3277,33 @@ func (this *ScheduleApiController) GetCopyPatientSchedules() {
|
3135
|
3277
|
CreatedTime: time.Now().Unix(),
|
3136
|
3278
|
}
|
3137
|
3279
|
|
|
3280
|
+ so, _ := service.GetDialysisSolutionTwo(adminUserInfo.CurrentOrgId, schedule.PatientId, schedule.ModeId)
|
|
3281
|
+ filedRecordOne, _ := service.FindFiledBy(adminUserInfo.CurrentOrgId, "透析器")
|
|
3282
|
+ filedRecordTwo, _ := service.FindFiledBy(adminUserInfo.CurrentOrgId, "灌流器")
|
|
3283
|
+ filedRecordThree, _ := service.FindFiledBy(adminUserInfo.CurrentOrgId, "透析器/灌流器")
|
|
3284
|
+
|
|
3285
|
+ if filedRecordOne.IsShow == 1 {
|
|
3286
|
+ schedule.DialysisMachineName = so.DialysisDialyszers
|
|
3287
|
+ }
|
|
3288
|
+ if filedRecordThree.IsShow == 1 {
|
|
3289
|
+ if len(schedule.DialysisMachineName) > 0 {
|
|
3290
|
+ schedule.DialysisMachineName = schedule.DialysisMachineName + "," + so.DialysisIrrigation
|
|
3291
|
+
|
|
3292
|
+ } else {
|
|
3293
|
+ schedule.DialysisMachineName = so.DialyzerPerfusionApparatus
|
|
3294
|
+
|
|
3295
|
+ }
|
|
3296
|
+ }
|
|
3297
|
+ if filedRecordTwo.IsShow == 1 {
|
|
3298
|
+ if len(schedule.DialysisMachineName) > 0 {
|
|
3299
|
+ schedule.DialysisMachineName = schedule.DialysisMachineName + "," + so.DialysisIrrigation
|
|
3300
|
+
|
|
3301
|
+ } else {
|
|
3302
|
+ schedule.DialysisMachineName = so.DialysisIrrigation
|
|
3303
|
+
|
|
3304
|
+ }
|
|
3305
|
+ }
|
|
3306
|
+
|
3138
|
3307
|
err = service.AddPatientSchedule(&schedule)
|
3139
|
3308
|
|
3140
|
3309
|
}
|
|
@@ -3738,7 +3907,6 @@ func (c *ScheduleApiController) SynchroSchedule() {
|
3738
|
3907
|
|
3739
|
3908
|
recordDateStr := time.Now().Format("2006-01-02")
|
3740
|
3909
|
recordDate, _ := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
|
3741
|
|
-
|
3742
|
3910
|
nowtime := recordDate.Unix()
|
3743
|
3911
|
fmt.Println("今日时间", nowtime)
|
3744
|
3912
|
fmt.Println("后期日期", copy_startime)
|
|
@@ -3752,13 +3920,11 @@ func (c *ScheduleApiController) SynchroSchedule() {
|
3752
|
3920
|
if copy_startime > nowtime {
|
3753
|
3921
|
//清空该时间段的所有排班数据
|
3754
|
3922
|
service.DeletePatientSchedule(copy_startime, copy_endtime, orgId)
|
3755
|
|
-
|
3756
|
3923
|
tuesday = copy_startime + 86400
|
3757
|
3924
|
wednesday = copy_startime + 172800
|
3758
|
3925
|
thursday = copy_startime + 259200
|
3759
|
3926
|
friday = copy_startime + 345600
|
3760
|
3927
|
saturday = copy_startime + 432000
|
3761
|
|
-
|
3762
|
3928
|
for _, item := range list {
|
3763
|
3929
|
if item.Weekday == 1 {
|
3764
|
3930
|
item.ScheduleDate = copy_startime
|
|
@@ -3786,7 +3952,6 @@ func (c *ScheduleApiController) SynchroSchedule() {
|
3786
|
3952
|
number, _ := service.GetBedNumberById(item.DeviceNumberID, orgId)
|
3787
|
3953
|
item.ZoneId = number.ZoneID
|
3788
|
3954
|
}
|
3789
|
|
-
|
3790
|
3955
|
for _, item := range list {
|
3791
|
3956
|
schedule := models.XtSchedule{
|
3792
|
3957
|
UserOrgId: orgId,
|
|
@@ -3802,6 +3967,33 @@ func (c *ScheduleApiController) SynchroSchedule() {
|
3802
|
3967
|
UpdatedTime: 0,
|
3803
|
3968
|
}
|
3804
|
3969
|
|
|
3970
|
+ so, _ := service.GetDialysisSolutionTwo(c.GetAdminUserInfo().CurrentOrgId, schedule.PatientId, schedule.ModeId)
|
|
3971
|
+ filedRecordOne, _ := service.FindFiledBy(c.GetAdminUserInfo().CurrentOrgId, "透析器")
|
|
3972
|
+ filedRecordTwo, _ := service.FindFiledBy(c.GetAdminUserInfo().CurrentOrgId, "灌流器")
|
|
3973
|
+ filedRecordThree, _ := service.FindFiledBy(c.GetAdminUserInfo().CurrentOrgId, "透析器/灌流器")
|
|
3974
|
+
|
|
3975
|
+ if filedRecordOne.IsShow == 1 {
|
|
3976
|
+ schedule.DialysisMachineName = so.DialysisDialyszers
|
|
3977
|
+ }
|
|
3978
|
+ if filedRecordThree.IsShow == 1 {
|
|
3979
|
+ if len(schedule.DialysisMachineName) > 0 {
|
|
3980
|
+ schedule.DialysisMachineName = schedule.DialysisMachineName + "," + so.DialyzerPerfusionApparatus
|
|
3981
|
+
|
|
3982
|
+ } else {
|
|
3983
|
+ schedule.DialysisMachineName = so.DialyzerPerfusionApparatus
|
|
3984
|
+
|
|
3985
|
+ }
|
|
3986
|
+ }
|
|
3987
|
+ if filedRecordTwo.IsShow == 1 {
|
|
3988
|
+ if len(schedule.DialysisMachineName) > 0 {
|
|
3989
|
+ schedule.DialysisMachineName = schedule.DialysisMachineName + "," + so.DialysisIrrigation
|
|
3990
|
+
|
|
3991
|
+ } else {
|
|
3992
|
+ schedule.DialysisMachineName = so.DialysisIrrigation
|
|
3993
|
+
|
|
3994
|
+ }
|
|
3995
|
+ }
|
|
3996
|
+
|
3805
|
3997
|
service.CreatePatientSchedule(&schedule)
|
3806
|
3998
|
}
|
3807
|
3999
|
}
|
|
@@ -3848,7 +4040,6 @@ func (c *ScheduleApiController) SynchroSchedule() {
|
3848
|
4040
|
number, _ := service.GetBedNumberById(item.DeviceNumberID, orgId)
|
3849
|
4041
|
item.ZoneId = number.ZoneID
|
3850
|
4042
|
}
|
3851
|
|
-
|
3852
|
4043
|
for _, item := range list {
|
3853
|
4044
|
// 同步今日以后的数据
|
3854
|
4045
|
if item.ScheduleDate > nowtime {
|
|
@@ -3865,10 +4056,35 @@ func (c *ScheduleApiController) SynchroSchedule() {
|
3865
|
4056
|
CreatedTime: time.Now().Unix(),
|
3866
|
4057
|
UpdatedTime: 0,
|
3867
|
4058
|
}
|
|
4059
|
+ so, _ := service.GetDialysisSolutionTwo(c.GetAdminUserInfo().CurrentOrgId, schedule.PatientId, schedule.ModeId)
|
|
4060
|
+ filedRecordOne, _ := service.FindFiledBy(c.GetAdminUserInfo().CurrentOrgId, "透析器")
|
|
4061
|
+ filedRecordTwo, _ := service.FindFiledBy(c.GetAdminUserInfo().CurrentOrgId, "灌流器")
|
|
4062
|
+ filedRecordThree, _ := service.FindFiledBy(c.GetAdminUserInfo().CurrentOrgId, "透析器/灌流器")
|
|
4063
|
+
|
|
4064
|
+ if filedRecordOne.IsShow == 1 {
|
|
4065
|
+ schedule.DialysisMachineName = so.DialysisDialyszers
|
|
4066
|
+ }
|
|
4067
|
+ if filedRecordThree.IsShow == 1 {
|
|
4068
|
+ if len(schedule.DialysisMachineName) > 0 {
|
|
4069
|
+ schedule.DialysisMachineName = schedule.DialysisMachineName + "," + so.DialyzerPerfusionApparatus
|
|
4070
|
+
|
|
4071
|
+ } else {
|
|
4072
|
+ schedule.DialysisMachineName = so.DialyzerPerfusionApparatus
|
|
4073
|
+
|
|
4074
|
+ }
|
|
4075
|
+ }
|
|
4076
|
+ if filedRecordTwo.IsShow == 1 {
|
|
4077
|
+ if len(schedule.DialysisMachineName) > 0 {
|
|
4078
|
+ schedule.DialysisMachineName = schedule.DialysisMachineName + "," + so.DialysisIrrigation
|
|
4079
|
+
|
|
4080
|
+ } else {
|
|
4081
|
+ schedule.DialysisMachineName = so.DialysisIrrigation
|
|
4082
|
+
|
|
4083
|
+ }
|
|
4084
|
+ }
|
3868
|
4085
|
service.CreatePatientSchedule(&schedule)
|
3869
|
4086
|
}
|
3870
|
4087
|
}
|
3871
|
|
-
|
3872
|
4088
|
}
|
3873
|
4089
|
|
3874
|
4090
|
returnData := make(map[string]interface{}, 0)
|