test_user 2 anni fa
parent
commit
15c7bd2f80

+ 34 - 7
controllers/schedule_api_controller.go Vedi File

1606
 		var DialysisMachineName string
1606
 		var DialysisMachineName string
1607
 		if filedRecordOne.IsShow == 1 {
1607
 		if filedRecordOne.IsShow == 1 {
1608
 			DialysisMachineName = so.DialysisDialyszers
1608
 			DialysisMachineName = so.DialysisDialyszers
1609
+			fmt.Println("1111")
1610
+			fmt.Println(DialysisMachineName)
1611
+
1609
 		}
1612
 		}
1610
 		if filedRecordThree.IsShow == 1 {
1613
 		if filedRecordThree.IsShow == 1 {
1611
 			if len(schedule.DialysisMachineName) > 0 {
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
 			} else {
1618
 			} else {
1615
 				DialysisMachineName = so.DialyzerPerfusionApparatus
1619
 				DialysisMachineName = so.DialyzerPerfusionApparatus
1616
-
1620
+				fmt.Println("333333")
1621
+				fmt.Println(DialysisMachineName)
1617
 			}
1622
 			}
1618
 		}
1623
 		}
1619
 		if filedRecordTwo.IsShow == 1 {
1624
 		if filedRecordTwo.IsShow == 1 {
1620
 			if len(DialysisMachineName) > 0 {
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
 			} else {
1629
 			} else {
1624
 				DialysisMachineName = so.DialysisIrrigation
1630
 				DialysisMachineName = so.DialysisIrrigation
1625
-
1631
+				fmt.Println("66666666")
1632
+				fmt.Println(DialysisMachineName)
1626
 			}
1633
 			}
1627
 		}
1634
 		}
1628
 		schedule.DialysisMachineName = DialysisMachineName
1635
 		schedule.DialysisMachineName = DialysisMachineName
2549
 			}
2556
 			}
2550
 			if filedRecordTwo.IsShow == 1 {
2557
 			if filedRecordTwo.IsShow == 1 {
2551
 				if len(DialysisMachineName) > 0 {
2558
 				if len(DialysisMachineName) > 0 {
2552
-					DialysisMachineName = sch.DialysisMachineName + "," + so.DialysisIrrigation
2559
+					DialysisMachineName = DialysisMachineName + "," + so.DialysisIrrigation
2553
 
2560
 
2554
 				} else {
2561
 				} else {
2555
 					DialysisMachineName = so.DialysisIrrigation
2562
 					DialysisMachineName = so.DialysisIrrigation
4094
 	//根据模板ID获取模板数据
4101
 	//根据模板ID获取模板数据
4095
 	list, _ := service.GetTemplateListByTemplateId(template_id, orgId)
4102
 	list, _ := service.GetTemplateListByTemplateId(template_id, orgId)
4096
 
4103
 
4104
+	//数据去重操作
4105
+	list = RemoveRepeatedScheduleTemplate(list)
4106
+
4097
 	recordDateStr := time.Now().Format("2006-01-02")
4107
 	recordDateStr := time.Now().Format("2006-01-02")
4098
 	recordDate, _ := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
4108
 	recordDate, _ := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
4099
 	nowtime := recordDate.Unix()
4109
 	nowtime := recordDate.Unix()
4306
 	})
4316
 	})
4307
 	return
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 Vedi File

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