|
|
|
|
364
|
func (this *XcxApiController) GetMobileSchedule() {
|
364
|
func (this *XcxApiController) GetMobileSchedule() {
|
365
|
|
365
|
|
366
|
patientID, _ := this.GetInt64("patient_id")
|
366
|
patientID, _ := this.GetInt64("patient_id")
|
367
|
- //recordDateStr := this.GetString("date")
|
|
|
368
|
- //if patientID <= 0 {
|
|
|
369
|
- // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
|
370
|
- // return
|
|
|
371
|
- //}
|
|
|
372
|
- //if len(recordDateStr) == 0 {
|
|
|
373
|
- // recordDateStr = time.Now().Format("2006-01-02")
|
|
|
374
|
- //}
|
|
|
375
|
- //date, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
|
|
|
376
|
- //if parseDateErr != nil {
|
|
|
377
|
- // this.ErrorLog("日期(%v)解析错误:%v", recordDateStr, parseDateErr)
|
|
|
378
|
- // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
|
379
|
- // return
|
|
|
380
|
- //}
|
|
|
381
|
-
|
|
|
382
|
- adminInfo := this.GetMobileAdminUserInfo()
|
|
|
383
|
- patient, getPatientErr := service.MobileGetPatientDetail(adminInfo.Org.Id, patientID)
|
|
|
|
|
367
|
+ info, _ := service.GetXcxPatientInfo(patientID)
|
|
|
368
|
+
|
|
|
369
|
+ patient, getPatientErr := service.MobileGetPatientDetail(info.UserOrgId, patientID)
|
384
|
if getPatientErr != nil {
|
370
|
if getPatientErr != nil {
|
385
|
this.ErrorLog("获取患者信息失败:%v", getPatientErr)
|
371
|
this.ErrorLog("获取患者信息失败:%v", getPatientErr)
|
386
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
372
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
|
|
|
390
|
return
|
376
|
return
|
391
|
}
|
377
|
}
|
392
|
|
378
|
|
393
|
- schedual, getSchedualErr := service.MobileGetSchedualDetailOne(adminInfo.Org.Id, patientID)
|
|
|
|
|
379
|
+ schedual, getSchedualErr := service.MobileGetSchedualDetailOne(info.UserOrgId, patientID)
|
394
|
|
380
|
|
395
|
if getSchedualErr != nil {
|
381
|
if getSchedualErr != nil {
|
396
|
this.ErrorLog("获取患者排班信息失败:%v", getSchedualErr)
|
382
|
this.ErrorLog("获取患者排班信息失败:%v", getSchedualErr)
|
|
|
|
|
398
|
return
|
384
|
return
|
399
|
}
|
385
|
}
|
400
|
|
386
|
|
401
|
- receiverTreatmentAccess, getRTARErr := service.MobileGetReceiverTreatmentAccessRecordOne(adminInfo.Org.Id, patientID)
|
|
|
|
|
387
|
+ receiverTreatmentAccess, getRTARErr := service.MobileGetReceiverTreatmentAccessRecordOne(info.UserOrgId, patientID)
|
402
|
if getRTARErr != nil {
|
388
|
if getRTARErr != nil {
|
403
|
this.ErrorLog("获取接诊评估失败:%v", getRTARErr)
|
389
|
this.ErrorLog("获取接诊评估失败:%v", getRTARErr)
|
404
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
390
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
405
|
return
|
391
|
return
|
406
|
}
|
392
|
}
|
407
|
|
393
|
|
408
|
- predialysisEvaluation, getPEErr := service.MobileGetPredialysisEvaluationOne(adminInfo.Org.Id, patientID)
|
|
|
|
|
394
|
+ predialysisEvaluation, getPEErr := service.MobileGetPredialysisEvaluationOne(info.UserOrgId, patientID)
|
409
|
if getPEErr != nil {
|
395
|
if getPEErr != nil {
|
410
|
this.ErrorLog("获取透前评估失败:%v", getPEErr)
|
396
|
this.ErrorLog("获取透前评估失败:%v", getPEErr)
|
411
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
397
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
412
|
return
|
398
|
return
|
413
|
}
|
399
|
}
|
414
|
|
400
|
|
415
|
- lastPredialysisEvaluation, getLPEErr := service.MobileGetLastTimePredialysisEvaluationOne(adminInfo.Org.Id, patientID)
|
|
|
|
|
401
|
+ lastPredialysisEvaluation, getLPEErr := service.MobileGetLastTimePredialysisEvaluationOne(info.UserOrgId, patientID)
|
416
|
if getLPEErr != nil {
|
402
|
if getLPEErr != nil {
|
417
|
this.ErrorLog("获取上一次透前评估失败:%v", getLPEErr)
|
403
|
this.ErrorLog("获取上一次透前评估失败:%v", getLPEErr)
|
418
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
404
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
419
|
return
|
405
|
return
|
420
|
}
|
406
|
}
|
421
|
|
407
|
|
422
|
- doctorAdvices, getDoctorAdvicesErr := service.MobileGetDoctorAdvicesByGroupsOne(adminInfo.Org.Id, patientID)
|
|
|
|
|
408
|
+ doctorAdvices, getDoctorAdvicesErr := service.MobileGetDoctorAdvicesByGroupsOne(info.UserOrgId, patientID)
|
423
|
if getDoctorAdvicesErr != nil {
|
409
|
if getDoctorAdvicesErr != nil {
|
424
|
this.ErrorLog("获取临时医嘱失败:%v", getDoctorAdvicesErr)
|
410
|
this.ErrorLog("获取临时医嘱失败:%v", getDoctorAdvicesErr)
|
425
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
411
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
426
|
return
|
412
|
return
|
427
|
}
|
413
|
}
|
428
|
|
414
|
|
429
|
- dialysisOrder, getDialysisOrderErr := service.MobileGetSchedualDialysisRecordOne(adminInfo.Org.Id, patientID)
|
|
|
|
|
415
|
+ dialysisOrder, getDialysisOrderErr := service.MobileGetSchedualDialysisRecordOne(info.UserOrgId, patientID)
|
430
|
if getDialysisOrderErr != nil {
|
416
|
if getDialysisOrderErr != nil {
|
431
|
this.ErrorLog("获取透析记录失败:%v", getDialysisOrderErr)
|
417
|
this.ErrorLog("获取透析记录失败:%v", getDialysisOrderErr)
|
432
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
418
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
433
|
return
|
419
|
return
|
434
|
}
|
420
|
}
|
435
|
|
421
|
|
436
|
- doubleCheck, getDoubleCheckErr := service.MobileGetDoubleCheckOne(adminInfo.Org.Id, patientID)
|
|
|
|
|
422
|
+ doubleCheck, getDoubleCheckErr := service.MobileGetDoubleCheckOne(info.UserOrgId, patientID)
|
437
|
if getDoubleCheckErr != nil {
|
423
|
if getDoubleCheckErr != nil {
|
438
|
this.ErrorLog("获取双人核对记录失败:%v", getDoubleCheckErr)
|
424
|
this.ErrorLog("获取双人核对记录失败:%v", getDoubleCheckErr)
|
439
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
425
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
440
|
return
|
426
|
return
|
441
|
}
|
427
|
}
|
442
|
|
428
|
|
443
|
- monitorRecords, getMonitorRecordsErr := service.MobileGetMonitorRecordsOne(adminInfo.Org.Id, patientID)
|
|
|
|
|
429
|
+ monitorRecords, getMonitorRecordsErr := service.MobileGetMonitorRecordsOne(info.UserOrgId, patientID)
|
444
|
if getMonitorRecordsErr != nil {
|
430
|
if getMonitorRecordsErr != nil {
|
445
|
this.ErrorLog("获取透析监测记录失败:%v", getMonitorRecordsErr)
|
431
|
this.ErrorLog("获取透析监测记录失败:%v", getMonitorRecordsErr)
|
446
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
432
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
|
|
|
448
|
}
|
434
|
}
|
449
|
var lastMonitorRecord *models.MonitoringRecord
|
435
|
var lastMonitorRecord *models.MonitoringRecord
|
450
|
|
436
|
|
451
|
- lastMonitorRecord, getLastErr := service.MobileGetLastMonitorRecordOne(adminInfo.Org.Id, patientID)
|
|
|
|
|
437
|
+ lastMonitorRecord, getLastErr := service.MobileGetLastMonitorRecordOne(info.UserOrgId, patientID)
|
452
|
if getLastErr != nil {
|
438
|
if getLastErr != nil {
|
453
|
this.ErrorLog("获取上一次透析的监测记录失败:%v", getLastErr)
|
439
|
this.ErrorLog("获取上一次透析的监测记录失败:%v", getLastErr)
|
454
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
440
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
455
|
return
|
441
|
return
|
456
|
}
|
442
|
}
|
457
|
|
443
|
|
458
|
- assessmentAfterDislysis, getAADErr := service.MobileGetAssessmentAfterDislysisOne(adminInfo.Org.Id, patientID)
|
|
|
|
|
444
|
+ assessmentAfterDislysis, getAADErr := service.MobileGetAssessmentAfterDislysisOne(info.UserOrgId, patientID)
|
459
|
if getAADErr != nil {
|
445
|
if getAADErr != nil {
|
460
|
this.ErrorLog("获取透后评估失败:%v", getAADErr)
|
446
|
this.ErrorLog("获取透后评估失败:%v", getAADErr)
|
461
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
447
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
462
|
return
|
448
|
return
|
463
|
}
|
449
|
}
|
464
|
|
450
|
|
465
|
- lastAssessmentAfterDislysis, getLAADErr := service.MobileGetAssessmentAfterDislysisOne(adminInfo.Org.Id, patientID)
|
|
|
|
|
451
|
+ lastAssessmentAfterDislysis, getLAADErr := service.MobileGetAssessmentAfterDislysisOne(info.UserOrgId, patientID)
|
466
|
if getLAADErr != nil {
|
452
|
if getLAADErr != nil {
|
467
|
this.ErrorLog("获取上一次透后评估失败:%v", getLAADErr)
|
453
|
this.ErrorLog("获取上一次透后评估失败:%v", getLAADErr)
|
468
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
454
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
469
|
return
|
455
|
return
|
470
|
}
|
456
|
}
|
471
|
|
457
|
|
472
|
- treatmentSummary, getTreatmentSummaryErr := service.MobileGetTreatmentSummaryOne(adminInfo.Org.Id, patientID)
|
|
|
|
|
458
|
+ treatmentSummary, getTreatmentSummaryErr := service.MobileGetTreatmentSummaryOne(info.UserOrgId, patientID)
|
473
|
if getTreatmentSummaryErr != nil {
|
459
|
if getTreatmentSummaryErr != nil {
|
474
|
this.ErrorLog("获取治疗小结失败:%v", getTreatmentSummaryErr)
|
460
|
this.ErrorLog("获取治疗小结失败:%v", getTreatmentSummaryErr)
|
475
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
461
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
476
|
return
|
462
|
return
|
477
|
}
|
463
|
}
|
478
|
|
464
|
|
479
|
- dialysisPrescribe, _ := service.MobileGetDialysisPrescribeByModeIdSix(adminInfo.Org.Id, patientID, schedual.ModeId)
|
|
|
|
|
465
|
+ dialysisPrescribe, _ := service.MobileGetDialysisPrescribeByModeIdSix(info.UserOrgId, patientID, schedual.ModeId)
|
480
|
|
466
|
|
481
|
- dialysisSolution, _ := service.MobileGetDialysisSolutionByModeId(adminInfo.Org.Id, patientID, schedual.ModeId)
|
|
|
|
|
467
|
+ dialysisSolution, _ := service.MobileGetDialysisSolutionByModeId(info.UserOrgId, patientID, schedual.ModeId)
|
482
|
|
468
|
|
483
|
- lastDialysisPrescribe, _ := service.MobileGetLastDialysisPrescribeByModeId(adminInfo.Org.Id, patientID, schedual.ModeId)
|
|
|
|
|
469
|
+ lastDialysisPrescribe, _ := service.MobileGetLastDialysisPrescribeByModeId(info.UserOrgId, patientID, schedual.ModeId)
|
484
|
|
470
|
|
485
|
//获取系统透析处方模版
|
471
|
//获取系统透析处方模版
|
486
|
- systemDialysisPrescribe, _ := service.MobileGetSystemDialysisPrescribeByModeId(adminInfo.Org.Id, schedual.ModeId)
|
|
|
|
|
472
|
+ systemDialysisPrescribe, _ := service.MobileGetSystemDialysisPrescribeByModeId(info.UserOrgId, schedual.ModeId)
|
487
|
|
473
|
|
488
|
- _, is_open_config := service.FindXTHisRecordByOrgId(adminInfo.Org.Id)
|
|
|
|
|
474
|
+ _, is_open_config := service.FindXTHisRecordByOrgId(info.UserOrgId)
|
489
|
|
475
|
|
490
|
- _, is_project_open_config := service.FindXTHisProjectByOrgId(adminInfo.Org.Id)
|
|
|
|
|
476
|
+ _, is_project_open_config := service.FindXTHisProjectByOrgId(info.UserOrgId)
|
491
|
|
477
|
|
492
|
- projects, _ := service.GetHisPrescriptionProjectsOne(adminInfo.Org.Id, patientID)
|
|
|
|
|
478
|
+ projects, _ := service.GetHisPrescriptionProjectsOne(info.UserOrgId, patientID)
|
493
|
|
479
|
|
494
|
- stockType, _ := service.GetStockType(adminInfo.Org.Id)
|
|
|
|
|
480
|
+ stockType, _ := service.GetStockType(info.UserOrgId)
|
495
|
|
481
|
|
496
|
- prepare, _ := service.GetDialyStockOutOne(adminInfo.Org.Id, patientID)
|
|
|
|
|
482
|
+ prepare, _ := service.GetDialyStockOutOne(info.UserOrgId, patientID)
|
497
|
|
483
|
|
498
|
//获取最后一次血管通路
|
484
|
//获取最后一次血管通路
|
499
|
- lastAssessment, _ := service.GetLastPassWayAssessment(adminInfo.Org.Id, patientID)
|
|
|
|
|
485
|
+ lastAssessment, _ := service.GetLastPassWayAssessment(info.UserOrgId, patientID)
|
500
|
|
486
|
|
501
|
- prescribeOne, _ := service.MobileGetDialysisPrescribeByModeIdFive(adminInfo.Org.Id, patientID)
|
|
|
|
|
487
|
+ prescribeOne, _ := service.MobileGetDialysisPrescribeByModeIdFive(info.UserOrgId, patientID)
|
502
|
var his_advices []*models.HisDoctorAdviceInfo
|
488
|
var his_advices []*models.HisDoctorAdviceInfo
|
503
|
if is_open_config.IsOpen == 1 {
|
489
|
if is_open_config.IsOpen == 1 {
|
504
|
- his_advices, _ = service.GetAllHisDoctorAdviceOne(adminInfo.Org.Id, patientID)
|
|
|
|
|
490
|
+ his_advices, _ = service.GetAllHisDoctorAdviceOne(info.UserOrgId, patientID)
|
505
|
}
|
491
|
}
|
506
|
|
492
|
|
507
|
if getLPEErr != nil {
|
493
|
if getLPEErr != nil {
|
|
|
|
|
510
|
return
|
496
|
return
|
511
|
}
|
497
|
}
|
512
|
|
498
|
|
513
|
- lastDryWeightDislysis, getDryErr := service.MobileGetLastDryWeight(adminInfo.Org.Id, patientID)
|
|
|
|
|
499
|
+ lastDryWeightDislysis, getDryErr := service.MobileGetLastDryWeight(info.UserOrgId, patientID)
|
514
|
if getDryErr != nil {
|
500
|
if getDryErr != nil {
|
515
|
this.ErrorLog("获取最后一条干体重失败:%v", getDryErr)
|
501
|
this.ErrorLog("获取最后一条干体重失败:%v", getDryErr)
|
516
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
502
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
517
|
return
|
503
|
return
|
518
|
}
|
504
|
}
|
519
|
|
505
|
|
520
|
- _, gobalConfig := service.FindAutomaticReduceRecordByOrgId(adminInfo.Org.Id)
|
|
|
|
|
506
|
+ _, gobalConfig := service.FindAutomaticReduceRecordByOrgId(info.UserOrgId)
|
521
|
|
507
|
|
522
|
- operators, _ := service.GetAllStarfEs(adminInfo.Org.Id)
|
|
|
|
|
508
|
+ operators, _ := service.GetAllStarfEs(info.UserOrgId)
|
523
|
|
509
|
|
524
|
returnData := map[string]interface{}{
|
510
|
returnData := map[string]interface{}{
|
525
|
"patient": patient,
|
511
|
"patient": patient,
|