Browse Source

bug修改

XMLWAN 4 years ago
parent
commit
ef2d224420

+ 0 - 1
controllers/data_api_controller.go View File

@@ -527,7 +527,6 @@ func configChildFormData(dataconfig *models.Dataconfig, data []byte) (code int)
527 527
 
528 528
 func (c *DataApiController) GetAdviceConfigs() {
529 529
 	advice_type, _ := c.GetInt64("type", 0)
530
-
531 530
 	adminUserInfo := c.GetAdminUserInfo()
532 531
 	var drugs []models.DrugDic
533 532
 	drugways, _, _ := service.GetDrugWayDics(adminUserInfo.CurrentOrgId)

+ 27 - 1
controllers/patient_api_controller.go View File

@@ -63,7 +63,7 @@ func PatientApiRegistRouters() {
63 63
 
64 64
 	beego.Router("/api/remind/is_open", &PatientApiController{}, "Post:PostIsOpenRemind")
65 65
 	beego.Router("/api/patients/advices/getpatientschedules", &PatientApiController{}, "Get:GetPatientScheduleOne")
66
-
66
+  beego.Router("/api/patients/advices/saveditadvices",&PatientApiController{},"Get:SaveEditAdvices")
67 67
 }
68 68
 
69 69
 //GetPatientsList 取患者列表
@@ -3374,3 +3374,29 @@ func (c *PatientApiController) GetPatientScheduleOne() {
3374 3374
 		"scheduls": scheduls,
3375 3375
 	})
3376 3376
 }
3377
+
3378
+func (c *PatientApiController) SaveEditAdvices()  {
3379
+  adminInfo := c.GetAdminUserInfo()
3380
+  orgid := adminInfo.CurrentOrgId
3381
+  startTime := c.GetString("start_time")
3382
+  fmt.Println("开始时间",startTime)
3383
+  theTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", startTime)
3384
+  fmt.Println(theTime.Unix())
3385
+  groupno, _ := c.GetInt64("groupno")
3386
+  fmt.Println("组",groupno)
3387
+  date, _ := c.GetInt64("date")
3388
+  fmt.Println("date",date)
3389
+  patient_id, _ := c.GetInt64("patient_id")
3390
+  fmt.Println("paitent_id",patient_id)
3391
+  advice := models.XtDoctorAdvice{
3392
+    StartTime: theTime.Unix(),
3393
+  }
3394
+  err := service.UpdateDoctorEditAdvice(advice, orgid, groupno, date, patient_id)
3395
+  if err != nil {
3396
+    c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3397
+    return
3398
+  }
3399
+  c.ServeSuccessJSON(map[string]interface{}{
3400
+    "advice": advice,
3401
+  })
3402
+}

+ 1 - 1
service/mobile_dialysis_service.go View File

@@ -446,7 +446,7 @@ func MobileGetDoctorAdvices(orgID int64, patientID int64, recordDate int64) ([]*
446 446
 
447 447
 	err := readDb.
448 448
 		Model(&models.DoctorAdvice{}).
449
-		Where("patient_id = ? and user_org_id = ? and status = 1 and record_date = ? and advice_type = 2", patientID, orgID, recordDate).
449
+		Where("patient_id = ? and user_org_id = ? and status = 1 and record_date = ? and (advice_type = 2 or advice_type = 3)", patientID, orgID, recordDate).
450 450
 		Select("id,user_org_id,patient_id,advice_type,advice_date,record_date,start_time,advice_name,advice_desc,reminder_date, drug_spec, drug_spec_unit,single_dose,single_dose_unit,prescribing_number,prescribing_number_unit,delivery_way,execution_frequency,advice_doctor,status,created_time,updated_time,advice_affirm,remark,stop_time,stop_reason,stop_doctor,stop_state,parent_id,execution_time,execution_staff,execution_state,checker, check_state, check_time,IF(parent_id>0, parent_id, id) as advice_order,groupno").
451 451
 		Order("start_time asc, groupno desc, advice_order desc, id").
452 452
 		Scan(&records).Error

+ 6 - 0
service/patient_service.go View File

@@ -1161,3 +1161,9 @@ func GetPatientScheduleOne(patientid int64, nowdate int64, orgid int64) (models.
1161 1161
 	err := XTReadDB().Model(&schedule).Where("patient_id = ? and schedule_date = ? and user_org_id = ? and status =1", patientid, nowdate, orgid).Find(&schedule).Error
1162 1162
 	return schedule, err
1163 1163
 }
1164
+
1165
+func UpdateDoctorEditAdvice(advice models.XtDoctorAdvice,orgid int64,groupno int64,date int64,patientid int64)error {
1166
+
1167
+  err := XTWriteDB().Model(&advice).Where("user_org_id = ? and groupno = ? and advice_date = ? and patient_id = ?", orgid, groupno, date, patientid).Update(map[string]interface{}{"start_time": advice.StartTime, "updated_time": advice.UpdatedTime}).Error
1168
+  return err
1169
+}