Browse Source

耗材参数

XMLWAN 3 years ago
parent
commit
6ca8e3e254

+ 17 - 0
controllers/mobile_api_controllers/dialysis_api_controller.go View File

@@ -4664,3 +4664,20 @@ func (c *DialysisAPIController) GetPatientDialysisRecord() {
4664 4664
 		"list": list,
4665 4665
 	})
4666 4666
 }
4667
+
4668
+func (c *DialysisAPIController) BathDeleteAdvice() {
4669
+
4670
+	dataBody := make(map[string]interface{}, 0)
4671
+	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
4672
+	idsInt := dataBody["ids"].([]interface{})
4673
+	ids := make([]int64, 0)
4674
+	for _, item := range idsInt {
4675
+		id, _ := strconv.ParseInt(item.(string), 10, 64)
4676
+		ids = append(ids, id)
4677
+	}
4678
+	err = service.BatchDeleteAdvice(ids)
4679
+	fmt.Print("err", err)
4680
+	c.ServeSuccessJSON(map[string]interface{}{
4681
+		"msg": "批量删除成功",
4682
+	})
4683
+}

+ 12 - 0
service/mobile_dialysis_service.go View File

@@ -1955,3 +1955,15 @@ func GetPatientDialysisRecordList(patientid int64, startime int64, endtime int64
1955 1955
 	err = XTReadDB().Model(&order).Where("patient_id = ? and dialysis_date>=? and dialysis_date<=? and user_org_id = ? and status = 1", patientid, startime, endtime, orgid).Find(&order).Error
1956 1956
 	return order, err
1957 1957
 }
1958
+
1959
+func BatchDeleteAdvice(ids []int64) (err error) {
1960
+
1961
+	if len(ids) == 1 {
1962
+		err = XTWriteDB().Model(&models.DoctorAdvice{}).Where("id=?", ids[0]).Updates(map[string]interface{}{"status": 0, "updated_time": time.Now().Unix()}).Error
1963
+	} else {
1964
+		err = XTWriteDB().Model(models.DoctorAdvice{}).Where("id IN(?)", ids).Updates(map[string]interface{}{"status": 0, "updated_time": time.Now().Unix()}).Error
1965
+	}
1966
+
1967
+	return
1968
+
1969
+}