Parcourir la source

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

陈少旭 il y a 1 mois
Parent
révision
1dce24b157

BIN
XT_New.exe Voir le fichier


+ 7 - 0
controllers/dialysis_api_controller.go Voir le fichier

5009
 		endTime = theTime.Unix()
5009
 		endTime = theTime.Unix()
5010
 	}
5010
 	}
5011
 
5011
 
5012
+	if xttime < 1740931200 {
5013
+
5014
+		startTime = 1740326400
5015
+
5016
+		endTime = 1740844800
5017
+	}
5018
+
5012
 	scheduleDialyCount, _ := service.GetPatientScheduleDialyCount(patientInfo.ID, startTime, endTime, adminUserInfo.CurrentOrgId)
5019
 	scheduleDialyCount, _ := service.GetPatientScheduleDialyCount(patientInfo.ID, startTime, endTime, adminUserInfo.CurrentOrgId)
5013
 
5020
 
5014
 	dialysis_count := len(scheduleDialyCount)
5021
 	dialysis_count := len(scheduleDialyCount)

+ 1 - 1
controllers/mobile_api_controllers/dialysis_api_controller.go Voir le fichier

4147
 	}
4147
 	}
4148
 
4148
 
4149
 	//只针对广慈医院
4149
 	//只针对广慈医院
4150
-	if template.TemplateId == 26 || template.TemplateId == 25 || template.TemplateId == 28 || adminUserInfo.Org.Id == 9987 || adminUserInfo.Org.Id == 9526 || template.TemplateId == 32 || adminUserInfo.Org.Id == 9918 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 4 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10517 || adminUserInfo.Org.Id == 10679 || adminUserInfo.Org.Id == 10742 {
4150
+	if template.TemplateId == 26 || template.TemplateId == 25 || template.TemplateId == 28 || adminUserInfo.Org.Id == 9987 || adminUserInfo.Org.Id == 9526 || template.TemplateId == 32 || adminUserInfo.Org.Id == 9918 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 4 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10517 || adminUserInfo.Org.Id == 10679 || adminUserInfo.Org.Id == 10742 || adminUserInfo.Org.Id == 10757 {
4151
 		// 查询病人是否有透前评估数据
4151
 		// 查询病人是否有透前评估数据
4152
 		befor, errcode := service.GetAssessmentBefor(adminUserInfo.Org.Id, patientID, recordDate.Unix())
4152
 		befor, errcode := service.GetAssessmentBefor(adminUserInfo.Org.Id, patientID, recordDate.Unix())
4153
 
4153
 

+ 8 - 1
controllers/mobile_api_controllers/patient_api_controller.go Voir le fichier

6264
 		endTime = theTime.Unix()
6264
 		endTime = theTime.Unix()
6265
 	}
6265
 	}
6266
 
6266
 
6267
+	if xttime < 1740931200 {
6268
+
6269
+		startTime = 1740326400
6270
+
6271
+		endTime = 1740844800
6272
+	}
6273
+
6267
 	scheduleDialyCount, _ := service.GetPatientScheduleDialyCount(patientInfo.ID, startTime, endTime, adminUserInfo.Org.Id)
6274
 	scheduleDialyCount, _ := service.GetPatientScheduleDialyCount(patientInfo.ID, startTime, endTime, adminUserInfo.Org.Id)
6268
 
6275
 
6269
 	dialysis_count_one := len(scheduleDialyCount)
6276
 	dialysis_count_one := len(scheduleDialyCount)
6952
 		adminUserInfo := c.GetMobileAdminUserInfo()
6959
 		adminUserInfo := c.GetMobileAdminUserInfo()
6953
 		var advice models.DoctorAdvice
6960
 		var advice models.DoctorAdvice
6954
 		if groupno > 0 {
6961
 		if groupno > 0 {
6955
-			advice, _ = service.FindDoctorAdviceByGoroupNo(adminUserInfo.Org.Id, groupno)
6962
+			advice, _ = service.FindDoctorAdviceByGoroupNoOne(adminUserInfo.Org.Id, groupno, patient_id, doc_advice_date)
6956
 			if advice.ID == 0 {
6963
 			if advice.ID == 0 {
6957
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDoctorAdviceNotExist)
6964
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDoctorAdviceNotExist)
6958
 				return
6965
 				return

+ 33 - 11
controllers/new_stock_api_controller.go Voir le fichier

171
 	is_settle, _ := this.GetInt64("is_settle")
171
 	is_settle, _ := this.GetInt64("is_settle")
172
 	is_code, _ := this.GetInt64("is_code")
172
 	is_code, _ := this.GetInt64("is_code")
173
 
173
 
174
+	is_type, _ := this.GetInt64("is_type")
175
+
174
 	orgId := this.GetAdminUserInfo().CurrentOrgId
176
 	orgId := this.GetAdminUserInfo().CurrentOrgId
175
 	timeLayout := "2006-01-02"
177
 	timeLayout := "2006-01-02"
176
 	loc, _ := time.LoadLocation("Local")
178
 	loc, _ := time.LoadLocation("Local")
194
 		endTime = theTime.Unix()
196
 		endTime = theTime.Unix()
195
 	}
197
 	}
196
 
198
 
197
-	list, total, _ := service.GetHisDrugCodeQuery(orgId, startTime, endTime, limit, page, is_sale, is_settle, keywords, is_code)
199
+	if is_type == 1 {
200
+		list, total, _ := service.GetHisDrugCodeQuery(orgId, startTime, endTime, limit, page, is_sale, is_settle, keywords, is_code)
198
 
201
 
199
-	drug, _ := service.GetAllDrugList(orgId)
202
+		drug, _ := service.GetAllDrugList(orgId)
200
 
203
 
201
-	codeConfig, _ := service.GetDrugCodeConfig(orgId)
204
+		codeConfig, _ := service.GetDrugCodeConfig(orgId)
202
 
205
 
203
-	patients, _ := service.GetAllpatient(orgId)
204
-	this.ServeSuccessJSON(map[string]interface{}{
205
-		"list":       list,
206
-		"total":      total,
207
-		"drug":       drug,
208
-		"patients":   patients,
209
-		"codeConfig": codeConfig,
210
-	})
206
+		patients, _ := service.GetAllpatient(orgId)
207
+		this.ServeSuccessJSON(map[string]interface{}{
208
+			"list":       list,
209
+			"total":      total,
210
+			"drug":       drug,
211
+			"patients":   patients,
212
+			"codeConfig": codeConfig,
213
+		})
214
+	}
215
+
216
+	if is_type == 2 {
217
+		advice, total, _ := service.GetBloodDrugCode(orgId, startTime, endTime, limit, page, is_sale)
218
+
219
+		drug, _ := service.GetAllDrugList(orgId)
220
+
221
+		codeConfig, _ := service.GetDrugCodeConfig(orgId)
222
+
223
+		patients, _ := service.GetAllpatient(orgId)
224
+		this.ServeSuccessJSON(map[string]interface{}{
225
+			"list":       advice,
226
+			"total":      total,
227
+			"drug":       drug,
228
+			"patients":   patients,
229
+			"codeConfig": codeConfig,
230
+		})
231
+
232
+	}
211
 
233
 
212
 	return
234
 	return
213
 }
235
 }

+ 7 - 1
controllers/print_data_api_controller.go Voir le fichier

257
 				endTime = theTime.Unix()
257
 				endTime = theTime.Unix()
258
 			}
258
 			}
259
 
259
 
260
+			if item.ScheduleDate < 1740931200 {
261
+
262
+				startTime = 1740326400
263
+
264
+				endTime = 1740844800
265
+			}
266
+
260
 			scheduleDialyCount, _ := service.GetPatientScheduleDialyCount(item.PatientID, startTime, endTime, adminUserInfo.CurrentOrgId)
267
 			scheduleDialyCount, _ := service.GetPatientScheduleDialyCount(item.PatientID, startTime, endTime, adminUserInfo.CurrentOrgId)
261
 
268
 
262
-			fmt.Println("scheduleDialyCount------------------", scheduleDialyCount)
263
 			dialysis_count := len(scheduleDialyCount)
269
 			dialysis_count := len(scheduleDialyCount)
264
 
270
 
265
 			var dialysis_count_str = "一周" + strconv.Itoa(dialysis_count) + "次"
271
 			var dialysis_count_str = "一周" + strconv.Itoa(dialysis_count) + "次"

+ 1 - 0
models/dialysis.go Voir le fichier

465
 	IsSettle              int64           `gorm:"column:is_settle" json:"is_settle" form:"is_settle"`
465
 	IsSettle              int64           `gorm:"column:is_settle" json:"is_settle" form:"is_settle"`
466
 	IsPrescription        int64           `gorm:"column:is_prescription" json:"is_prescription" form:"is_prescription"`
466
 	IsPrescription        int64           `gorm:"column:is_prescription" json:"is_prescription" form:"is_prescription"`
467
 	DrugCode              string          `gorm:"column:drug_code" json:"drug_code" form:"drug_code"`
467
 	DrugCode              string          `gorm:"column:drug_code" json:"drug_code" form:"drug_code"`
468
+	IsUpload              int64           `gorm:"column:is_upload" json:"is_upload" form:"is_upload"`
468
 }
469
 }
469
 
470
 
470
 func (DoctorAdvice) TableName() string {
471
 func (DoctorAdvice) TableName() string {

+ 11 - 6
service/new_warehouse_service.go Voir le fichier

4606
 				warehouse.StockMaxNumber = warehouse.StockMaxNumber - 1
4606
 				warehouse.StockMaxNumber = warehouse.StockMaxNumber - 1
4607
 			}
4607
 			}
4608
 
4608
 
4609
+			if warehouse.MaxUnit != warehouse.MinUnit {
4610
+				warehouse.StockMinNumber = warehouse.StockMinNumber + drup.MinNumber - minNumber
4611
+			}
4612
+			fmt.Println("minNumber------", minNumber)
4613
+			fmt.Println("warehouse.StockMinNumber", warehouse.StockMinNumber)
4614
+			fmt.Println(" warehouse.MaxUnit", warehouse.MaxUnit)
4615
+			fmt.Println(" warehouse.MinUnit", warehouse.MinUnit)
4616
+
4609
 			if warehouse.MaxUnit == warehouse.MinUnit {
4617
 			if warehouse.MaxUnit == warehouse.MinUnit {
4610
 				//改动的地方
4618
 				//改动的地方
4611
 				warehouse.StockMaxNumber = warehouse.StockMaxNumber - minNumber
4619
 				warehouse.StockMaxNumber = warehouse.StockMaxNumber - minNumber
4612
 			}
4620
 			}
4613
 
4621
 
4614
-			if warehouse.MaxUnit != warehouse.MinUnit {
4615
-				warehouse.StockMinNumber = warehouse.StockMinNumber + drup.MinNumber - minNumber
4616
-			}
4617
-			if minNumber == 2 && warehouse.MaxUnit == warehouse.MinUnit && warehouse.StockMinNumber == 0 {
4618
-				warehouse.StockMaxNumber = warehouse.StockMaxNumber - 1
4619
-			}
4622
+			//if minNumber == 2 && warehouse.MaxUnit == warehouse.MinUnit && warehouse.StockMinNumber == 0 {
4623
+			//	warehouse.StockMaxNumber = warehouse.StockMaxNumber - 1
4624
+			//}
4620
 		} else {
4625
 		} else {
4621
 
4626
 
4622
 			if minNumber > 0 {
4627
 			if minNumber > 0 {

+ 5 - 0
service/patient_service.go Voir le fichier

1757
 	return
1757
 	return
1758
 }
1758
 }
1759
 
1759
 
1760
+func FindDoctorAdviceByGoroupNoOne(orgID int64, groupno int64, patient_id int64, advice_date int64) (advice models.DoctorAdvice, err error) {
1761
+	err = readDb.Model(&models.DoctorAdvice{}).Where("user_org_id=?  AND groupno = ? AND status = 1 and patient_id = ? and advice_date =?", orgID, groupno, patient_id, advice_date).First(&advice).Error
1762
+	return
1763
+}
1764
+
1760
 func FindOldDoctorAdvice(orgID int64, advice_id int64) (advice models.DoctorAdvice, err error) {
1765
 func FindOldDoctorAdvice(orgID int64, advice_id int64) (advice models.DoctorAdvice, err error) {
1761
 	err = readDb.Model(&models.DoctorAdvice{}).Where("id = ? AND user_org_id=? AND status = 1", advice_id, orgID).First(&advice).Error
1766
 	err = readDb.Model(&models.DoctorAdvice{}).Where("id = ? AND user_org_id=? AND status = 1", advice_id, orgID).First(&advice).Error
1762
 	return
1767
 	return

+ 25 - 0
service/stock_service.go Voir le fichier

11066
 	return list, total, err
11066
 	return list, total, err
11067
 }
11067
 }
11068
 
11068
 
11069
+func GetBloodDrugCode(orgId int64, start_time int64, end_time int64, limit int64, page int64, is_sale int64) (advice []*models.DoctorAdvice, total int64, err error) {
11070
+
11071
+	db := XTReadDB().Model(&advice).Where("status=1 and advice_type !=1")
11072
+
11073
+	if orgId > 0 {
11074
+		db = db.Where("user_org_id = ?", orgId)
11075
+	}
11076
+
11077
+	if start_time > 0 {
11078
+		db = db.Where("advice_date>=?", start_time)
11079
+	}
11080
+
11081
+	if end_time > 0 {
11082
+		db = db.Where("advice_date<=?", end_time)
11083
+	}
11084
+
11085
+	if is_sale > 0 {
11086
+		db = db.Where("is_upload = ?", is_sale)
11087
+	}
11088
+	offset := (page - 1) * limit
11089
+	err = db.Count(&total).Offset(offset).Limit(limit).Order("advice_date desc").Find(&advice).Error
11090
+
11091
+	return advice, total, err
11092
+}
11093
+
11069
 func GetDoctorAdviceInfoList(page int64, limit int64, orgId int64, start_time int64, end_time int64, is_sale int64) ([]models.HisDoctorAdviceInfo, int64, error) {
11094
 func GetDoctorAdviceInfoList(page int64, limit int64, orgId int64, start_time int64, end_time int64, is_sale int64) ([]models.HisDoctorAdviceInfo, int64, error) {
11070
 	var list []models.HisDoctorAdviceInfo
11095
 	var list []models.HisDoctorAdviceInfo
11071
 	var total int64
11096
 	var total int64