XMLWAN 3 年 前
コミット
9a48898d72
共有2 個のファイルを変更した25 個の追加25 個の削除を含む
  1. 9 9
      controllers/xcx_mobile_api_controller.go/xcx_api_controller.go
  2. 16 16
      service/xcx_mobile_api_service.go

+ 9 - 9
controllers/xcx_mobile_api_controller.go/xcx_api_controller.go ファイルの表示

@@ -398,14 +398,14 @@ func (this *XcxApiController) GetMobileSchedule() {
398 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 402
 	if getRTARErr != nil {
403 403
 		this.ErrorLog("获取接诊评估失败:%v", getRTARErr)
404 404
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
405 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 409
 	if getPEErr != nil {
410 410
 		this.ErrorLog("获取透前评估失败:%v", getPEErr)
411 411
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -426,21 +426,21 @@ func (this *XcxApiController) GetMobileSchedule() {
426 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 430
 	if getDialysisOrderErr != nil {
431 431
 		this.ErrorLog("获取透析记录失败:%v", getDialysisOrderErr)
432 432
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
433 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 437
 	if getDoubleCheckErr != nil {
438 438
 		this.ErrorLog("获取双人核对记录失败:%v", getDoubleCheckErr)
439 439
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
440 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 444
 	if getMonitorRecordsErr != nil {
445 445
 		this.ErrorLog("获取透析监测记录失败:%v", getMonitorRecordsErr)
446 446
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -455,28 +455,28 @@ func (this *XcxApiController) GetMobileSchedule() {
455 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 459
 	if getAADErr != nil {
460 460
 		this.ErrorLog("获取透后评估失败:%v", getAADErr)
461 461
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
462 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 466
 	if getLAADErr != nil {
467 467
 		this.ErrorLog("获取上一次透后评估失败:%v", getLAADErr)
468 468
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
469 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 473
 	if getTreatmentSummaryErr != nil {
474 474
 		this.ErrorLog("获取治疗小结失败:%v", getTreatmentSummaryErr)
475 475
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
476 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 481
 	dialysisSolution, _ := service.MobileGetDialysisSolutionByModeId(info.UserOrgId, patientID, schedual.ModeId)
482 482
 

+ 16 - 16
service/xcx_mobile_api_service.go ファイルの表示

@@ -328,9 +328,9 @@ func MobileGetSchedualDetailOne(orgID int64, patientID int64) (*MDialysisSchedul
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 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 334
 	if err != nil {
335 335
 		if err == gorm.ErrRecordNotFound {
336 336
 			return nil, nil
@@ -342,9 +342,9 @@ func MobileGetReceiverTreatmentAccessRecordOne(orgID int64, patientID int64) (*m
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 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 348
 	if err != nil {
349 349
 		if err == gorm.ErrRecordNotFound {
350 350
 			return nil, nil
@@ -385,9 +385,9 @@ func MobileGetDoctorAdvicesByGroupsOne(orgID int64, patientID int64, advicedate
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 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 391
 	if err != nil {
392 392
 		if err == gorm.ErrRecordNotFound {
393 393
 			return nil, nil
@@ -399,9 +399,9 @@ func MobileGetSchedualDialysisRecordOne(orgID int64, patientID int64) (*models.D
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 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 405
 	if err != nil {
406 406
 		if err == gorm.ErrRecordNotFound {
407 407
 			return nil, nil
@@ -413,9 +413,9 @@ func MobileGetDoubleCheckOne(orgID int64, patientID int64) (*models.DoubleCheck,
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 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 419
 	if err != nil {
420 420
 		return nil, err
421 421
 	}
@@ -436,9 +436,9 @@ func MobileGetLastMonitorRecordOne(orgID int64, patientID int64) (*models.Monito
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 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 442
 	if err != nil {
443 443
 		if err == gorm.ErrRecordNotFound {
444 444
 			return nil, nil
@@ -450,9 +450,9 @@ func MobileGetAssessmentAfterDislysisOne(orgID int64, patientID int64) (*models.
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 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 456
 	if err != nil {
457 457
 		if err == gorm.ErrRecordNotFound {
458 458
 			return nil, nil
@@ -464,9 +464,9 @@ func MobileGetTreatmentSummaryOne(orgID int64, patientID int64) (*models.Treatme
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 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 470
 	if err != nil {
471 471
 		if err == gorm.ErrRecordNotFound {
472 472
 			return nil, nil