|
@@ -72,7 +72,7 @@ func ScheduleApiRegistRouters() {
|
72
|
72
|
beego.Router("/api/schedule/getpatientscheduletemplate", &ScheduleApiController{}, "Get:GetPatientScheduleTempalate")
|
73
|
73
|
beego.Router("/api/schedule/getsolutionschedule", &ScheduleApiController{}, "Get:GetSolutionSchedule")
|
74
|
74
|
|
75
|
|
- beego.Router("/api/schedule/smartpatientsch", &ScheduleApiController{}, "Get:GetPatientSch")
|
|
75
|
+ beego.Router("/api/schedule/smartpatientsch", &ScheduleApiController{}, "Get:GetPatient")
|
76
|
76
|
beego.Router("/api/schedule/smartpatientschtemplate", &ScheduleApiController{}, "Get:GetPatientSchTemplate")
|
77
|
77
|
|
78
|
78
|
beego.Router("/api/patient/smartpatientsch", &ScheduleApiController{}, "Get:GetPatientSmartSch")
|
|
@@ -83,6 +83,8 @@ func ScheduleApiRegistRouters() {
|
83
|
83
|
|
84
|
84
|
beego.Router("/api/smartsch/batch", &ScheduleApiController{}, "Post:BatchPostSmartSch")
|
85
|
85
|
|
|
86
|
+ beego.Router("/api/smartsch/get", &ScheduleApiController{}, "Get:GetSmartSch")
|
|
87
|
+
|
86
|
88
|
}
|
87
|
89
|
func (c *ScheduleApiController) BatchPostSmartSch() {
|
88
|
90
|
patient_id, _ := c.GetInt64("patient_id")
|
|
@@ -119,6 +121,7 @@ func (c *ScheduleApiController) BatchPostSmartSch() {
|
119
|
121
|
sch_id := int64(items["sch_id"].(float64))
|
120
|
122
|
if sch_id > 0 { //修改排班信息
|
121
|
123
|
schedule, _ = service.GetScheduleTwo(adminInfo.CurrentOrgId, sch_id)
|
|
124
|
+ fmt.Println("2222222")
|
122
|
125
|
|
123
|
126
|
if items["mode_id"] == nil || reflect.TypeOf(items["mode_id"]).String() != "float64" {
|
124
|
127
|
utils.ErrorLog("mode_id")
|
|
@@ -381,7 +384,10 @@ func (c *ScheduleApiController) BatchPostSmartSch() {
|
381
|
384
|
|
382
|
385
|
} else { //新的排班信息
|
383
|
386
|
|
|
387
|
+ fmt.Println("111111111")
|
384
|
388
|
if items["schedule_date"] == nil || reflect.TypeOf(items["schedule_date"]).String() != "string" {
|
|
389
|
+ fmt.Println("33333333")
|
|
390
|
+
|
385
|
391
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
386
|
392
|
return
|
387
|
393
|
}
|
|
@@ -400,6 +406,15 @@ func (c *ScheduleApiController) BatchPostSmartSch() {
|
400
|
406
|
return
|
401
|
407
|
}
|
402
|
408
|
schedule.ScheduleDate = theTime.Unix()
|
|
409
|
+ //existSch,_ := service.GetScheduleByDate(c.GetAdminUserInfo().CurrentOrgId,schedule.ScheduleDate,patient_id)
|
|
410
|
+ //
|
|
411
|
+ //if existSch.ID > 0{
|
|
412
|
+ // fmt.Println("555555555")
|
|
413
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
414
|
+ // return
|
|
415
|
+ //
|
|
416
|
+ //}
|
|
417
|
+
|
403
|
418
|
timeNow := time.Now().Format("2006-01-02")
|
404
|
419
|
if timeNow > scheduleDate {
|
405
|
420
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCantSetScheduleBeforeNow)
|
|
@@ -468,7 +483,10 @@ func (c *ScheduleApiController) BatchPostSmartSch() {
|
468
|
483
|
|
469
|
484
|
sch, _ := service.GetScheduleByZoneAndBed(adminInfo.CurrentOrgId, partitionId, bedId, schedule.ScheduleDate, schedule.ScheduleType)
|
470
|
485
|
|
471
|
|
- if sch.ID > 0 {
|
|
486
|
+ fmt.Println(sch.PatientId)
|
|
487
|
+ fmt.Println(schedule.PatientId)
|
|
488
|
+
|
|
489
|
+ if sch.ID > 0 && sch.PatientId != patient_id {
|
472
|
490
|
week_type, _ := items["week_type"].(string)
|
473
|
491
|
week_name, _ := items["week_name"].(string)
|
474
|
492
|
|
|
@@ -540,7 +558,32 @@ func (c *ScheduleApiController) BatchPostSmartSch() {
|
540
|
558
|
}
|
541
|
559
|
}
|
542
|
560
|
}
|
|
561
|
+ ////删除数据
|
|
562
|
+ if dataBody["del_schs"] != nil && reflect.TypeOf(dataBody["del_schs"]).String() == "[]interface {}" {
|
543
|
563
|
|
|
564
|
+ schs, _ := dataBody["del_schs"].([]interface{})
|
|
565
|
+ if len(schs) > 0 {
|
|
566
|
+ for _, item := range schs {
|
|
567
|
+ items := item.(map[string]interface{})
|
|
568
|
+ if items["sch_id"] == nil || reflect.TypeOf(items["sch_id"]).String() != "float64" {
|
|
569
|
+ utils.ErrorLog("id")
|
|
570
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
571
|
+ return
|
|
572
|
+ }
|
|
573
|
+ var schedule models.Schedule
|
|
574
|
+ sch_id := int64(items["sch_id"].(float64))
|
|
575
|
+ if sch_id > 0 { //修改排班信息
|
|
576
|
+ schedule, _ = service.GetScheduleTwo(adminInfo.CurrentOrgId, sch_id)
|
|
577
|
+ schedule.Status = 0
|
|
578
|
+ service.SaveSch(schedule)
|
|
579
|
+ }
|
|
580
|
+
|
|
581
|
+ HandleRedis(adminInfo.CurrentOrgId, schedule.ScheduleDate)
|
|
582
|
+
|
|
583
|
+ }
|
|
584
|
+ }
|
|
585
|
+ }
|
|
586
|
+ ////修改或保存数据
|
544
|
587
|
if dataBody["smart_schs"] != nil && reflect.TypeOf(dataBody["smart_schs"]).String() == "[]interface {}" {
|
545
|
588
|
|
546
|
589
|
schs, _ := dataBody["smart_schs"].([]interface{})
|
|
@@ -658,33 +701,34 @@ func (c *ScheduleApiController) BatchPostSmartSch() {
|
658
|
701
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePointScheduleExist)
|
659
|
702
|
return
|
660
|
703
|
}
|
661
|
|
-
|
|
704
|
+ var DialysisMachineName string
|
662
|
705
|
so, _ := service.GetDialysisSolutionTwo(adminInfo.CurrentOrgId, schedule.PatientId, schedule.ModeId)
|
663
|
706
|
filedRecordOne, _ := service.FindFiledBy(adminInfo.CurrentOrgId, "透析器")
|
664
|
707
|
filedRecordTwo, _ := service.FindFiledBy(adminInfo.CurrentOrgId, "灌流器")
|
665
|
708
|
filedRecordThree, _ := service.FindFiledBy(adminInfo.CurrentOrgId, "透析器/灌流器")
|
666
|
709
|
|
667
|
710
|
if filedRecordOne.IsShow == 1 {
|
668
|
|
- schedule.DialysisMachineName = so.DialysisDialyszers
|
|
711
|
+ DialysisMachineName = so.DialysisDialyszers
|
669
|
712
|
}
|
670
|
713
|
if filedRecordThree.IsShow == 1 {
|
671
|
|
- if len(schedule.DialysisMachineName) > 0 {
|
672
|
|
- schedule.DialysisMachineName = schedule.DialysisMachineName + "," + so.DialysisIrrigation
|
|
714
|
+ if len(DialysisMachineName) > 0 {
|
|
715
|
+ DialysisMachineName = DialysisMachineName + "," + so.DialysisIrrigation
|
673
|
716
|
|
674
|
717
|
} else {
|
675
|
|
- schedule.DialysisMachineName = so.DialyzerPerfusionApparatus
|
|
718
|
+ DialysisMachineName = so.DialyzerPerfusionApparatus
|
676
|
719
|
|
677
|
720
|
}
|
678
|
721
|
}
|
679
|
722
|
if filedRecordTwo.IsShow == 1 {
|
680
|
|
- if len(schedule.DialysisMachineName) > 0 {
|
681
|
|
- schedule.DialysisMachineName = schedule.DialysisMachineName + "," + so.DialysisIrrigation
|
|
723
|
+ if len(DialysisMachineName) > 0 {
|
|
724
|
+ DialysisMachineName = DialysisMachineName + "," + so.DialysisIrrigation
|
682
|
725
|
|
683
|
726
|
} else {
|
684
|
|
- schedule.DialysisMachineName = so.DialysisIrrigation
|
|
727
|
+ DialysisMachineName = so.DialysisIrrigation
|
685
|
728
|
|
686
|
729
|
}
|
687
|
730
|
}
|
|
731
|
+ schedule.DialysisMachineName = DialysisMachineName
|
688
|
732
|
|
689
|
733
|
service.SaveSch(schedule)
|
690
|
734
|
} else { //新的排班信息
|
|
@@ -778,17 +822,11 @@ func (c *ScheduleApiController) BatchPostSmartSch() {
|
778
|
822
|
|
779
|
823
|
sch, _ := service.GetScheduleByZoneAndBed(adminInfo.CurrentOrgId, partitionId, bedId, schedule.ScheduleDate, schedule.ScheduleType)
|
780
|
824
|
|
781
|
|
- if sch.ID > 0 {
|
|
825
|
+ if sch.ID > 0 && sch.PatientId != patient_id {
|
782
|
826
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorSchedualcRepeatBed)
|
783
|
827
|
return
|
784
|
828
|
}
|
785
|
|
-
|
786
|
|
- schedule.ModeId = modeId
|
787
|
|
- schedule.PatientId = patient_id
|
788
|
|
- schedule.CreatedTime = time.Now().Unix()
|
789
|
|
- schedule.UpdatedTime = time.Now().Unix()
|
790
|
|
- schedule.Status = 1
|
791
|
|
- schedule.UserOrgId = adminInfo.CurrentOrgId
|
|
829
|
+ var DialysisMachineName string
|
792
|
830
|
|
793
|
831
|
so, _ := service.GetDialysisSolutionTwo(adminInfo.CurrentOrgId, schedule.PatientId, schedule.ModeId)
|
794
|
832
|
filedRecordOne, _ := service.FindFiledBy(adminInfo.CurrentOrgId, "透析器")
|
|
@@ -796,48 +834,98 @@ func (c *ScheduleApiController) BatchPostSmartSch() {
|
796
|
834
|
filedRecordThree, _ := service.FindFiledBy(adminInfo.CurrentOrgId, "透析器/灌流器")
|
797
|
835
|
|
798
|
836
|
if filedRecordOne.IsShow == 1 {
|
799
|
|
- schedule.DialysisMachineName = so.DialysisDialyszers
|
|
837
|
+ DialysisMachineName = so.DialysisDialyszers
|
800
|
838
|
}
|
801
|
839
|
if filedRecordThree.IsShow == 1 {
|
802
|
840
|
if len(schedule.DialysisMachineName) > 0 {
|
803
|
|
- schedule.DialysisMachineName = schedule.DialysisMachineName + "," + so.DialyzerPerfusionApparatus
|
|
841
|
+ DialysisMachineName = DialysisMachineName + "," + so.DialyzerPerfusionApparatus
|
804
|
842
|
|
805
|
843
|
} else {
|
806
|
|
- schedule.DialysisMachineName = so.DialyzerPerfusionApparatus
|
|
844
|
+ DialysisMachineName = so.DialyzerPerfusionApparatus
|
807
|
845
|
|
808
|
846
|
}
|
809
|
847
|
}
|
810
|
848
|
if filedRecordTwo.IsShow == 1 {
|
811
|
|
- if len(schedule.DialysisMachineName) > 0 {
|
812
|
|
- schedule.DialysisMachineName = schedule.DialysisMachineName + "," + so.DialysisIrrigation
|
|
849
|
+ if len(DialysisMachineName) > 0 {
|
|
850
|
+ DialysisMachineName = DialysisMachineName + "," + so.DialysisIrrigation
|
813
|
851
|
|
814
|
852
|
} else {
|
815
|
|
- schedule.DialysisMachineName = so.DialysisIrrigation
|
|
853
|
+ DialysisMachineName = so.DialysisIrrigation
|
816
|
854
|
|
817
|
855
|
}
|
818
|
856
|
}
|
|
857
|
+ schedule.DialysisMachineName = DialysisMachineName
|
|
858
|
+
|
|
859
|
+ //判断当前保存的患者是否已经有排班
|
|
860
|
+ existSchedule, _ := service.GetScheduleByDate(adminInfo.CurrentOrgId, schedule.ScheduleDate, schedule.PatientId)
|
|
861
|
+ if existSchedule.ID > 0 {
|
|
862
|
+ existSchedule.ModeId = modeId
|
|
863
|
+ existSchedule.BedId = schedule.BedId
|
|
864
|
+ existSchedule.PartitionId = schedule.PartitionId
|
|
865
|
+ existSchedule.ScheduleType = schedule.ScheduleType
|
|
866
|
+ existSchedule.DialysisMachineName = schedule.DialysisMachineName
|
|
867
|
+ service.SaveSmartSch(existSchedule)
|
819
|
868
|
|
820
|
|
- daySchedule, err := service.GetDaySchedule(adminInfo.CurrentOrgId, theTime.Unix(), theTime.Unix(), patient_id)
|
821
|
|
- if daySchedule.ID > 0 {
|
822
|
|
- daySchedule.ModeId = schedule.ModeId
|
823
|
|
- daySchedule.ScheduleType = schedule.ScheduleType
|
824
|
|
- daySchedule.PartitionId = schedule.PartitionId
|
825
|
|
- daySchedule.BedId = schedule.BedId
|
826
|
|
- daySchedule.DialysisMachineName = schedule.DialysisMachineName
|
827
|
|
- service.SaveSch(daySchedule)
|
828
|
869
|
} else {
|
829
|
|
- service.CreateSchedule(&schedule)
|
|
870
|
+ schedule.ModeId = modeId
|
|
871
|
+ schedule.PatientId = patient_id
|
|
872
|
+ schedule.CreatedTime = time.Now().Unix()
|
|
873
|
+ schedule.UpdatedTime = time.Now().Unix()
|
|
874
|
+ schedule.Status = 1
|
|
875
|
+ schedule.UserOrgId = adminInfo.CurrentOrgId
|
|
876
|
+
|
|
877
|
+ var DialysisMachineName string
|
|
878
|
+ so, _ := service.GetDialysisSolutionTwo(adminInfo.CurrentOrgId, schedule.PatientId, schedule.ModeId)
|
|
879
|
+ filedRecordOne, _ := service.FindFiledBy(adminInfo.CurrentOrgId, "透析器")
|
|
880
|
+ filedRecordTwo, _ := service.FindFiledBy(adminInfo.CurrentOrgId, "灌流器")
|
|
881
|
+ filedRecordThree, _ := service.FindFiledBy(adminInfo.CurrentOrgId, "透析器/灌流器")
|
|
882
|
+
|
|
883
|
+ if filedRecordOne.IsShow == 1 {
|
|
884
|
+ DialysisMachineName = so.DialysisDialyszers
|
|
885
|
+ }
|
|
886
|
+ if filedRecordThree.IsShow == 1 {
|
|
887
|
+ if len(DialysisMachineName) > 0 {
|
|
888
|
+ DialysisMachineName = DialysisMachineName + "," + so.DialyzerPerfusionApparatus
|
|
889
|
+
|
|
890
|
+ } else {
|
|
891
|
+ DialysisMachineName = so.DialyzerPerfusionApparatus
|
|
892
|
+
|
|
893
|
+ }
|
|
894
|
+ }
|
|
895
|
+ if filedRecordTwo.IsShow == 1 {
|
|
896
|
+ if len(DialysisMachineName) > 0 {
|
|
897
|
+ DialysisMachineName = DialysisMachineName + "," + so.DialysisIrrigation
|
|
898
|
+
|
|
899
|
+ } else {
|
|
900
|
+ DialysisMachineName = so.DialysisIrrigation
|
|
901
|
+
|
|
902
|
+ }
|
|
903
|
+ }
|
|
904
|
+ schedule.DialysisMachineName = DialysisMachineName
|
|
905
|
+ //schedule.DialysisMachineName = schedule.DialysisMachineName
|
|
906
|
+ daySchedule, _ := service.GetDaySchedule(adminInfo.CurrentOrgId, theTime.Unix(), theTime.Unix(), patient_id)
|
|
907
|
+ if daySchedule.ID > 0 {
|
|
908
|
+ daySchedule.ModeId = schedule.ModeId
|
|
909
|
+ daySchedule.ScheduleType = schedule.ScheduleType
|
|
910
|
+ daySchedule.PartitionId = schedule.PartitionId
|
|
911
|
+ daySchedule.BedId = schedule.BedId
|
|
912
|
+ daySchedule.DialysisMachineName = schedule.DialysisMachineName
|
|
913
|
+ service.SaveSch(daySchedule)
|
|
914
|
+ } else {
|
|
915
|
+ service.CreateSchedule(&schedule)
|
|
916
|
+ }
|
830
|
917
|
}
|
831
|
918
|
}
|
|
919
|
+
|
832
|
920
|
c.ServeSuccessJSON(map[string]interface{}{
|
833
|
921
|
"msg": "保存成功",
|
834
|
922
|
})
|
835
|
|
-
|
836
|
923
|
HandleRedis(adminInfo.CurrentOrgId, schedule.ScheduleDate)
|
837
|
924
|
|
838
|
925
|
}
|
839
|
926
|
}
|
840
|
927
|
}
|
|
928
|
+
|
841
|
929
|
}
|
842
|
930
|
func HandleRedis(org_id int64, sch_date int64) {
|
843
|
931
|
redis := service.RedisClient()
|
|
@@ -861,7 +949,25 @@ func HandleRedis(org_id int64, sch_date int64) {
|
861
|
949
|
|
862
|
950
|
}
|
863
|
951
|
|
864
|
|
-func (c *ScheduleApiController) GetPatientSch() {
|
|
952
|
+func (c *ScheduleApiController) GetSmartSch() {
|
|
953
|
+ patient_id, _ := c.GetInt64("patient_id")
|
|
954
|
+ fmt.Println("~~~~~~")
|
|
955
|
+ fmt.Println(patient_id)
|
|
956
|
+ fmt.Println("~~~~~~")
|
|
957
|
+
|
|
958
|
+ adminUserInfo := c.GetAdminUserInfo()
|
|
959
|
+ sch, err := service.GetSmartSchPatientByPatientID(adminUserInfo.CurrentOrgId, patient_id)
|
|
960
|
+ if err != nil {
|
|
961
|
+ utils.ErrorLog(err.Error())
|
|
962
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
963
|
+ return
|
|
964
|
+ }
|
|
965
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
966
|
+ "sch": sch,
|
|
967
|
+ })
|
|
968
|
+}
|
|
969
|
+
|
|
970
|
+func (c *ScheduleApiController) GetPatient() {
|
865
|
971
|
keyWord := c.GetString("keyword")
|
866
|
972
|
adminUserInfo := c.GetAdminUserInfo()
|
867
|
973
|
patient, err := service.GetSmartSchPatientByKeyWord(adminUserInfo.CurrentOrgId, keyWord)
|
|
@@ -876,6 +982,7 @@ func (c *ScheduleApiController) GetPatientSch() {
|
876
|
982
|
}
|
877
|
983
|
|
878
|
984
|
func (c *ScheduleApiController) GetPatientSchTemplate() {
|
|
985
|
+ //patient_id, _ := c.GetInt64("patient_id",0)
|
879
|
986
|
keyWord := c.GetString("keyword")
|
880
|
987
|
adminUserInfo := c.GetAdminUserInfo()
|
881
|
988
|
patient, err := service.GetSmartSchTemplatePatientByKeyWord(adminUserInfo.CurrentOrgId, keyWord)
|
|
@@ -1264,32 +1371,34 @@ func (c *ScheduleApiController) CreateSchedule() {
|
1264
|
1371
|
schedule.UserOrgId = adminUserInfo.CurrentOrgId
|
1265
|
1372
|
schedule.IsExport = 5
|
1266
|
1373
|
|
|
1374
|
+ var DialysisMachineName string
|
1267
|
1375
|
so, _ := service.GetDialysisSolutionTwo(adminUserInfo.CurrentOrgId, schedule.PatientId, schedule.ModeId)
|
1268
|
1376
|
filedRecordOne, _ := service.FindFiledBy(adminUserInfo.CurrentOrgId, "透析器")
|
1269
|
1377
|
filedRecordTwo, _ := service.FindFiledBy(adminUserInfo.CurrentOrgId, "灌流器")
|
1270
|
1378
|
filedRecordThree, _ := service.FindFiledBy(adminUserInfo.CurrentOrgId, "透析器/灌流器")
|
1271
|
1379
|
|
1272
|
1380
|
if filedRecordOne.IsShow == 1 {
|
1273
|
|
- schedule.DialysisMachineName = so.DialysisDialyszers
|
|
1381
|
+ DialysisMachineName = so.DialysisDialyszers
|
1274
|
1382
|
}
|
1275
|
1383
|
if filedRecordThree.IsShow == 1 {
|
1276
|
|
- if len(schedule.DialysisMachineName) > 0 {
|
1277
|
|
- schedule.DialysisMachineName = schedule.DialysisMachineName + "," + so.DialyzerPerfusionApparatus
|
|
1384
|
+ if len(DialysisMachineName) > 0 {
|
|
1385
|
+ DialysisMachineName = DialysisMachineName + "," + so.DialyzerPerfusionApparatus
|
1278
|
1386
|
|
1279
|
1387
|
} else {
|
1280
|
|
- schedule.DialysisMachineName = so.DialyzerPerfusionApparatus
|
|
1388
|
+ DialysisMachineName = so.DialyzerPerfusionApparatus
|
1281
|
1389
|
|
1282
|
1390
|
}
|
1283
|
1391
|
}
|
1284
|
1392
|
if filedRecordTwo.IsShow == 1 {
|
1285
|
|
- if len(schedule.DialysisMachineName) > 0 {
|
1286
|
|
- schedule.DialysisMachineName = schedule.DialysisMachineName + "," + so.DialysisIrrigation
|
|
1393
|
+ if len(DialysisMachineName) > 0 {
|
|
1394
|
+ DialysisMachineName = DialysisMachineName + "," + so.DialysisIrrigation
|
1287
|
1395
|
|
1288
|
1396
|
} else {
|
1289
|
|
- schedule.DialysisMachineName = so.DialysisIrrigation
|
|
1397
|
+ DialysisMachineName = so.DialysisIrrigation
|
1290
|
1398
|
|
1291
|
1399
|
}
|
1292
|
1400
|
}
|
|
1401
|
+ schedule.DialysisMachineName = DialysisMachineName
|
1293
|
1402
|
|
1294
|
1403
|
bed, _ := service.GetDeviceNumberByID(adminUserInfo.CurrentOrgId, schedule.BedId)
|
1295
|
1404
|
if bed == nil {
|
|
@@ -1494,28 +1603,29 @@ func (c *ScheduleApiController) ChangeSchedule() {
|
1494
|
1603
|
filedRecordOne, _ := service.FindFiledBy(adminINfo.CurrentOrgId, "透析器")
|
1495
|
1604
|
filedRecordTwo, _ := service.FindFiledBy(adminINfo.CurrentOrgId, "灌流器")
|
1496
|
1605
|
filedRecordThree, _ := service.FindFiledBy(adminINfo.CurrentOrgId, "透析器/灌流器")
|
1497
|
|
-
|
|
1606
|
+ var DialysisMachineName string
|
1498
|
1607
|
if filedRecordOne.IsShow == 1 {
|
1499
|
|
- schedule.DialysisMachineName = so.DialysisDialyszers
|
|
1608
|
+ DialysisMachineName = so.DialysisDialyszers
|
1500
|
1609
|
}
|
1501
|
1610
|
if filedRecordThree.IsShow == 1 {
|
1502
|
1611
|
if len(schedule.DialysisMachineName) > 0 {
|
1503
|
|
- schedule.DialysisMachineName = schedule.DialysisMachineName + "," + so.DialyzerPerfusionApparatus
|
|
1612
|
+ DialysisMachineName = schedule.DialysisMachineName + "," + so.DialyzerPerfusionApparatus
|
1504
|
1613
|
|
1505
|
1614
|
} else {
|
1506
|
|
- schedule.DialysisMachineName = so.DialyzerPerfusionApparatus
|
|
1615
|
+ DialysisMachineName = so.DialyzerPerfusionApparatus
|
1507
|
1616
|
|
1508
|
1617
|
}
|
1509
|
1618
|
}
|
1510
|
1619
|
if filedRecordTwo.IsShow == 1 {
|
1511
|
|
- if len(schedule.DialysisMachineName) > 0 {
|
1512
|
|
- schedule.DialysisMachineName = schedule.DialysisMachineName + "," + so.DialysisIrrigation
|
|
1620
|
+ if len(DialysisMachineName) > 0 {
|
|
1621
|
+ DialysisMachineName = schedule.DialysisMachineName + "," + so.DialysisIrrigation
|
1513
|
1622
|
|
1514
|
1623
|
} else {
|
1515
|
|
- schedule.DialysisMachineName = so.DialysisIrrigation
|
|
1624
|
+ DialysisMachineName = so.DialysisIrrigation
|
1516
|
1625
|
|
1517
|
1626
|
}
|
1518
|
1627
|
}
|
|
1628
|
+ schedule.DialysisMachineName = DialysisMachineName
|
1519
|
1629
|
|
1520
|
1630
|
order, err := service.GetOneDialysisOrder(adminINfo.CurrentOrgId, schedule.ScheduleDate, schedule.PatientId)
|
1521
|
1631
|
if err != nil {
|
|
@@ -2418,32 +2528,35 @@ func (this *ScheduleApiController) ExportSchedule() {
|
2418
|
2528
|
sch.Status = 1
|
2419
|
2529
|
sch.UserOrgId = this.GetAdminUserInfo().CurrentOrgId
|
2420
|
2530
|
sch.IsExport = 1
|
|
2531
|
+
|
|
2532
|
+ var DialysisMachineName string
|
2421
|
2533
|
so, _ := service.GetDialysisSolutionTwo(sch.UserOrgId, sch.PatientId, sch.ModeId)
|
2422
|
2534
|
filedRecordOne, _ := service.FindFiledBy(sch.UserOrgId, "透析器")
|
2423
|
2535
|
filedRecordTwo, _ := service.FindFiledBy(sch.UserOrgId, "灌流器")
|
2424
|
2536
|
filedRecordThree, _ := service.FindFiledBy(sch.UserOrgId, "透析器/灌流器")
|
2425
|
2537
|
|
2426
|
2538
|
if filedRecordOne.IsShow == 1 {
|
2427
|
|
- sch.DialysisMachineName = so.DialysisDialyszers
|
|
2539
|
+ DialysisMachineName = so.DialysisDialyszers
|
2428
|
2540
|
}
|
2429
|
2541
|
if filedRecordThree.IsShow == 1 {
|
2430
|
|
- if len(sch.DialysisMachineName) > 0 {
|
2431
|
|
- sch.DialysisMachineName = sch.DialysisMachineName + "," + so.DialyzerPerfusionApparatus
|
|
2542
|
+ if len(DialysisMachineName) > 0 {
|
|
2543
|
+ DialysisMachineName = DialysisMachineName + "," + so.DialyzerPerfusionApparatus
|
2432
|
2544
|
|
2433
|
2545
|
} else {
|
2434
|
|
- sch.DialysisMachineName = so.DialyzerPerfusionApparatus
|
|
2546
|
+ DialysisMachineName = so.DialyzerPerfusionApparatus
|
2435
|
2547
|
|
2436
|
2548
|
}
|
2437
|
2549
|
}
|
2438
|
2550
|
if filedRecordTwo.IsShow == 1 {
|
2439
|
|
- if len(sch.DialysisMachineName) > 0 {
|
2440
|
|
- sch.DialysisMachineName = sch.DialysisMachineName + "," + so.DialysisIrrigation
|
|
2551
|
+ if len(DialysisMachineName) > 0 {
|
|
2552
|
+ DialysisMachineName = sch.DialysisMachineName + "," + so.DialysisIrrigation
|
2441
|
2553
|
|
2442
|
2554
|
} else {
|
2443
|
|
- sch.DialysisMachineName = so.DialysisIrrigation
|
|
2555
|
+ DialysisMachineName = so.DialysisIrrigation
|
2444
|
2556
|
|
2445
|
2557
|
}
|
2446
|
2558
|
}
|
|
2559
|
+ sch.DialysisMachineName = DialysisMachineName
|
2447
|
2560
|
|
2448
|
2561
|
schedules = append(schedules, &sch)
|
2449
|
2562
|
}
|
|
@@ -2455,21 +2568,29 @@ func (this *ScheduleApiController) ExportSchedule() {
|
2455
|
2568
|
date, _ := utils.ParseTimeStringToTime("2006-01-02", schedule_date)
|
2456
|
2569
|
clear_schedule_date := date.Unix() //根据日期去清除,该日期未来的排班数据
|
2457
|
2570
|
|
|
2571
|
+ service.UpdateScheduleByExport(this.GetAdminUserInfo().CurrentOrgId, clear_schedule_date)
|
|
2572
|
+
|
2458
|
2573
|
if err == nil {
|
2459
|
2574
|
for _, item := range schedules {
|
2460
|
2575
|
if item.ScheduleDate > clear_schedule_date {
|
2461
|
2576
|
//查询该患者是否转出获取死亡
|
|
2577
|
+ fmt.Println("11111323242423")
|
2462
|
2578
|
|
2463
|
2579
|
//查找当天日期是否存在
|
2464
|
2580
|
_, errcode := service.GetTodayScheduleIsExistOne(item.PatientId, item.ScheduleDate, item.UserOrgId)
|
2465
|
2581
|
if errcode == gorm.ErrRecordNotFound {
|
2466
|
2582
|
//查询该床位是否有患者
|
|
2583
|
+ fmt.Println("errcodes")
|
2467
|
2584
|
sch, errcodes := service.GetPatientByBed(item.ScheduleDate, item.BedId, item.ScheduleType, item.UserOrgId)
|
|
2585
|
+ fmt.Println("errcodes")
|
|
2586
|
+ fmt.Println(errcodes)
|
|
2587
|
+ fmt.Println(sch)
|
2468
|
2588
|
|
2469
|
2589
|
if errcodes == gorm.ErrRecordNotFound {
|
|
2590
|
+ fmt.Println("1111111")
|
2470
|
2591
|
service.CreateSchedule(item)
|
2471
|
2592
|
} else if errcodes == nil {
|
2472
|
|
-
|
|
2593
|
+ fmt.Println("1111222222222")
|
2473
|
2594
|
//清除当天该床位已有的患者
|
2474
|
2595
|
service.ModeFyScheduleById(sch.ScheduleDate, sch.BedId, sch.ScheduleType, sch.UserOrgId)
|
2475
|
2596
|
service.CreateSchedule(item)
|
|
@@ -2477,15 +2598,17 @@ func (this *ScheduleApiController) ExportSchedule() {
|
2477
|
2598
|
|
2478
|
2599
|
} else if errcode == nil {
|
2479
|
2600
|
schedule := models.XtSchedule{
|
2480
|
|
- PartitionId: item.PartitionId,
|
2481
|
|
- BedId: item.BedId,
|
2482
|
|
- PatientId: item.PatientId,
|
2483
|
|
- ScheduleDate: item.ScheduleDate,
|
2484
|
|
- ScheduleType: item.ScheduleType,
|
2485
|
|
- ScheduleWeek: item.ScheduleWeek,
|
2486
|
|
- ModeId: item.ModeId,
|
2487
|
|
- Status: 1,
|
|
2601
|
+ PartitionId: item.PartitionId,
|
|
2602
|
+ BedId: item.BedId,
|
|
2603
|
+ PatientId: item.PatientId,
|
|
2604
|
+ ScheduleDate: item.ScheduleDate,
|
|
2605
|
+ ScheduleType: item.ScheduleType,
|
|
2606
|
+ ScheduleWeek: item.ScheduleWeek,
|
|
2607
|
+ ModeId: 1,
|
|
2608
|
+ Status: 1,
|
|
2609
|
+ DialysisMachineName: item.DialysisMachineName,
|
2488
|
2610
|
}
|
|
2611
|
+ fmt.Println("1111222222223333333333333333332")
|
2489
|
2612
|
|
2490
|
2613
|
service.UpdateScheduleByOrgIdOne(item.PatientId, item.ScheduleDate, item.UserOrgId, &schedule)
|
2491
|
2614
|
}
|
|
@@ -3321,32 +3444,35 @@ func (this *ScheduleApiController) GetCopyPatientSchedules() {
|
3321
|
3444
|
CreatedTime: time.Now().Unix(),
|
3322
|
3445
|
}
|
3323
|
3446
|
|
|
3447
|
+ var DialysisMachineName string
|
|
3448
|
+
|
3324
|
3449
|
so, _ := service.GetDialysisSolutionTwo(adminUserInfo.CurrentOrgId, schedule.PatientId, schedule.ModeId)
|
3325
|
3450
|
filedRecordOne, _ := service.FindFiledBy(adminUserInfo.CurrentOrgId, "透析器")
|
3326
|
3451
|
filedRecordTwo, _ := service.FindFiledBy(adminUserInfo.CurrentOrgId, "灌流器")
|
3327
|
3452
|
filedRecordThree, _ := service.FindFiledBy(adminUserInfo.CurrentOrgId, "透析器/灌流器")
|
3328
|
3453
|
|
3329
|
3454
|
if filedRecordOne.IsShow == 1 {
|
3330
|
|
- schedule.DialysisMachineName = so.DialysisDialyszers
|
|
3455
|
+ DialysisMachineName = so.DialysisDialyszers
|
3331
|
3456
|
}
|
3332
|
3457
|
if filedRecordThree.IsShow == 1 {
|
3333
|
|
- if len(schedule.DialysisMachineName) > 0 {
|
3334
|
|
- schedule.DialysisMachineName = schedule.DialysisMachineName + "," + so.DialysisIrrigation
|
|
3458
|
+ if len(DialysisMachineName) > 0 {
|
|
3459
|
+ DialysisMachineName = DialysisMachineName + "," + so.DialysisIrrigation
|
3335
|
3460
|
|
3336
|
3461
|
} else {
|
3337
|
|
- schedule.DialysisMachineName = so.DialyzerPerfusionApparatus
|
|
3462
|
+ DialysisMachineName = so.DialyzerPerfusionApparatus
|
3338
|
3463
|
|
3339
|
3464
|
}
|
3340
|
3465
|
}
|
3341
|
3466
|
if filedRecordTwo.IsShow == 1 {
|
3342
|
|
- if len(schedule.DialysisMachineName) > 0 {
|
3343
|
|
- schedule.DialysisMachineName = schedule.DialysisMachineName + "," + so.DialysisIrrigation
|
|
3467
|
+ if len(DialysisMachineName) > 0 {
|
|
3468
|
+ DialysisMachineName = DialysisMachineName + "," + so.DialysisIrrigation
|
3344
|
3469
|
|
3345
|
3470
|
} else {
|
3346
|
|
- schedule.DialysisMachineName = so.DialysisIrrigation
|
|
3471
|
+ DialysisMachineName = so.DialysisIrrigation
|
3347
|
3472
|
|
3348
|
3473
|
}
|
3349
|
3474
|
}
|
|
3475
|
+ schedule.DialysisMachineName = DialysisMachineName
|
3350
|
3476
|
|
3351
|
3477
|
err = service.AddPatientSchedule(&schedule)
|
3352
|
3478
|
|
|
@@ -4030,32 +4156,34 @@ func (c *ScheduleApiController) SynchroSchedule() {
|
4030
|
4156
|
UpdatedTime: 0,
|
4031
|
4157
|
}
|
4032
|
4158
|
|
|
4159
|
+ var DialysisMachineName string
|
4033
|
4160
|
so, _ := service.GetDialysisSolutionTwo(c.GetAdminUserInfo().CurrentOrgId, schedule.PatientId, schedule.ModeId)
|
4034
|
4161
|
filedRecordOne, _ := service.FindFiledBy(c.GetAdminUserInfo().CurrentOrgId, "透析器")
|
4035
|
4162
|
filedRecordTwo, _ := service.FindFiledBy(c.GetAdminUserInfo().CurrentOrgId, "灌流器")
|
4036
|
4163
|
filedRecordThree, _ := service.FindFiledBy(c.GetAdminUserInfo().CurrentOrgId, "透析器/灌流器")
|
4037
|
4164
|
|
4038
|
4165
|
if filedRecordOne.IsShow == 1 {
|
4039
|
|
- schedule.DialysisMachineName = so.DialysisDialyszers
|
|
4166
|
+ DialysisMachineName = so.DialysisDialyszers
|
4040
|
4167
|
}
|
4041
|
4168
|
if filedRecordThree.IsShow == 1 {
|
4042
|
|
- if len(schedule.DialysisMachineName) > 0 {
|
4043
|
|
- schedule.DialysisMachineName = schedule.DialysisMachineName + "," + so.DialyzerPerfusionApparatus
|
|
4169
|
+ if len(DialysisMachineName) > 0 {
|
|
4170
|
+ DialysisMachineName = DialysisMachineName + "," + so.DialyzerPerfusionApparatus
|
4044
|
4171
|
|
4045
|
4172
|
} else {
|
4046
|
|
- schedule.DialysisMachineName = so.DialyzerPerfusionApparatus
|
|
4173
|
+ DialysisMachineName = so.DialyzerPerfusionApparatus
|
4047
|
4174
|
|
4048
|
4175
|
}
|
4049
|
4176
|
}
|
4050
|
4177
|
if filedRecordTwo.IsShow == 1 {
|
4051
|
|
- if len(schedule.DialysisMachineName) > 0 {
|
4052
|
|
- schedule.DialysisMachineName = schedule.DialysisMachineName + "," + so.DialysisIrrigation
|
|
4178
|
+ if len(DialysisMachineName) > 0 {
|
|
4179
|
+ DialysisMachineName = DialysisMachineName + "," + so.DialysisIrrigation
|
4053
|
4180
|
|
4054
|
4181
|
} else {
|
4055
|
|
- schedule.DialysisMachineName = so.DialysisIrrigation
|
|
4182
|
+ DialysisMachineName = so.DialysisIrrigation
|
4056
|
4183
|
|
4057
|
4184
|
}
|
4058
|
4185
|
}
|
|
4186
|
+ schedule.DialysisMachineName = DialysisMachineName
|
4059
|
4187
|
|
4060
|
4188
|
service.CreatePatientSchedule(&schedule)
|
4061
|
4189
|
}
|
|
@@ -4119,32 +4247,35 @@ func (c *ScheduleApiController) SynchroSchedule() {
|
4119
|
4247
|
CreatedTime: time.Now().Unix(),
|
4120
|
4248
|
UpdatedTime: 0,
|
4121
|
4249
|
}
|
|
4250
|
+
|
|
4251
|
+ var DialysisMachineName string
|
4122
|
4252
|
so, _ := service.GetDialysisSolutionTwo(c.GetAdminUserInfo().CurrentOrgId, schedule.PatientId, schedule.ModeId)
|
4123
|
4253
|
filedRecordOne, _ := service.FindFiledBy(c.GetAdminUserInfo().CurrentOrgId, "透析器")
|
4124
|
4254
|
filedRecordTwo, _ := service.FindFiledBy(c.GetAdminUserInfo().CurrentOrgId, "灌流器")
|
4125
|
4255
|
filedRecordThree, _ := service.FindFiledBy(c.GetAdminUserInfo().CurrentOrgId, "透析器/灌流器")
|
4126
|
4256
|
|
4127
|
4257
|
if filedRecordOne.IsShow == 1 {
|
4128
|
|
- schedule.DialysisMachineName = so.DialysisDialyszers
|
|
4258
|
+ DialysisMachineName = so.DialysisDialyszers
|
4129
|
4259
|
}
|
4130
|
4260
|
if filedRecordThree.IsShow == 1 {
|
4131
|
|
- if len(schedule.DialysisMachineName) > 0 {
|
4132
|
|
- schedule.DialysisMachineName = schedule.DialysisMachineName + "," + so.DialyzerPerfusionApparatus
|
|
4261
|
+ if len(DialysisMachineName) > 0 {
|
|
4262
|
+ DialysisMachineName = DialysisMachineName + "," + so.DialyzerPerfusionApparatus
|
4133
|
4263
|
|
4134
|
4264
|
} else {
|
4135
|
|
- schedule.DialysisMachineName = so.DialyzerPerfusionApparatus
|
|
4265
|
+ DialysisMachineName = so.DialyzerPerfusionApparatus
|
4136
|
4266
|
|
4137
|
4267
|
}
|
4138
|
4268
|
}
|
4139
|
4269
|
if filedRecordTwo.IsShow == 1 {
|
4140
|
4270
|
if len(schedule.DialysisMachineName) > 0 {
|
4141
|
|
- schedule.DialysisMachineName = schedule.DialysisMachineName + "," + so.DialysisIrrigation
|
|
4271
|
+ DialysisMachineName = DialysisMachineName + "," + so.DialysisIrrigation
|
4142
|
4272
|
|
4143
|
4273
|
} else {
|
4144
|
|
- schedule.DialysisMachineName = so.DialysisIrrigation
|
|
4274
|
+ DialysisMachineName = so.DialysisIrrigation
|
4145
|
4275
|
|
4146
|
4276
|
}
|
4147
|
4277
|
}
|
|
4278
|
+ schedule.DialysisMachineName = DialysisMachineName
|
4148
|
4279
|
service.CreatePatientSchedule(&schedule)
|
4149
|
4280
|
}
|
4150
|
4281
|
}
|