Przeglądaj źródła

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

csx 4 lat temu
rodzic
commit
72a5675478

+ 3 - 3
controllers/base_api_controller.go Wyświetl plik

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

+ 103 - 109
controllers/mobile_api_controllers/check_weight_api_controller.go Wyświetl plik

@@ -4,15 +4,15 @@ import (
4 4
 	"XT_New/enums"
5 5
 	"XT_New/models"
6 6
 	"XT_New/service"
7
-	"github.com/astaxie/beego"
8
-	"net/http"
9
-	"net/url"
10
-	"strconv"
11 7
 	_ "XT_New/utils"
12 8
 	_ "encoding/json"
13 9
 	"fmt"
10
+	"github.com/astaxie/beego"
14 11
 	_ "github.com/astaxie/beego"
15 12
 	"github.com/jinzhu/gorm"
13
+	"net/http"
14
+	"net/url"
15
+	"strconv"
16 16
 	_ "strings"
17 17
 
18 18
 	// "fmt"
@@ -67,106 +67,106 @@ func (c *CheckWeightApiController) SaveBloodPressure() {
67 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 171
 		theEvaluation, getPEErr := service.MobileGetPredialysisEvaluation(adminUserInfo.Org.Id, id, theAssessmentDateTime)
172 172
 		if getPEErr != nil {
@@ -692,7 +692,6 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
692 692
 		}
693 693
 	}
694 694
 }
695
-
696 695
 func (c *CheckWeightApiController) GetPatientList() {
697 696
 	syncTime, _ := c.GetInt64("synctime", 0)
698 697
 	force, _ := c.GetInt64("force", 0)
@@ -710,7 +709,6 @@ func (c *CheckWeightApiController) GetPatientList() {
710 709
 		"servicetime": serviceTime,
711 710
 	})
712 711
 }
713
-
714 712
 func (c *CheckWeightApiController) GetPatientListById() {
715 713
 	patientId, _ := c.GetInt64("patient_id", 0)
716 714
 	if patientId <= 0 {
@@ -729,7 +727,6 @@ func (c *CheckWeightApiController) GetPatientListById() {
729 727
 		"patientinfo": patient,
730 728
 	})
731 729
 }
732
-
733 730
 func (c *CheckWeightApiController) GetPatientInfoDialysis() {
734 731
 	id, _ := c.GetInt64("patient", 0)
735 732
 	if id <= 0 {
@@ -797,7 +794,7 @@ func (c *CheckWeightApiController) GetPatientInfoDialysis() {
797 794
 
798 795
 		// 排队叫号的签到
799 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 798
 		values := make(url.Values)
802 799
 
803 800
 		http.PostForm(api, values)
@@ -964,8 +961,6 @@ func (c *CheckWeightApiController) GetPatientInfoDialysis() {
964 961
 		}
965 962
 	}
966 963
 
967
-
968
-
969 964
 	c.ServeSuccessJSON(map[string]interface{}{
970 965
 		"dialysistype":     dialysistype,
971 966
 		"patient":          dialysisinfo,
@@ -975,7 +970,6 @@ func (c *CheckWeightApiController) GetPatientInfoDialysis() {
975 970
 	})
976 971
 	return
977 972
 }
978
-
979 973
 func (c *CheckWeightApiController) GetPatientInfoBeforeDialysis() {
980 974
 	id, _ := c.GetInt64("patient", 0)
981 975
 	if id <= 0 {

+ 22 - 10
controllers/mobile_api_controllers/dialysis_api_controller.go Wyświetl plik

@@ -2350,25 +2350,25 @@ func (c *DialysisAPIController) GetLongAdvice() {
2350 2350
 			if advice.FrequencyType == 3 {
2351 2351
 				t := time.Now()
2352 2352
 				week := int(t.Weekday())
2353
+				fmt.Println(t.Weekday())
2354
+
2355
+				fmt.Println(week)
2353 2356
 
2354 2357
 				switch week {
2355 2358
 				case 1:
2356 2359
 					if strings.Index(advice.WeekDay, "周一") == -1 {
2357 2360
 						advice_three = append(advice_three, advice)
2358 2361
 					}
2359
-
2360 2362
 					break
2361 2363
 				case 2:
2362 2364
 					if strings.Index(advice.WeekDay, "周二") == -1 {
2363 2365
 						advice_three = append(advice_three, advice)
2364 2366
 					}
2365
-
2366 2367
 					break
2367 2368
 				case 3:
2368 2369
 					if strings.Index(advice.WeekDay, "周三") == -1 {
2369 2370
 						advice_three = append(advice_three, advice)
2370 2371
 					}
2371
-
2372 2372
 					break
2373 2373
 				case 4:
2374 2374
 					if strings.Index(advice.WeekDay, "周四") == -1 {
@@ -2384,7 +2384,6 @@ func (c *DialysisAPIController) GetLongAdvice() {
2384 2384
 					if strings.Index(advice.WeekDay, "周六") == -1 {
2385 2385
 						advice_three = append(advice_three, advice)
2386 2386
 					}
2387
-
2388 2387
 					break
2389 2388
 				case 0:
2390 2389
 					if strings.Index(advice.WeekDay, "周日") == -1 {
@@ -3581,17 +3580,13 @@ func (c *DialysisAPIController) EditConsumables() {
3581 3580
 					for _, before := range beforePrepares {
3582 3581
 
3583 3582
 						if consumable.GoodId == before.GoodId {
3584
-							fmt.Println(consumable.Count)
3585
-							fmt.Println(before.Count)
3586 3583
 
3587 3584
 							if consumable.Count != before.Count {
3588
-								fmt.Println("111111111")
3589 3585
 								_, out := service.FindStockOutOrderNumberByTime(record_time, adminInfo.Org.Id)
3590 3586
 								//_, out := service.FindOldOrderInfoByGoodId(record_time, adminInfo.Org.Id)
3591 3587
 								//判断前端更改后的商品id的出库记录在数据库中是否存在
3592 3588
 								err, newOut := service.FindOrderInfoByGoodId(consumable.GoodTypeId, consumable.GoodId, out.WarehouseOutOrderNumber, adminInfo.Org.Id)
3593 3589
 								if err == gorm.ErrRecordNotFound { //不存在,则新增出库记录,并更改使用人商品信息
3594
-									fmt.Println("222222222")
3595 3590
 
3596 3591
 									warehouseOutInfo := &models.WarehouseOutInfo{
3597 3592
 										WarehouseOutOrderNumber: out.WarehouseOutOrderNumber,
@@ -3614,7 +3609,7 @@ func (c *DialysisAPIController) EditConsumables() {
3614 3609
 									err := service.AddSigleWarehouseOutInfo(warehouseOutInfo)
3615 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 3613
 										if err == gorm.ErrRecordNotFound {
3619 3614
 											details := &models.AutomaticReduceDetail{
3620 3615
 												WarehouseOutId:          warehouseOutInfo.ID,
@@ -3655,7 +3650,7 @@ func (c *DialysisAPIController) EditConsumables() {
3655 3650
 										} else if consumable.Count < before.Count { //增加
3656 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 3654
 										if err == gorm.ErrRecordNotFound {
3660 3655
 											details := &models.AutomaticReduceDetail{
3661 3656
 												WarehouseOutId:          newOut.ID,
@@ -4267,3 +4262,20 @@ func (c *DialysisAPIController) GetAllDrug() {
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 Wyświetl plik

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

+ 1 - 0
controllers/schedule_api_controller.go Wyświetl plik

@@ -1277,6 +1277,7 @@ func (this *ScheduleApiController) ExportSchedule() {
1277 1277
 				date, _ := utils.ParseTimeStringToTime("2006-01-02", schedule_date)
1278 1278
 				sch.ScheduleDate = date.Unix()
1279 1279
 			}
1280
+
1280 1281
 			sch.CreatedTime = time.Now().Unix()
1281 1282
 			sch.UpdatedTime = time.Now().Unix()
1282 1283
 			sch.ModeId = 1

+ 1 - 0
routers/router.go Wyświetl plik

@@ -53,6 +53,7 @@ func init() {
53 53
 	controllers.PCIndexEvaluationApiControllersRegisterRouters()
54 54
 	controllers.ManagerCenterRegistRouters()
55 55
 	controllers.DrugStockManagerApiRegistRouters()
56
+	controllers.HisManagerApiRegistRouters()
56 57
 
57 58
 	m_api.MobileAPIControllersRegisterRouters()
58 59
 	new_m_api.NewMobileAPIControllersRegisterRouters()

+ 2 - 3
service/dialysis_service.go Wyświetl plik

@@ -171,7 +171,6 @@ func FindQueueCallInfo(orgID int64) (queueConfig models.QueueCallConfig, err err
171 171
 	return
172 172
 }
173 173
 
174
-
175 174
 //修改机构叫号配置
176 175
 func UpDateQueueCallInfo(queueConfig models.QueueCallConfig) error {
177 176
 	err := writeDb.Save(&queueConfig).Error
@@ -981,8 +980,8 @@ func FindOrderInfoByGoodId(good_type_id int64, good_id int64, number string, org
981 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 985
 	return
987 986
 }
988 987
 

+ 3 - 0
service/doctor_advice_service.go Wyświetl plik

@@ -324,6 +324,9 @@ type DoctorAdvice struct {
324 324
 	TemplateId            string          `gorm:"column:template_id" json:"template_id"`
325 325
 	Modifier              int64           `gorm:"column:modifier" json:"modifier" form:"modifier"`
326 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 332
 func (DoctorAdvice) TableName() string {

+ 36 - 0
service/patient_service.go Wyświetl plik

@@ -1369,3 +1369,39 @@ func FindDoctorAdviceByIdsTwo(orgID int64, ids []string) (advice []models.Doctor
1369 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 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 Wyświetl plik

@@ -13,7 +13,7 @@ import (
13 13
 //GetSchedulePartitionPanel 取出排班面板,分区-机号
14 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 18
 	return
19 19
 }