Browse Source

Merge branch '20201014_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20201014_xt_api_new_branch

csx 4 years ago
parent
commit
72a5675478

+ 3 - 3
controllers/base_api_controller.go View File

81
 		userAdmin.ModifyTime = 1530786071
81
 		userAdmin.ModifyTime = 1530786071
82
 		var subscibe models.ServeSubscibe
82
 		var subscibe models.ServeSubscibe
83
 		subscibe.ID = 1
83
 		subscibe.ID = 1
84
-		subscibe.OrgId = 3877
84
+		subscibe.OrgId = 9882
85
 		subscibe.PeriodStart = 1538035409
85
 		subscibe.PeriodStart = 1538035409
86
 		subscibe.PeriodEnd = 1569571409
86
 		subscibe.PeriodEnd = 1569571409
87
 		subscibe.State = 1
87
 		subscibe.State = 1
91
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
91
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
92
 		subscibes[4] = &subscibe
92
 		subscibes[4] = &subscibe
93
 		var adminUserInfo service.AdminUserInfo
93
 		var adminUserInfo service.AdminUserInfo
94
-		adminUserInfo.CurrentOrgId = 3877
94
+		adminUserInfo.CurrentOrgId = 9882
95
 		adminUserInfo.CurrentAppId = 18
95
 		adminUserInfo.CurrentAppId = 18
96
 		adminUserInfo.AdminUser = &userAdmin
96
 		adminUserInfo.AdminUser = &userAdmin
97
 		adminUserInfo.Subscibes = subscibes
97
 		adminUserInfo.Subscibes = subscibes
326
 		userAdmin.ModifyTime = 1530786071
326
 		userAdmin.ModifyTime = 1530786071
327
 		var subscibe models.ServeSubscibe
327
 		var subscibe models.ServeSubscibe
328
 		subscibe.ID = 1
328
 		subscibe.ID = 1
329
-		subscibe.OrgId = 3877
329
+		subscibe.OrgId = 9882
330
 		subscibe.PeriodStart = 1538035409
330
 		subscibe.PeriodStart = 1538035409
331
 		subscibe.PeriodEnd = 1569571409
331
 		subscibe.PeriodEnd = 1569571409
332
 		subscibe.State = 1
332
 		subscibe.State = 1

+ 103 - 109
controllers/mobile_api_controllers/check_weight_api_controller.go View File

4
 	"XT_New/enums"
4
 	"XT_New/enums"
5
 	"XT_New/models"
5
 	"XT_New/models"
6
 	"XT_New/service"
6
 	"XT_New/service"
7
-	"github.com/astaxie/beego"
8
-	"net/http"
9
-	"net/url"
10
-	"strconv"
11
 	_ "XT_New/utils"
7
 	_ "XT_New/utils"
12
 	_ "encoding/json"
8
 	_ "encoding/json"
13
 	"fmt"
9
 	"fmt"
10
+	"github.com/astaxie/beego"
14
 	_ "github.com/astaxie/beego"
11
 	_ "github.com/astaxie/beego"
15
 	"github.com/jinzhu/gorm"
12
 	"github.com/jinzhu/gorm"
13
+	"net/http"
14
+	"net/url"
15
+	"strconv"
16
 	_ "strings"
16
 	_ "strings"
17
 
17
 
18
 	// "fmt"
18
 	// "fmt"
67
 	if dialysistype == 1 {
67
 	if dialysistype == 1 {
68
 		// 保存透前相关数据
68
 		// 保存透前相关数据
69
 		// 获取透析处方
69
 		// 获取透析处方
70
-		dialysisPrescribe, getDialysisPrescribeErr := service.MobileGetDialysisPrescribe(adminUserInfo.Org.Id, id, theAssessmentDateTime)
71
-		if getDialysisPrescribeErr != nil {
72
-			c.ErrorLog("获取透析处方失败:%v", getDialysisPrescribeErr)
73
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
74
-			return
75
-		}
76
-
77
-		// 获取透析模版
78
-		dialysisSolution, getDialysisSolutionErr := service.MobileGetDialysisSolution(adminUserInfo.Org.Id, id)
79
-		if getDialysisSolutionErr != nil {
80
-			c.ErrorLog("获取透析方案失败:%v", getDialysisSolutionErr)
81
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
82
-			return
83
-		}
70
+		//dialysisPrescribe, getDialysisPrescribeErr := service.MobileGetDialysisPrescribe(adminUserInfo.Org.Id, id, theAssessmentDateTime)
71
+		//if getDialysisPrescribeErr != nil {
72
+		//	c.ErrorLog("获取透析处方失败:%v", getDialysisPrescribeErr)
73
+		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
74
+		//	return
75
+		//}
76
+		//
77
+		//// 获取透析模版
78
+		//dialysisSolution, getDialysisSolutionErr := service.MobileGetDialysisSolution(adminUserInfo.Org.Id, id)
79
+		//if getDialysisSolutionErr != nil {
80
+		//	c.ErrorLog("获取透析方案失败:%v", getDialysisSolutionErr)
81
+		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
82
+		//	return
83
+		//}
84
 
84
 
85
 		// 插入透析处方
85
 		// 插入透析处方
86
-		if dialysisPrescribe == nil && dialysisSolution != nil {
87
-			var newprescribe models.DialysisPrescription
88
-			newprescribe.UserOrgId = dialysisSolution.UserOrgId
89
-			newprescribe.PatientId = dialysisSolution.PatientId
90
-			newprescribe.Anticoagulant = dialysisSolution.Anticoagulant
91
-			newprescribe.AnticoagulantShouji = dialysisSolution.AnticoagulantShouji
92
-			newprescribe.AnticoagulantWeichi = dialysisSolution.AnticoagulantWeichi
93
-			newprescribe.AnticoagulantZongliang = dialysisSolution.AnticoagulantZongliang
94
-			newprescribe.AnticoagulantGaimingcheng = dialysisSolution.AnticoagulantGaimingcheng
95
-			newprescribe.AnticoagulantGaijiliang = dialysisSolution.AnticoagulantGaijiliang
96
-			newprescribe.ModeId = dialysisSolution.ModeId
97
-			newprescribe.DialysisDuration = dialysisSolution.DialysisDuration
98
-			newprescribe.ReplacementWay = dialysisSolution.ReplacementWay
99
-			newprescribe.HemodialysisMachine = dialysisSolution.HemodialysisMachine
100
-			newprescribe.BloodFilter = dialysisSolution.BloodFilter
101
-			newprescribe.PerfusionApparatus = dialysisSolution.PerfusionApparatus
102
-			newprescribe.BloodFlowVolume = dialysisSolution.BloodFlowVolume
103
-			newprescribe.DisplaceLiqui = dialysisSolution.DisplaceLiqui
104
-			newprescribe.Glucose = dialysisSolution.Glucose
105
-			newprescribe.DialysateFlow = dialysisSolution.DialysateFlow
106
-			newprescribe.Kalium = dialysisSolution.Kalium
107
-			newprescribe.Sodium = dialysisSolution.Sodium
108
-			newprescribe.Calcium = dialysisSolution.Calcium
109
-			newprescribe.Bicarbonate = dialysisSolution.Bicarbonate
110
-			newprescribe.DialysateTemperature = dialysisSolution.DialysateTemperature
111
-			newprescribe.Conductivity = dialysisSolution.Conductivity
112
-			newprescribe.BodyFluid = dialysisSolution.BodyFluid
113
-			newprescribe.SpecialMedicine = dialysisSolution.SpecialMedicine
114
-			newprescribe.SpecialMedicineOther = dialysisSolution.SpecialMedicineOther
115
-			newprescribe.DisplaceLiquiPart = dialysisSolution.DisplaceLiquiPart
116
-			newprescribe.DisplaceLiquiValue = dialysisSolution.DisplaceLiquiValue
117
-			newprescribe.BloodAccess = dialysisSolution.BloodAccess
118
-			newprescribe.Ultrafiltration = dialysisSolution.Ultrafiltration
119
-			newprescribe.DialysisDurationHour = dialysisSolution.DialysisDurationHour
120
-			newprescribe.DialysisDurationMinute = dialysisSolution.DialysisDurationMinute
121
-			newprescribe.TargetUltrafiltration = dialysisSolution.TargetUltrafiltration
122
-			newprescribe.DialysateFormulation = dialysisSolution.DialysateFormulation
123
-			newprescribe.Dialyzer = dialysisSolution.Dialyzer
124
-			newprescribe.ReplacementTotal = dialysisSolution.ReplacementTotal
125
-			newprescribe.DialyzerPerfusionApparatus = dialysisSolution.DialyzerPerfusionApparatus
126
-			newprescribe.BodyFluidOther = dialysisSolution.BodyFluidOther
127
-			newprescribe.TargetKtv = dialysisSolution.TargetKtv
128
-
129
-			newprescribe.CreatedTime = time.Now().Unix()
130
-			newprescribe.UpdatedTime = time.Now().Unix()
131
-			newprescribe.RecordDate = theAssessmentDateTime
132
-			// newprescribe.DewaterAmount = dewater_amount
133
-			// newprescribe.TargetUltrafiltration = dewater_amount
134
-			newprescribe.Status = 1
135
-
136
-			err := service.AddSigleRecord(&newprescribe)
137
-			if err != nil {
138
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
139
-			}
140
-		}
141
-
142
-		if dialysisPrescribe == nil && dialysisSolution == nil {
143
-			var newprescribe models.DialysisPrescription
144
-			newprescribe.UserOrgId = adminUserInfo.Org.Id
145
-			newprescribe.PatientId = id
146
-			newprescribe.CreatedTime = time.Now().Unix()
147
-			newprescribe.UpdatedTime = time.Now().Unix()
148
-			newprescribe.RecordDate = theAssessmentDateTime
149
-			// newprescribe.DewaterAmount = dewater_amount
150
-			// newprescribe.TargetUltrafiltration = dewater_amount
151
-			newprescribe.Status = 1
152
-
153
-			err := service.AddSigleRecord(&newprescribe)
154
-			if err != nil {
155
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
156
-			}
157
-		}
158
-
159
-		if dialysisPrescribe != nil {
160
-			dialysisPrescribe.UpdatedTime = time.Now().Unix()
161
-			dialysisPrescribe.RecordDate = theAssessmentDateTime
162
-			// dialysisPrescribe.DewaterAmount = dewater_amount
163
-			// dialysisPrescribe.TargetUltrafiltration = dewater_amount
164
-			dialysisPrescribe.Status = 1
165
-			updateErr := service.UpDateDialysisPrescription(dialysisPrescribe)
166
-			if updateErr != nil {
167
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
168
-			}
169
-		}
86
+		//if dialysisPrescribe == nil && dialysisSolution != nil {
87
+		//	var newprescribe models.DialysisPrescription
88
+		//	newprescribe.UserOrgId = dialysisSolution.UserOrgId
89
+		//	newprescribe.PatientId = dialysisSolution.PatientId
90
+		//	newprescribe.Anticoagulant = dialysisSolution.Anticoagulant
91
+		//	newprescribe.AnticoagulantShouji = dialysisSolution.AnticoagulantShouji
92
+		//	newprescribe.AnticoagulantWeichi = dialysisSolution.AnticoagulantWeichi
93
+		//	newprescribe.AnticoagulantZongliang = dialysisSolution.AnticoagulantZongliang
94
+		//	newprescribe.AnticoagulantGaimingcheng = dialysisSolution.AnticoagulantGaimingcheng
95
+		//	newprescribe.AnticoagulantGaijiliang = dialysisSolution.AnticoagulantGaijiliang
96
+		//	newprescribe.ModeId = dialysisSolution.ModeId
97
+		//	newprescribe.DialysisDuration = dialysisSolution.DialysisDuration
98
+		//	newprescribe.ReplacementWay = dialysisSolution.ReplacementWay
99
+		//	newprescribe.HemodialysisMachine = dialysisSolution.HemodialysisMachine
100
+		//	newprescribe.BloodFilter = dialysisSolution.BloodFilter
101
+		//	newprescribe.PerfusionApparatus = dialysisSolution.PerfusionApparatus
102
+		//	newprescribe.BloodFlowVolume = dialysisSolution.BloodFlowVolume
103
+		//	newprescribe.DisplaceLiqui = dialysisSolution.DisplaceLiqui
104
+		//	newprescribe.Glucose = dialysisSolution.Glucose
105
+		//	newprescribe.DialysateFlow = dialysisSolution.DialysateFlow
106
+		//	newprescribe.Kalium = dialysisSolution.Kalium
107
+		//	newprescribe.Sodium = dialysisSolution.Sodium
108
+		//	newprescribe.Calcium = dialysisSolution.Calcium
109
+		//	newprescribe.Bicarbonate = dialysisSolution.Bicarbonate
110
+		//	newprescribe.DialysateTemperature = dialysisSolution.DialysateTemperature
111
+		//	newprescribe.Conductivity = dialysisSolution.Conductivity
112
+		//	newprescribe.BodyFluid = dialysisSolution.BodyFluid
113
+		//	newprescribe.SpecialMedicine = dialysisSolution.SpecialMedicine
114
+		//	newprescribe.SpecialMedicineOther = dialysisSolution.SpecialMedicineOther
115
+		//	newprescribe.DisplaceLiquiPart = dialysisSolution.DisplaceLiquiPart
116
+		//	newprescribe.DisplaceLiquiValue = dialysisSolution.DisplaceLiquiValue
117
+		//	newprescribe.BloodAccess = dialysisSolution.BloodAccess
118
+		//	newprescribe.Ultrafiltration = dialysisSolution.Ultrafiltration
119
+		//	newprescribe.DialysisDurationHour = dialysisSolution.DialysisDurationHour
120
+		//	newprescribe.DialysisDurationMinute = dialysisSolution.DialysisDurationMinute
121
+		//	newprescribe.TargetUltrafiltration = dialysisSolution.TargetUltrafiltration
122
+		//	newprescribe.DialysateFormulation = dialysisSolution.DialysateFormulation
123
+		//	newprescribe.Dialyzer = dialysisSolution.Dialyzer
124
+		//	newprescribe.ReplacementTotal = dialysisSolution.ReplacementTotal
125
+		//	newprescribe.DialyzerPerfusionApparatus = dialysisSolution.DialyzerPerfusionApparatus
126
+		//	newprescribe.BodyFluidOther = dialysisSolution.BodyFluidOther
127
+		//	newprescribe.TargetKtv = dialysisSolution.TargetKtv
128
+		//
129
+		//	newprescribe.CreatedTime = time.Now().Unix()
130
+		//	newprescribe.UpdatedTime = time.Now().Unix()
131
+		//	newprescribe.RecordDate = theAssessmentDateTime
132
+		//	// newprescribe.DewaterAmount = dewater_amount
133
+		//	// newprescribe.TargetUltrafiltration = dewater_amount
134
+		//	newprescribe.Status = 1
135
+		//
136
+		//	err := service.AddSigleRecord(&newprescribe)
137
+		//	if err != nil {
138
+		//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
139
+		//	}
140
+		//}
141
+
142
+		//if dialysisPrescribe == nil && dialysisSolution == nil {
143
+		//	var newprescribe models.DialysisPrescription
144
+		//	newprescribe.UserOrgId = adminUserInfo.Org.Id
145
+		//	newprescribe.PatientId = id
146
+		//	newprescribe.CreatedTime = time.Now().Unix()
147
+		//	newprescribe.UpdatedTime = time.Now().Unix()
148
+		//	newprescribe.RecordDate = theAssessmentDateTime
149
+		//	// newprescribe.DewaterAmount = dewater_amount
150
+		//	// newprescribe.TargetUltrafiltration = dewater_amount
151
+		//	newprescribe.Status = 1
152
+		//
153
+		//	err := service.AddSigleRecord(&newprescribe)
154
+		//	if err != nil {
155
+		//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
156
+		//	}
157
+		//}
158
+
159
+		//if dialysisPrescribe != nil {
160
+		//	dialysisPrescribe.UpdatedTime = time.Now().Unix()
161
+		//	dialysisPrescribe.RecordDate = theAssessmentDateTime
162
+		//	// dialysisPrescribe.DewaterAmount = dewater_amount
163
+		//	// dialysisPrescribe.TargetUltrafiltration = dewater_amount
164
+		//	dialysisPrescribe.Status = 1
165
+		//	updateErr := service.UpDateDialysisPrescription(dialysisPrescribe)
166
+		//	if updateErr != nil {
167
+		//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
168
+		//	}
169
+		//}
170
 
170
 
171
 		theEvaluation, getPEErr := service.MobileGetPredialysisEvaluation(adminUserInfo.Org.Id, id, theAssessmentDateTime)
171
 		theEvaluation, getPEErr := service.MobileGetPredialysisEvaluation(adminUserInfo.Org.Id, id, theAssessmentDateTime)
172
 		if getPEErr != nil {
172
 		if getPEErr != nil {
692
 		}
692
 		}
693
 	}
693
 	}
694
 }
694
 }
695
-
696
 func (c *CheckWeightApiController) GetPatientList() {
695
 func (c *CheckWeightApiController) GetPatientList() {
697
 	syncTime, _ := c.GetInt64("synctime", 0)
696
 	syncTime, _ := c.GetInt64("synctime", 0)
698
 	force, _ := c.GetInt64("force", 0)
697
 	force, _ := c.GetInt64("force", 0)
710
 		"servicetime": serviceTime,
709
 		"servicetime": serviceTime,
711
 	})
710
 	})
712
 }
711
 }
713
-
714
 func (c *CheckWeightApiController) GetPatientListById() {
712
 func (c *CheckWeightApiController) GetPatientListById() {
715
 	patientId, _ := c.GetInt64("patient_id", 0)
713
 	patientId, _ := c.GetInt64("patient_id", 0)
716
 	if patientId <= 0 {
714
 	if patientId <= 0 {
729
 		"patientinfo": patient,
727
 		"patientinfo": patient,
730
 	})
728
 	})
731
 }
729
 }
732
-
733
 func (c *CheckWeightApiController) GetPatientInfoDialysis() {
730
 func (c *CheckWeightApiController) GetPatientInfoDialysis() {
734
 	id, _ := c.GetInt64("patient", 0)
731
 	id, _ := c.GetInt64("patient", 0)
735
 	if id <= 0 {
732
 	if id <= 0 {
797
 
794
 
798
 		// 排队叫号的签到
795
 		// 排队叫号的签到
799
 		ssoDomain := beego.AppConfig.String("call_domain")
796
 		ssoDomain := beego.AppConfig.String("call_domain")
800
-		api := ssoDomain + "/index/patientsign/"+strconv.FormatInt(adminUserInfo.Org.Id, 10)+"/"+strconv.FormatInt(id, 10)
797
+		api := ssoDomain + "/index/patientsign/" + strconv.FormatInt(adminUserInfo.Org.Id, 10) + "/" + strconv.FormatInt(id, 10)
801
 		values := make(url.Values)
798
 		values := make(url.Values)
802
 
799
 
803
 		http.PostForm(api, values)
800
 		http.PostForm(api, values)
964
 		}
961
 		}
965
 	}
962
 	}
966
 
963
 
967
-
968
-
969
 	c.ServeSuccessJSON(map[string]interface{}{
964
 	c.ServeSuccessJSON(map[string]interface{}{
970
 		"dialysistype":     dialysistype,
965
 		"dialysistype":     dialysistype,
971
 		"patient":          dialysisinfo,
966
 		"patient":          dialysisinfo,
975
 	})
970
 	})
976
 	return
971
 	return
977
 }
972
 }
978
-
979
 func (c *CheckWeightApiController) GetPatientInfoBeforeDialysis() {
973
 func (c *CheckWeightApiController) GetPatientInfoBeforeDialysis() {
980
 	id, _ := c.GetInt64("patient", 0)
974
 	id, _ := c.GetInt64("patient", 0)
981
 	if id <= 0 {
975
 	if id <= 0 {

+ 22 - 10
controllers/mobile_api_controllers/dialysis_api_controller.go View File

2350
 			if advice.FrequencyType == 3 {
2350
 			if advice.FrequencyType == 3 {
2351
 				t := time.Now()
2351
 				t := time.Now()
2352
 				week := int(t.Weekday())
2352
 				week := int(t.Weekday())
2353
+				fmt.Println(t.Weekday())
2354
+
2355
+				fmt.Println(week)
2353
 
2356
 
2354
 				switch week {
2357
 				switch week {
2355
 				case 1:
2358
 				case 1:
2356
 					if strings.Index(advice.WeekDay, "周一") == -1 {
2359
 					if strings.Index(advice.WeekDay, "周一") == -1 {
2357
 						advice_three = append(advice_three, advice)
2360
 						advice_three = append(advice_three, advice)
2358
 					}
2361
 					}
2359
-
2360
 					break
2362
 					break
2361
 				case 2:
2363
 				case 2:
2362
 					if strings.Index(advice.WeekDay, "周二") == -1 {
2364
 					if strings.Index(advice.WeekDay, "周二") == -1 {
2363
 						advice_three = append(advice_three, advice)
2365
 						advice_three = append(advice_three, advice)
2364
 					}
2366
 					}
2365
-
2366
 					break
2367
 					break
2367
 				case 3:
2368
 				case 3:
2368
 					if strings.Index(advice.WeekDay, "周三") == -1 {
2369
 					if strings.Index(advice.WeekDay, "周三") == -1 {
2369
 						advice_three = append(advice_three, advice)
2370
 						advice_three = append(advice_three, advice)
2370
 					}
2371
 					}
2371
-
2372
 					break
2372
 					break
2373
 				case 4:
2373
 				case 4:
2374
 					if strings.Index(advice.WeekDay, "周四") == -1 {
2374
 					if strings.Index(advice.WeekDay, "周四") == -1 {
2384
 					if strings.Index(advice.WeekDay, "周六") == -1 {
2384
 					if strings.Index(advice.WeekDay, "周六") == -1 {
2385
 						advice_three = append(advice_three, advice)
2385
 						advice_three = append(advice_three, advice)
2386
 					}
2386
 					}
2387
-
2388
 					break
2387
 					break
2389
 				case 0:
2388
 				case 0:
2390
 					if strings.Index(advice.WeekDay, "周日") == -1 {
2389
 					if strings.Index(advice.WeekDay, "周日") == -1 {
3581
 					for _, before := range beforePrepares {
3580
 					for _, before := range beforePrepares {
3582
 
3581
 
3583
 						if consumable.GoodId == before.GoodId {
3582
 						if consumable.GoodId == before.GoodId {
3584
-							fmt.Println(consumable.Count)
3585
-							fmt.Println(before.Count)
3586
 
3583
 
3587
 							if consumable.Count != before.Count {
3584
 							if consumable.Count != before.Count {
3588
-								fmt.Println("111111111")
3589
 								_, out := service.FindStockOutOrderNumberByTime(record_time, adminInfo.Org.Id)
3585
 								_, out := service.FindStockOutOrderNumberByTime(record_time, adminInfo.Org.Id)
3590
 								//_, out := service.FindOldOrderInfoByGoodId(record_time, adminInfo.Org.Id)
3586
 								//_, out := service.FindOldOrderInfoByGoodId(record_time, adminInfo.Org.Id)
3591
 								//判断前端更改后的商品id的出库记录在数据库中是否存在
3587
 								//判断前端更改后的商品id的出库记录在数据库中是否存在
3592
 								err, newOut := service.FindOrderInfoByGoodId(consumable.GoodTypeId, consumable.GoodId, out.WarehouseOutOrderNumber, adminInfo.Org.Id)
3588
 								err, newOut := service.FindOrderInfoByGoodId(consumable.GoodTypeId, consumable.GoodId, out.WarehouseOutOrderNumber, adminInfo.Org.Id)
3593
 								if err == gorm.ErrRecordNotFound { //不存在,则新增出库记录,并更改使用人商品信息
3589
 								if err == gorm.ErrRecordNotFound { //不存在,则新增出库记录,并更改使用人商品信息
3594
-									fmt.Println("222222222")
3595
 
3590
 
3596
 									warehouseOutInfo := &models.WarehouseOutInfo{
3591
 									warehouseOutInfo := &models.WarehouseOutInfo{
3597
 										WarehouseOutOrderNumber: out.WarehouseOutOrderNumber,
3592
 										WarehouseOutOrderNumber: out.WarehouseOutOrderNumber,
3614
 									err := service.AddSigleWarehouseOutInfo(warehouseOutInfo)
3609
 									err := service.AddSigleWarehouseOutInfo(warehouseOutInfo)
3615
 									if err == nil {
3610
 									if err == nil {
3616
 										//可能存在商品使用人不存在的情况,需要先判断商品使用人是否存在
3611
 										//可能存在商品使用人不存在的情况,需要先判断商品使用人是否存在
3617
-										user, err := service.FindGoodUserById(before.GoodTypeId, before.GoodId, patient_id, adminInfo.Org.Id, out.WarehouseOutOrderNumber)
3612
+										user, err := service.FindGoodUserById(before.GoodTypeId, before.GoodId, patient_id, adminInfo.Org.Id, record_time)
3618
 										if err == gorm.ErrRecordNotFound {
3613
 										if err == gorm.ErrRecordNotFound {
3619
 											details := &models.AutomaticReduceDetail{
3614
 											details := &models.AutomaticReduceDetail{
3620
 												WarehouseOutId:          warehouseOutInfo.ID,
3615
 												WarehouseOutId:          warehouseOutInfo.ID,
3655
 										} else if consumable.Count < before.Count { //增加
3650
 										} else if consumable.Count < before.Count { //增加
3656
 											service.UpdateOrderCountAdd(consumable.GoodTypeId, consumable.GoodId, out.WarehouseOutOrderNumber, adminInfo.Org.Id, before.Count-consumable.Count)
3651
 											service.UpdateOrderCountAdd(consumable.GoodTypeId, consumable.GoodId, out.WarehouseOutOrderNumber, adminInfo.Org.Id, before.Count-consumable.Count)
3657
 										}
3652
 										}
3658
-										user, err := service.FindGoodUserById(consumable.GoodTypeId, consumable.GoodId, patient_id, adminInfo.Org.Id, out.WarehouseOutOrderNumber)
3653
+										user, err := service.FindGoodUserById(consumable.GoodTypeId, consumable.GoodId, patient_id, adminInfo.Org.Id, record_time)
3659
 										if err == gorm.ErrRecordNotFound {
3654
 										if err == gorm.ErrRecordNotFound {
3660
 											details := &models.AutomaticReduceDetail{
3655
 											details := &models.AutomaticReduceDetail{
3661
 												WarehouseOutId:          newOut.ID,
3656
 												WarehouseOutId:          newOut.ID,
4267
 	})
4262
 	})
4268
 
4263
 
4269
 }
4264
 }
4265
+
4266
+func RemoveRepeatedGoodTwo(arr []*models.DialysisBeforePrepare) (newArr []*models.DialysisBeforePrepare) {
4267
+	newArr = make([]*models.DialysisBeforePrepare, 0)
4268
+	for i := 0; i < len(arr); i++ {
4269
+		repeat := false
4270
+		for j := i + 1; j < len(arr); j++ {
4271
+			if arr[i].GoodId == arr[j].GoodId {
4272
+				repeat = true
4273
+				break
4274
+			}
4275
+		}
4276
+		if !repeat {
4277
+			newArr = append(newArr, arr[i])
4278
+		}
4279
+	}
4280
+	return
4281
+}

+ 0 - 1
controllers/mobile_api_controllers/patient_api_controller.go View File

2792
 
2792
 
2793
 func (c *PatientApiController) CreateGroupAdvice() {
2793
 func (c *PatientApiController) CreateGroupAdvice() {
2794
 	is_child, _ := c.GetInt64("is_child", 0)
2794
 	is_child, _ := c.GetInt64("is_child", 0)
2795
-	fmt.Println("is_child------------------------------", is_child)
2796
 	if is_child == 1 {
2795
 	if is_child == 1 {
2797
 		patient, _ := c.GetInt64("id", 0)
2796
 		patient, _ := c.GetInt64("id", 0)
2798
 		if patient <= 0 {
2797
 		if patient <= 0 {

+ 1 - 0
controllers/schedule_api_controller.go View File

1277
 				date, _ := utils.ParseTimeStringToTime("2006-01-02", schedule_date)
1277
 				date, _ := utils.ParseTimeStringToTime("2006-01-02", schedule_date)
1278
 				sch.ScheduleDate = date.Unix()
1278
 				sch.ScheduleDate = date.Unix()
1279
 			}
1279
 			}
1280
+
1280
 			sch.CreatedTime = time.Now().Unix()
1281
 			sch.CreatedTime = time.Now().Unix()
1281
 			sch.UpdatedTime = time.Now().Unix()
1282
 			sch.UpdatedTime = time.Now().Unix()
1282
 			sch.ModeId = 1
1283
 			sch.ModeId = 1

+ 1 - 0
routers/router.go View File

53
 	controllers.PCIndexEvaluationApiControllersRegisterRouters()
53
 	controllers.PCIndexEvaluationApiControllersRegisterRouters()
54
 	controllers.ManagerCenterRegistRouters()
54
 	controllers.ManagerCenterRegistRouters()
55
 	controllers.DrugStockManagerApiRegistRouters()
55
 	controllers.DrugStockManagerApiRegistRouters()
56
+	controllers.HisManagerApiRegistRouters()
56
 
57
 
57
 	m_api.MobileAPIControllersRegisterRouters()
58
 	m_api.MobileAPIControllersRegisterRouters()
58
 	new_m_api.NewMobileAPIControllersRegisterRouters()
59
 	new_m_api.NewMobileAPIControllersRegisterRouters()

+ 2 - 3
service/dialysis_service.go View File

171
 	return
171
 	return
172
 }
172
 }
173
 
173
 
174
-
175
 //修改机构叫号配置
174
 //修改机构叫号配置
176
 func UpDateQueueCallInfo(queueConfig models.QueueCallConfig) error {
175
 func UpDateQueueCallInfo(queueConfig models.QueueCallConfig) error {
177
 	err := writeDb.Save(&queueConfig).Error
176
 	err := writeDb.Save(&queueConfig).Error
981
 	return
980
 	return
982
 }
981
 }
983
 
982
 
984
-func FindGoodUserById(good_type_id int64, good_id int64, id int64, org_id int64, number string) (user models.AutomaticReduceDetail, err error) {
985
-	err = readDb.Model(&models.AutomaticReduceDetail{}).Where("good_id = ? AND good_type_id = ? AND patient_id = ? AND org_id = ? AND warehouse_out_order_number = ? ", good_id, good_type_id, id, org_id, number).First(&user).Error
983
+func FindGoodUserById(good_type_id int64, good_id int64, id int64, org_id int64, record_time int64) (user models.AutomaticReduceDetail, err error) {
984
+	err = readDb.Model(&models.AutomaticReduceDetail{}).Where("good_id = ? AND good_type_id = ? AND patient_id = ? AND org_id = ? AND record_time = ? ", good_id, good_type_id, id, org_id, record_time).First(&user).Error
986
 	return
985
 	return
987
 }
986
 }
988
 
987
 

+ 3 - 0
service/doctor_advice_service.go View File

324
 	TemplateId            string          `gorm:"column:template_id" json:"template_id"`
324
 	TemplateId            string          `gorm:"column:template_id" json:"template_id"`
325
 	Modifier              int64           `gorm:"column:modifier" json:"modifier" form:"modifier"`
325
 	Modifier              int64           `gorm:"column:modifier" json:"modifier" form:"modifier"`
326
 	IsCheck               int64           `gorm:"-" json:"is_check" form:"is_check"`
326
 	IsCheck               int64           `gorm:"-" json:"is_check" form:"is_check"`
327
+	Way                   int64           `gorm:"column:way" json:"way" form:"way"`
328
+	DrugId                int64           `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
329
+	DrugNameId            int64           `gorm:"column:drug_name_id" json:"drug_name_id" form:"drug_name_id"`
327
 }
330
 }
328
 
331
 
329
 func (DoctorAdvice) TableName() string {
332
 func (DoctorAdvice) TableName() string {

+ 36 - 0
service/patient_service.go View File

1369
 	err = readDb.Model(&models.DoctorAdvice{}).Where("user_org_id = ? AND status = 1 AND execution_state = 2 AND (id IN (?) OR parent_id IN (?))", orgID, ids, ids).Find(&advice).Error
1369
 	err = readDb.Model(&models.DoctorAdvice{}).Where("user_org_id = ? AND status = 1 AND execution_state = 2 AND (id IN (?) OR parent_id IN (?))", orgID, ids, ids).Find(&advice).Error
1370
 	return
1370
 	return
1371
 }
1371
 }
1372
+
1373
+func CreateHisGroupAdvice(orgId int64, advices []*models.HisGroupAdvice, groupNo int64) (list []*models.HisGroupAdvice, err error) {
1374
+	if groupNo <= 0 {
1375
+		group := GetMaxAdviceGroupID(orgId)
1376
+		groupNo = group + 1
1377
+	}
1378
+	tx := writeDb.Begin()
1379
+	defer func() {
1380
+		if r := recover(); r != nil {
1381
+			tx.Rollback()
1382
+		}
1383
+	}()
1384
+	for _, advice := range advices {
1385
+		advice.Groupno = groupNo
1386
+		if err = tx.Create(advice).Error; err != nil {
1387
+			tx.Rollback()
1388
+			return
1389
+		}
1390
+		list = append(list, advice)
1391
+		if len(advice.Children) > 0 {
1392
+			for _, child := range advice.Children {
1393
+				child.Groupno = groupNo
1394
+				child.ParentId = advice.ID
1395
+				fmt.Println(child)
1396
+				if err = tx.Create(&child).Error; err != nil {
1397
+					tx.Rollback()
1398
+					return
1399
+				}
1400
+				list = append(list, child)
1401
+			}
1402
+		}
1403
+
1404
+	}
1405
+	tx.Commit()
1406
+	return
1407
+}

+ 1 - 1
service/schedule_service.go View File

13
 //GetSchedulePartitionPanel 取出排班面板,分区-机号
13
 //GetSchedulePartitionPanel 取出排班面板,分区-机号
14
 func GetSchedulePartitionPanel(orgID int64) (partitions []*models.Partition, err error) {
14
 func GetSchedulePartitionPanel(orgID int64) (partitions []*models.Partition, err error) {
15
 
15
 
16
-	err = readDb.Model(&models.DeviceZone{}).Preload("Jihaos", "org_id=? and status=1", orgID).Where("org_id=? and status=1", orgID).Find(&partitions).Error
16
+	err = readDb.Model(&models.DeviceZone{}).Preload("Jihaos", "org_id=? and status=1", orgID).Where("org_id=? and status=1", orgID).Order("").Find(&partitions).Error
17
 
17
 
18
 	return
18
 	return
19
 }
19
 }