XMLWAN hace 4 años
padre
commit
17b6ae5440

+ 4 - 2
controllers/mobile_api_controllers/dialysis_api_controller.go Ver fichero

4697
 
4697
 
4698
 	good_id, _ := c.GetInt64("good_id")
4698
 	good_id, _ := c.GetInt64("good_id")
4699
 	count, _ := c.GetInt64("count")
4699
 	count, _ := c.GetInt64("count")
4700
-	detail, _ := service.UpdateAutoReduceDetail(good_id, count)
4700
+	record_time, _ := c.GetInt64("record_time")
4701
+	detail, _ := service.UpdateAutoReduceDetail(good_id, count, record_time)
4701
 	c.ServeSuccessJSON(map[string]interface{}{
4702
 	c.ServeSuccessJSON(map[string]interface{}{
4702
 		"detail": detail,
4703
 		"detail": detail,
4703
 	})
4704
 	})
4707
 func (c *DialysisAPIController) DeleteAutoReduceDetail() {
4708
 func (c *DialysisAPIController) DeleteAutoReduceDetail() {
4708
 
4709
 
4709
 	good_id, _ := c.GetInt64("good_id")
4710
 	good_id, _ := c.GetInt64("good_id")
4710
-	err := service.DeleteAutoReduceDetail(good_id)
4711
+	record_time, _ := c.GetInt64("record_time")
4712
+	err := service.DeleteAutoReduceDetail(good_id, record_time)
4711
 	fmt.Print("err", err)
4713
 	fmt.Print("err", err)
4712
 	c.ServeSuccessJSON(map[string]interface{}{
4714
 	c.ServeSuccessJSON(map[string]interface{}{
4713
 		"msg": "批量删除成功",
4715
 		"msg": "批量删除成功",

+ 4 - 7
service/mobile_dialysis_service.go Ver fichero

1965
 
1965
 
1966
 func GetPatientDialysisRecordList(patientid int64, startime int64, endtime int64) (order []*models.XtDialysisOrders, err error) {
1966
 func GetPatientDialysisRecordList(patientid int64, startime int64, endtime int64) (order []*models.XtDialysisOrders, err error) {
1967
 
1967
 
1968
-	//err = XTReadDB().Where("patient_id = ? and dialysis_date>=? and dialysis_date<=?  and status = 1", patientid, startime, endtime).Find(&order).Error
1969
-	//return order, err
1970
-
1971
 	db := XTReadDB().Table("xt_dialysis_order as x").Where("x.status = 1")
1968
 	db := XTReadDB().Table("xt_dialysis_order as x").Where("x.status = 1")
1972
 	table := XTReadDB().Table("xt_schedule as s")
1969
 	table := XTReadDB().Table("xt_schedule as s")
1973
 	fmt.Println(table)
1970
 	fmt.Println(table)
1997
 
1994
 
1998
 }
1995
 }
1999
 
1996
 
2000
-func UpdateAutoReduceDetail(good_id int64, count int64) (models.DialysisBeforePrepare, error) {
1997
+func UpdateAutoReduceDetail(good_id int64, count int64, record_time int64) (models.DialysisBeforePrepare, error) {
2001
 	detail := models.DialysisBeforePrepare{}
1998
 	detail := models.DialysisBeforePrepare{}
2002
-	err := XTWriteDB().Model(&detail).Where("good_id = ? and status = 1", good_id).Updates(map[string]interface{}{"count": count}).Error
1999
+	err := XTWriteDB().Model(&detail).Where("good_id = ? and status = 1 and record_time = ?", good_id, record_time).Updates(map[string]interface{}{"count": count}).Error
2003
 	return detail, err
2000
 	return detail, err
2004
 }
2001
 }
2005
 
2002
 
2006
-func DeleteAutoReduceDetail(good_id int64) error {
2003
+func DeleteAutoReduceDetail(good_id int64, record_time int64) error {
2007
 	detail := models.DialysisBeforePrepare{}
2004
 	detail := models.DialysisBeforePrepare{}
2008
-	err := XTWriteDB().Model(&detail).Where("good_id = ? and status = 1", good_id).Updates(map[string]interface{}{"status": 0}).Error
2005
+	err := XTWriteDB().Model(&detail).Where("good_id = ? and status = 1 and record_time = ?", good_id, record_time).Updates(map[string]interface{}{"status": 0}).Error
2009
 	return err
2006
 	return err
2010
 }
2007
 }