|
@@ -949,6 +949,7 @@ func Struct2Map(obj interface{}) map[string]interface{} {
|
949
|
949
|
}
|
950
|
950
|
|
951
|
951
|
func (this *ScheduleApiController) ExportSchedule() {
|
|
952
|
+
|
952
|
953
|
dataBody := make(map[string]interface{}, 0)
|
953
|
954
|
err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
|
954
|
955
|
if err != nil {
|
|
@@ -964,6 +965,20 @@ func (this *ScheduleApiController) ExportSchedule() {
|
964
|
965
|
|
965
|
966
|
patients, _, _ = service.GetAllPatientList(this.GetAdminUserInfo().CurrentOrgId)
|
966
|
967
|
|
|
968
|
+ start_time := dataBody["start_time"].(string)
|
|
969
|
+
|
|
970
|
+ end_time := dataBody["end_time"].(string)
|
|
971
|
+
|
|
972
|
+ delete_type := int64(dataBody["delete_type"].(float64))
|
|
973
|
+
|
|
974
|
+ timeLayout := "2006-01-02"
|
|
975
|
+ loc, _ := time.LoadLocation("Local")
|
|
976
|
+ theTimeStart, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
|
977
|
+ theTimeEnd, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
|
|
978
|
+
|
|
979
|
+ fmt.Println("theTimeStart23232322332322323", theTimeStart.Unix())
|
|
980
|
+ fmt.Println("theTimeStart23232322332322323", theTimeEnd.Unix())
|
|
981
|
+
|
967
|
982
|
if dataBody["failed_schedule"] != nil || reflect.TypeOf(dataBody["failed_schedule"]).String() == "[]interface {}" {
|
968
|
983
|
tempSchedule := dataBody["failed_schedule"].([]interface{})
|
969
|
984
|
failed_total = len(tempSchedule)
|
|
@@ -1403,15 +1418,24 @@ func (this *ScheduleApiController) ExportSchedule() {
|
1403
|
1418
|
//clear_schedule_date := date.Unix() //根据日期去清除,该日期未来的排班数据
|
1404
|
1419
|
//err := service.UpdateScheduleStatus(clear_schedule_date, this.GetAdminUserInfo().CurrentOrgId)
|
1405
|
1420
|
if err == nil {
|
|
1421
|
+ //清除该机构的排班
|
|
1422
|
+ if delete_type == 1 {
|
|
1423
|
+ service.ModeScheduleByTimeOne(theTimeStart.Unix(), theTimeEnd.Unix(), this.GetAdminUserInfo().CurrentOrgId)
|
|
1424
|
+ }
|
|
1425
|
+ if delete_type == 0 {
|
|
1426
|
+ service.ModeScheduleByTime(theTimeStart.Unix(), theTimeEnd.Unix(), this.GetAdminUserInfo().CurrentOrgId)
|
|
1427
|
+ }
|
|
1428
|
+
|
1406
|
1429
|
for _, item := range schedules {
|
1407
|
1430
|
//删除当天的日期排班
|
1408
|
|
- service.DeleteScheduleExist(item.ScheduleDate, item.UserOrgId)
|
|
1431
|
+ /*service.DeleteScheduleExist(item.ScheduleDate, item.UserOrgId)*/
|
1409
|
1432
|
//查找当天日期是否存在
|
1410
|
|
- _, errcode := service.GetTodayScheduleIsExist(item.PatientId, item.ScheduleDate, item.UserOrgId, item.ModeId, item.ScheduleType)
|
|
1433
|
+ _, errcode := service.GetTodayScheduleIsExistOne(item.PatientId, item.ScheduleDate, item.UserOrgId)
|
1411
|
1434
|
if errcode == gorm.ErrRecordNotFound {
|
|
1435
|
+ //清除当天该床位已有的患者
|
|
1436
|
+ // service.ModeFyScheduleById(item.ScheduleDate,item.BedId,item.ScheduleType)
|
1412
|
1437
|
service.CreateSchedule(item)
|
1413
|
1438
|
} else if errcode == nil {
|
1414
|
|
-
|
1415
|
1439
|
schedule := models.XtSchedule{
|
1416
|
1440
|
PartitionId: item.PartitionId,
|
1417
|
1441
|
BedId: item.BedId,
|
|
@@ -1423,7 +1447,7 @@ func (this *ScheduleApiController) ExportSchedule() {
|
1423
|
1447
|
Status: 1,
|
1424
|
1448
|
}
|
1425
|
1449
|
|
1426
|
|
- service.UpdateScheduleByOrgId(item.PatientId, item.ScheduleDate, item.UserOrgId, item.ModeId, item.ScheduleType, &schedule)
|
|
1450
|
+ service.UpdateScheduleByOrgIdOne(item.PatientId, item.ScheduleDate, item.UserOrgId, &schedule)
|
1427
|
1451
|
}
|
1428
|
1452
|
|
1429
|
1453
|
}
|