Browse Source

耗材参数

XMLWAN 4 years ago
parent
commit
17b6ae5440

+ 4 - 2
controllers/mobile_api_controllers/dialysis_api_controller.go View File

@@ -4697,7 +4697,8 @@ func (c *DialysisAPIController) UpdateAutoReduceDetail() {
4697 4697
 
4698 4698
 	good_id, _ := c.GetInt64("good_id")
4699 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 4702
 	c.ServeSuccessJSON(map[string]interface{}{
4702 4703
 		"detail": detail,
4703 4704
 	})
@@ -4707,7 +4708,8 @@ func (c *DialysisAPIController) UpdateAutoReduceDetail() {
4707 4708
 func (c *DialysisAPIController) DeleteAutoReduceDetail() {
4708 4709
 
4709 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 4713
 	fmt.Print("err", err)
4712 4714
 	c.ServeSuccessJSON(map[string]interface{}{
4713 4715
 		"msg": "批量删除成功",

+ 4 - 7
service/mobile_dialysis_service.go View File

@@ -1965,9 +1965,6 @@ func BatchDeleteMonitor(ids []string) (err error) {
1965 1965
 
1966 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 1968
 	db := XTReadDB().Table("xt_dialysis_order as x").Where("x.status = 1")
1972 1969
 	table := XTReadDB().Table("xt_schedule as s")
1973 1970
 	fmt.Println(table)
@@ -1997,14 +1994,14 @@ func BatchDeleteAdvice(ids []int64) (err error) {
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 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 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 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 2006
 	return err
2010 2007
 }