Browse Source

体积小

XMLWAN 3 years ago
parent
commit
9a48898d72

+ 9 - 9
controllers/xcx_mobile_api_controller.go/xcx_api_controller.go View File

398
 		return
398
 		return
399
 	}
399
 	}
400
 
400
 
401
-	receiverTreatmentAccess, getRTARErr := service.MobileGetReceiverTreatmentAccessRecordOne(info.UserOrgId, patientID)
401
+	receiverTreatmentAccess, getRTARErr := service.MobileGetReceiverTreatmentAccessRecordOne(info.UserOrgId, patientID, timeNowUnix.Unix())
402
 	if getRTARErr != nil {
402
 	if getRTARErr != nil {
403
 		this.ErrorLog("获取接诊评估失败:%v", getRTARErr)
403
 		this.ErrorLog("获取接诊评估失败:%v", getRTARErr)
404
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
404
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
405
 		return
405
 		return
406
 	}
406
 	}
407
 
407
 
408
-	predialysisEvaluation, getPEErr := service.MobileGetPredialysisEvaluationOne(info.UserOrgId, patientID)
408
+	predialysisEvaluation, getPEErr := service.MobileGetPredialysisEvaluationOne(info.UserOrgId, patientID, timeNowUnix.Unix())
409
 	if getPEErr != nil {
409
 	if getPEErr != nil {
410
 		this.ErrorLog("获取透前评估失败:%v", getPEErr)
410
 		this.ErrorLog("获取透前评估失败:%v", getPEErr)
411
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
411
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
426
 		return
426
 		return
427
 	}
427
 	}
428
 
428
 
429
-	dialysisOrder, getDialysisOrderErr := service.MobileGetSchedualDialysisRecordOne(info.UserOrgId, patientID)
429
+	dialysisOrder, getDialysisOrderErr := service.MobileGetSchedualDialysisRecordOne(info.UserOrgId, patientID, timeNowUnix.Unix())
430
 	if getDialysisOrderErr != nil {
430
 	if getDialysisOrderErr != nil {
431
 		this.ErrorLog("获取透析记录失败:%v", getDialysisOrderErr)
431
 		this.ErrorLog("获取透析记录失败:%v", getDialysisOrderErr)
432
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
432
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
433
 		return
433
 		return
434
 	}
434
 	}
435
 
435
 
436
-	doubleCheck, getDoubleCheckErr := service.MobileGetDoubleCheckOne(info.UserOrgId, patientID)
436
+	doubleCheck, getDoubleCheckErr := service.MobileGetDoubleCheckOne(info.UserOrgId, patientID, timeNowUnix.Unix())
437
 	if getDoubleCheckErr != nil {
437
 	if getDoubleCheckErr != nil {
438
 		this.ErrorLog("获取双人核对记录失败:%v", getDoubleCheckErr)
438
 		this.ErrorLog("获取双人核对记录失败:%v", getDoubleCheckErr)
439
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
439
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
440
 		return
440
 		return
441
 	}
441
 	}
442
 
442
 
443
-	monitorRecords, getMonitorRecordsErr := service.MobileGetMonitorRecordsOne(info.UserOrgId, patientID)
443
+	monitorRecords, getMonitorRecordsErr := service.MobileGetMonitorRecordsOne(info.UserOrgId, patientID, timeNowUnix.Unix())
444
 	if getMonitorRecordsErr != nil {
444
 	if getMonitorRecordsErr != nil {
445
 		this.ErrorLog("获取透析监测记录失败:%v", getMonitorRecordsErr)
445
 		this.ErrorLog("获取透析监测记录失败:%v", getMonitorRecordsErr)
446
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
446
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
455
 		return
455
 		return
456
 	}
456
 	}
457
 
457
 
458
-	assessmentAfterDislysis, getAADErr := service.MobileGetAssessmentAfterDislysisOne(info.UserOrgId, patientID)
458
+	assessmentAfterDislysis, getAADErr := service.MobileGetAssessmentAfterDislysisOne(info.UserOrgId, patientID, timeNowUnix.Unix())
459
 	if getAADErr != nil {
459
 	if getAADErr != nil {
460
 		this.ErrorLog("获取透后评估失败:%v", getAADErr)
460
 		this.ErrorLog("获取透后评估失败:%v", getAADErr)
461
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
461
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
462
 		return
462
 		return
463
 	}
463
 	}
464
 
464
 
465
-	lastAssessmentAfterDislysis, getLAADErr := service.MobileGetAssessmentAfterDislysisOne(info.UserOrgId, patientID)
465
+	lastAssessmentAfterDislysis, getLAADErr := service.MobileGetAssessmentAfterDislysisOne(info.UserOrgId, patientID, timeNowUnix.Unix())
466
 	if getLAADErr != nil {
466
 	if getLAADErr != nil {
467
 		this.ErrorLog("获取上一次透后评估失败:%v", getLAADErr)
467
 		this.ErrorLog("获取上一次透后评估失败:%v", getLAADErr)
468
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
468
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
469
 		return
469
 		return
470
 	}
470
 	}
471
 
471
 
472
-	treatmentSummary, getTreatmentSummaryErr := service.MobileGetTreatmentSummaryOne(info.UserOrgId, patientID)
472
+	treatmentSummary, getTreatmentSummaryErr := service.MobileGetTreatmentSummaryOne(info.UserOrgId, patientID, timeNowUnix.Unix())
473
 	if getTreatmentSummaryErr != nil {
473
 	if getTreatmentSummaryErr != nil {
474
 		this.ErrorLog("获取治疗小结失败:%v", getTreatmentSummaryErr)
474
 		this.ErrorLog("获取治疗小结失败:%v", getTreatmentSummaryErr)
475
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
475
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
476
 		return
476
 		return
477
 	}
477
 	}
478
 
478
 
479
-	dialysisPrescribe, _ := service.MobileGetDialysisPrescribeByModeIdSix(info.UserOrgId, patientID, schedual.ModeId)
479
+	dialysisPrescribe, _ := service.MobileGetDialysisPrescribeByModeIdSix(info.UserOrgId, patientID, schedual.ModeId, timeNowUnix.Unix())
480
 
480
 
481
 	dialysisSolution, _ := service.MobileGetDialysisSolutionByModeId(info.UserOrgId, patientID, schedual.ModeId)
481
 	dialysisSolution, _ := service.MobileGetDialysisSolutionByModeId(info.UserOrgId, patientID, schedual.ModeId)
482
 
482
 

+ 16 - 16
service/xcx_mobile_api_service.go View File

328
 }
328
 }
329
 
329
 
330
 // 接诊评估
330
 // 接诊评估
331
-func MobileGetReceiverTreatmentAccessRecordOne(orgID int64, patientID int64) (*models.ReceiveTreatmentAsses, error) {
331
+func MobileGetReceiverTreatmentAccessRecordOne(orgID int64, patientID int64, record_date int64) (*models.ReceiveTreatmentAsses, error) {
332
 	var record models.ReceiveTreatmentAsses
332
 	var record models.ReceiveTreatmentAsses
333
-	err = readDb.Model(&models.ReceiveTreatmentAsses{}).Where("patient_id = ? and user_org_id = ? and status = 1", patientID, orgID).Last(&record).Error
333
+	err = readDb.Model(&models.ReceiveTreatmentAsses{}).Where("patient_id = ? and user_org_id = ? and status = 1 and record_date = ?", patientID, orgID, record_date).Find(&record).Error
334
 	if err != nil {
334
 	if err != nil {
335
 		if err == gorm.ErrRecordNotFound {
335
 		if err == gorm.ErrRecordNotFound {
336
 			return nil, nil
336
 			return nil, nil
342
 }
342
 }
343
 
343
 
344
 // 透前评估
344
 // 透前评估
345
-func MobileGetPredialysisEvaluationOne(orgID int64, patientID int64) (*models.PredialysisEvaluation, error) {
345
+func MobileGetPredialysisEvaluationOne(orgID int64, patientID int64, assessment_date int64) (*models.PredialysisEvaluation, error) {
346
 	var record models.PredialysisEvaluation
346
 	var record models.PredialysisEvaluation
347
-	err := readDb.Model(&models.PredialysisEvaluation{}).Where("patient_id = ? and user_org_id = ? and status = 1", patientID, orgID).Last(&record).Error
347
+	err := readDb.Model(&models.PredialysisEvaluation{}).Where("patient_id = ? and user_org_id = ? and status = 1 and assessment_date = ?", patientID, orgID, assessment_date).Find(&record).Error
348
 	if err != nil {
348
 	if err != nil {
349
 		if err == gorm.ErrRecordNotFound {
349
 		if err == gorm.ErrRecordNotFound {
350
 			return nil, nil
350
 			return nil, nil
385
 }
385
 }
386
 
386
 
387
 // 透析记录
387
 // 透析记录
388
-func MobileGetSchedualDialysisRecordOne(orgID int64, patientID int64) (*models.DialysisOrder, error) {
388
+func MobileGetSchedualDialysisRecordOne(orgID int64, patientID int64, dialysis_date int64) (*models.DialysisOrder, error) {
389
 	var record models.DialysisOrder
389
 	var record models.DialysisOrder
390
-	err := readDb.Model(&models.DialysisOrder{}).Preload("DeviceNumber", "org_id = ? AND  status = 1", orgID).Where("user_org_id = ? AND patient_id = ?", orgID, patientID).Last(&record).Error
390
+	err := readDb.Model(&models.DialysisOrder{}).Preload("DeviceNumber", "org_id = ? AND  status = 1 and dialysis_date = ?", orgID, dialysis_date).Where("user_org_id = ? AND patient_id = ?", orgID, patientID).Find(&record).Error
391
 	if err != nil {
391
 	if err != nil {
392
 		if err == gorm.ErrRecordNotFound {
392
 		if err == gorm.ErrRecordNotFound {
393
 			return nil, nil
393
 			return nil, nil
399
 }
399
 }
400
 
400
 
401
 // 双人核对
401
 // 双人核对
402
-func MobileGetDoubleCheckOne(orgID int64, patientID int64) (*models.DoubleCheck, error) {
402
+func MobileGetDoubleCheckOne(orgID int64, patientID int64, check_date int64) (*models.DoubleCheck, error) {
403
 	var record models.DoubleCheck
403
 	var record models.DoubleCheck
404
-	err := readDb.Model(&models.DoubleCheck{}).Where("patient_id = ? and user_org_id = ? and status = 1", patientID, orgID).Last(&record).Error
404
+	err := readDb.Model(&models.DoubleCheck{}).Where("patient_id = ? and user_org_id = ? and status = 1 and check_date = ?", patientID, orgID, check_date).Find(&record).Error
405
 	if err != nil {
405
 	if err != nil {
406
 		if err == gorm.ErrRecordNotFound {
406
 		if err == gorm.ErrRecordNotFound {
407
 			return nil, nil
407
 			return nil, nil
413
 }
413
 }
414
 
414
 
415
 // 透析监测记录
415
 // 透析监测记录
416
-func MobileGetMonitorRecordsOne(orgID int64, patientID int64) ([]*models.MonitoringRecord, error) {
416
+func MobileGetMonitorRecordsOne(orgID int64, patientID int64, monitoring_date int64) ([]*models.MonitoringRecord, error) {
417
 	var records []*models.MonitoringRecord
417
 	var records []*models.MonitoringRecord
418
-	err := readDb.Model(&models.MonitoringRecord{}).Where("patient_id = ? and user_org_id = ? and status = 1", patientID, orgID).Order("operate_time asc").Last(&records).Error
418
+	err := readDb.Model(&models.MonitoringRecord{}).Where("patient_id = ? and user_org_id = ? and status = 1 and monitoring_date = ?", patientID, orgID, monitoring_date).Order("operate_time asc").Find(&records).Error
419
 	if err != nil {
419
 	if err != nil {
420
 		return nil, err
420
 		return nil, err
421
 	}
421
 	}
436
 }
436
 }
437
 
437
 
438
 // 透后评估
438
 // 透后评估
439
-func MobileGetAssessmentAfterDislysisOne(orgID int64, patientID int64) (*models.AssessmentAfterDislysis, error) {
439
+func MobileGetAssessmentAfterDislysisOne(orgID int64, patientID int64, assessment_date int64) (*models.AssessmentAfterDislysis, error) {
440
 	var record models.AssessmentAfterDislysis
440
 	var record models.AssessmentAfterDislysis
441
-	err := readDb.Model(&models.AssessmentAfterDislysis{}).Where("patient_id = ? and user_org_id = ? and status = 1", patientID, orgID).Last(&record).Error
441
+	err := readDb.Model(&models.AssessmentAfterDislysis{}).Where("patient_id = ? and user_org_id = ? and status = 1 and assessment_date =? ", patientID, orgID, assessment_date).Find(&record).Error
442
 	if err != nil {
442
 	if err != nil {
443
 		if err == gorm.ErrRecordNotFound {
443
 		if err == gorm.ErrRecordNotFound {
444
 			return nil, nil
444
 			return nil, nil
450
 }
450
 }
451
 
451
 
452
 // 治疗小结
452
 // 治疗小结
453
-func MobileGetTreatmentSummaryOne(orgID int64, patientID int64) (*models.TreatmentSummary, error) {
453
+func MobileGetTreatmentSummaryOne(orgID int64, patientID int64, assessment_date int64) (*models.TreatmentSummary, error) {
454
 	var record models.TreatmentSummary
454
 	var record models.TreatmentSummary
455
-	err := readDb.Model(&models.TreatmentSummary{}).Where("patient_id = ? and user_org_id = ? and status = 1", patientID, orgID).Last(&record).Error
455
+	err := readDb.Model(&models.TreatmentSummary{}).Where("patient_id = ? and user_org_id = ? and status = 1 and assessment_date= ?", patientID, orgID, assessment_date).Find(&record).Error
456
 	if err != nil {
456
 	if err != nil {
457
 		if err == gorm.ErrRecordNotFound {
457
 		if err == gorm.ErrRecordNotFound {
458
 			return nil, nil
458
 			return nil, nil
464
 }
464
 }
465
 
465
 
466
 // 透析处方
466
 // 透析处方
467
-func MobileGetDialysisPrescribeByModeIdSix(orgID int64, patientID int64, mode_id int64) (*models.DialysisPrescription, error) {
467
+func MobileGetDialysisPrescribeByModeIdSix(orgID int64, patientID int64, mode_id int64, record_date int64) (*models.DialysisPrescription, error) {
468
 	var record models.DialysisPrescription
468
 	var record models.DialysisPrescription
469
-	err := readDb.Model(&models.DialysisPrescription{}).Where("patient_id = ? and user_org_id = ? and status = 1 AND mode_id = ?", patientID, orgID, mode_id).Last(&record).Error
469
+	err := readDb.Model(&models.DialysisPrescription{}).Where("patient_id = ? and user_org_id = ? and status = 1 AND mode_id = ? and record_date = ?", patientID, orgID, mode_id, record_date).Find(&record).Error
470
 	if err != nil {
470
 	if err != nil {
471
 		if err == gorm.ErrRecordNotFound {
471
 		if err == gorm.ErrRecordNotFound {
472
 			return nil, nil
472
 			return nil, nil