28169 преди 3 месеца
родител
ревизия
1aab9c2b88

+ 1 - 1
controllers/mobile_api_controllers/patient_api_controller.go Целия файл

6959
 		adminUserInfo := c.GetMobileAdminUserInfo()
6959
 		adminUserInfo := c.GetMobileAdminUserInfo()
6960
 		var advice models.DoctorAdvice
6960
 		var advice models.DoctorAdvice
6961
 		if groupno > 0 {
6961
 		if groupno > 0 {
6962
-			advice, _ = service.FindDoctorAdviceByGoroupNo(adminUserInfo.Org.Id, groupno)
6962
+			advice, _ = service.FindDoctorAdviceByGoroupNoOne(adminUserInfo.Org.Id, groupno, patient_id, doc_advice_date)
6963
 			if advice.ID == 0 {
6963
 			if advice.ID == 0 {
6964
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDoctorAdviceNotExist)
6964
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDoctorAdviceNotExist)
6965
 				return
6965
 				return

+ 33 - 11
controllers/new_stock_api_controller.go Целия файл

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
 }

+ 1 - 0
models/dialysis.go Целия файл

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 Целия файл

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 Целия файл

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 Целия файл

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