Browse Source

体积小

XMLWAN 3 years ago
parent
commit
1fa91e5e6d

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

373
 func (this *XcxApiController) GetMobileSchedule() {
373
 func (this *XcxApiController) GetMobileSchedule() {
374
 
374
 
375
 	patientID, _ := this.GetInt64("patient_id")
375
 	patientID, _ := this.GetInt64("patient_id")
376
+	fmt.Println("1", patientID)
376
 	info, _ := service.GetXcxPatientInfo(patientID)
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
 	patient, getPatientErr := service.MobileGetPatientDetail(info.UserOrgId, patientID)
383
 	patient, getPatientErr := service.MobileGetPatientDetail(info.UserOrgId, patientID)
379
 	if getPatientErr != nil {
384
 	if getPatientErr != nil {
380
 		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
385
 		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
414
 		return
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
 	if getDoctorAdvicesErr != nil {
423
 	if getDoctorAdvicesErr != nil {
419
 		this.ErrorLog("获取临时医嘱失败:%v", getDoctorAdvicesErr)
424
 		this.ErrorLog("获取临时医嘱失败:%v", getDoctorAdvicesErr)
420
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
425
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
496
 	prescribeOne, _ := service.MobileGetDialysisPrescribeByModeIdFive(info.UserOrgId, patientID)
501
 	prescribeOne, _ := service.MobileGetDialysisPrescribeByModeIdFive(info.UserOrgId, patientID)
497
 	var his_advices []*models.HisDoctorAdviceInfo
502
 	var his_advices []*models.HisDoctorAdviceInfo
498
 	if is_open_config.IsOpen == 1 {
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
 	if getLPEErr != nil {
507
 	if getLPEErr != nil {

+ 4 - 4
service/xcx_mobile_api_service.go View File

369
 	return &record, nil
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
 	var records []*models.DoctorAdvice
373
 	var records []*models.DoctorAdvice
374
 	err := readDb.
374
 	err := readDb.
375
 		Model(&models.DoctorAdvice{}).
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
 		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").
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
 		Order("start_time asc, groupno desc, advice_order desc, id asc").
378
 		Order("start_time asc, groupno desc, advice_order desc, id asc").
379
 		Scan(&records).Error
379
 		Scan(&records).Error
509
 	return &record, nil
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
 	return
514
 	return
515
 
515
 
516
 }
516
 }