XMLWAN 3 anni fa
parent
commit
1fa91e5e6d

+ 8 - 3
controllers/xcx_mobile_api_controller.go/xcx_api_controller.go Vedi File

@@ -373,8 +373,13 @@ func (this *XcxApiController) GetScheduleInfo() {
373 373
 func (this *XcxApiController) GetMobileSchedule() {
374 374
 
375 375
 	patientID, _ := this.GetInt64("patient_id")
376
+	fmt.Println("1", patientID)
376 377
 	info, _ := service.GetXcxPatientInfo(patientID)
377
-
378
+	timeLayout := "2006-01-02"
379
+	loc, _ := time.LoadLocation("Local")
380
+	time_now := time.Now().Format("2006-01-02")
381
+	timeNowUnix, _ := time.ParseInLocation(timeLayout+"15:04:05", time_now+"00:00:00", loc)
382
+	fmt.Println("timeNowUnix", timeNowUnix.Unix())
378 383
 	patient, getPatientErr := service.MobileGetPatientDetail(info.UserOrgId, patientID)
379 384
 	if getPatientErr != nil {
380 385
 		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
@@ -414,7 +419,7 @@ func (this *XcxApiController) GetMobileSchedule() {
414 419
 		return
415 420
 	}
416 421
 
417
-	doctorAdvices, getDoctorAdvicesErr := service.MobileGetDoctorAdvicesByGroupsOne(info.UserOrgId, patientID)
422
+	doctorAdvices, getDoctorAdvicesErr := service.MobileGetDoctorAdvicesByGroupsOne(info.UserOrgId, patientID, timeNowUnix.Unix())
418 423
 	if getDoctorAdvicesErr != nil {
419 424
 		this.ErrorLog("获取临时医嘱失败:%v", getDoctorAdvicesErr)
420 425
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -496,7 +501,7 @@ func (this *XcxApiController) GetMobileSchedule() {
496 501
 	prescribeOne, _ := service.MobileGetDialysisPrescribeByModeIdFive(info.UserOrgId, patientID)
497 502
 	var his_advices []*models.HisDoctorAdviceInfo
498 503
 	if is_open_config.IsOpen == 1 {
499
-		his_advices, _ = service.GetAllHisDoctorAdviceOne(info.UserOrgId, patientID)
504
+		his_advices, _ = service.GetAllHisDoctorAdviceOne(info.UserOrgId, patientID, timeNowUnix.Unix())
500 505
 	}
501 506
 
502 507
 	if getLPEErr != nil {

+ 4 - 4
service/xcx_mobile_api_service.go Vedi File

@@ -369,11 +369,11 @@ func MobileGetLastTimePredialysisEvaluationOne(orgID int64, patientID int64) (*m
369 369
 	return &record, nil
370 370
 }
371 371
 
372
-func MobileGetDoctorAdvicesByGroupsOne(orgID int64, patientID int64) ([]*models.DoctorAdvice, error) {
372
+func MobileGetDoctorAdvicesByGroupsOne(orgID int64, patientID int64, advicedate int64) ([]*models.DoctorAdvice, error) {
373 373
 	var records []*models.DoctorAdvice
374 374
 	err := readDb.
375 375
 		Model(&models.DoctorAdvice{}).
376
-		Where("patient_id = ? and user_org_id = ? and status = 1  and (advice_type = 2 || advice_type = 3)", patientID, orgID).
376
+		Where("patient_id = ? and user_org_id = ? and status = 1  and (advice_type = 2 || advice_type = 3) and advice_date = ?", patientID, orgID, advicedate).
377 377
 		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, groupno,way,drug_id,drug_name_id, IF(parent_id > 0, parent_id, id) as advice_order").
378 378
 		Order("start_time asc, groupno desc, advice_order desc, id asc").
379 379
 		Scan(&records).Error
@@ -509,8 +509,8 @@ func MobileGetDialysisPrescribeByModeIdFive(orgID int64, patientID int64) (*mode
509 509
 	return &record, nil
510 510
 }
511 511
 
512
-func GetAllHisDoctorAdviceOne(orgid int64, patientid int64) (his []*models.HisDoctorAdviceInfo, err error) {
513
-	err = readDb.Model(&models.DialysisBeforePrepare{}).Where("patient_id = ? AND user_org_id = ? AND status=1", patientid, orgid).Last(&his).Error
512
+func GetAllHisDoctorAdviceOne(orgid int64, patientid int64, advice_date int64) (his []*models.HisDoctorAdviceInfo, err error) {
513
+	err = readDb.Model(&models.DialysisBeforePrepare{}).Where("patient_id = ? AND user_org_id = ? AND status=1 and advice_date = ?", patientid, orgid, advice_date).Find(&his).Error
514 514
 	return
515 515
 
516 516
 }