test_user 1 rok temu
rodzic
commit
15c7bd2f80

+ 34 - 7
controllers/schedule_api_controller.go Wyświetl plik

@@ -1606,23 +1606,30 @@ func (c *ScheduleApiController) ChangeSchedule() {
1606 1606
 		var DialysisMachineName string
1607 1607
 		if filedRecordOne.IsShow == 1 {
1608 1608
 			DialysisMachineName = so.DialysisDialyszers
1609
+			fmt.Println("1111")
1610
+			fmt.Println(DialysisMachineName)
1611
+
1609 1612
 		}
1610 1613
 		if filedRecordThree.IsShow == 1 {
1611 1614
 			if len(schedule.DialysisMachineName) > 0 {
1612
-				DialysisMachineName = schedule.DialysisMachineName + "," + so.DialyzerPerfusionApparatus
1613
-
1615
+				DialysisMachineName = DialysisMachineName + "," + so.DialyzerPerfusionApparatus
1616
+				fmt.Println("22222")
1617
+				fmt.Println(DialysisMachineName)
1614 1618
 			} else {
1615 1619
 				DialysisMachineName = so.DialyzerPerfusionApparatus
1616
-
1620
+				fmt.Println("333333")
1621
+				fmt.Println(DialysisMachineName)
1617 1622
 			}
1618 1623
 		}
1619 1624
 		if filedRecordTwo.IsShow == 1 {
1620 1625
 			if len(DialysisMachineName) > 0 {
1621
-				DialysisMachineName = schedule.DialysisMachineName + "," + so.DialysisIrrigation
1622
-
1626
+				DialysisMachineName = DialysisMachineName + "," + so.DialysisIrrigation
1627
+				fmt.Println("55555555")
1628
+				fmt.Println(DialysisMachineName)
1623 1629
 			} else {
1624 1630
 				DialysisMachineName = so.DialysisIrrigation
1625
-
1631
+				fmt.Println("66666666")
1632
+				fmt.Println(DialysisMachineName)
1626 1633
 			}
1627 1634
 		}
1628 1635
 		schedule.DialysisMachineName = DialysisMachineName
@@ -2549,7 +2556,7 @@ func (this *ScheduleApiController) ExportSchedule() {
2549 2556
 			}
2550 2557
 			if filedRecordTwo.IsShow == 1 {
2551 2558
 				if len(DialysisMachineName) > 0 {
2552
-					DialysisMachineName = sch.DialysisMachineName + "," + so.DialysisIrrigation
2559
+					DialysisMachineName = DialysisMachineName + "," + so.DialysisIrrigation
2553 2560
 
2554 2561
 				} else {
2555 2562
 					DialysisMachineName = so.DialysisIrrigation
@@ -4094,6 +4101,9 @@ func (c *ScheduleApiController) SynchroSchedule() {
4094 4101
 	//根据模板ID获取模板数据
4095 4102
 	list, _ := service.GetTemplateListByTemplateId(template_id, orgId)
4096 4103
 
4104
+	//数据去重操作
4105
+	list = RemoveRepeatedScheduleTemplate(list)
4106
+
4097 4107
 	recordDateStr := time.Now().Format("2006-01-02")
4098 4108
 	recordDate, _ := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
4099 4109
 	nowtime := recordDate.Unix()
@@ -4306,3 +4316,20 @@ func (c *ScheduleApiController) GetSolutionSchedule() {
4306 4316
 	})
4307 4317
 	return
4308 4318
 }
4319
+
4320
+func RemoveRepeatedScheduleTemplate(arr []*models.VmPatientScheduleTemplateItem) (newArr []*models.VmPatientScheduleTemplateItem) {
4321
+	newArr = make([]*models.VmPatientScheduleTemplateItem, 0)
4322
+	for i := 0; i < len(arr); i++ {
4323
+		repeat := false
4324
+		for j := i + 1; j < len(arr); j++ {
4325
+			if arr[i].TemplateID == arr[j].TemplateID && arr[i].PatientID == arr[j].PatientID && arr[i].Weekday == arr[j].Weekday && arr[i].DeviceNumberID == arr[j].DeviceNumberID && arr[i].TimeType == arr[j].TimeType {
4326
+				repeat = true
4327
+				break
4328
+			}
4329
+		}
4330
+		if !repeat {
4331
+			newArr = append(newArr, arr[i])
4332
+		}
4333
+	}
4334
+	return
4335
+}

+ 1 - 7
controllers/schedule_template_api_controller.go Wyświetl plik

@@ -737,10 +737,8 @@ func (this *PatientScheduleTemplateAPIController) UpdateSchedulesTemplate() {
737 737
 				service.SaveSchTemplateItem(src_template)
738 738
 
739 739
 			} else {
740
-				schItem, _ := service.GetScheduleTemplateOne(this.GetAdminUserInfo().CurrentOrgId, item.DeviceNumberID, item.TemplateID, item.Weekday)
741
-
740
+				schItem, _ := service.GetScheduleTemplateOne(this.GetAdminUserInfo().CurrentOrgId, item.DeviceNumberID, item.TemplateID, item.Weekday, item.TimeType)
742 741
 				if schItem.ID == 0 { //床位未被占用
743
-
744 742
 					var template models.PatientScheduleTemplateItem
745 743
 					template.TreatMode = item.Mode
746 744
 					template.TemplateID = int64(item.TemplateID)
@@ -753,12 +751,8 @@ func (this *PatientScheduleTemplateAPIController) UpdateSchedulesTemplate() {
753 751
 					template.Weekday = int8(item.Weekday)
754 752
 					template.Status = 1
755 753
 					service.SaveSchTemplateItem(template)
756
-
757 754
 				} else { //床位被占用 1.被自己占用,2。被别人占用
758
-					//fmt.Println("555555555")
759
-
760 755
 					if schItem.PatientID != 0 && schItem.PatientID == item.PatientID { //当天该患者已经存在排班则设为修改操作
761
-						//fmt.Println("66666")
762 756
 						src_template, _ := service.GetScheduleTemplateItem(schItem.ID)
763 757
 						src_template.DeviceNumberID = item.DeviceNumberID
764 758
 						src_template.TimeType = int8(item.TimeType)