XMLWAN преди 3 години
родител
ревизия
58133a99be
променени са 1 файла, в които са добавени 30 реда и са изтрити 44 реда
  1. 30 44
      controllers/xcx_mobile_api_controller.go/xcx_api_controller.go

+ 30 - 44
controllers/xcx_mobile_api_controller.go/xcx_api_controller.go Целия файл

@@ -364,23 +364,9 @@ func (this *XcxApiController) GetScheduleInfo() {
364 364
 func (this *XcxApiController) GetMobileSchedule() {
365 365
 
366 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 370
 	if getPatientErr != nil {
385 371
 		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
386 372
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -390,7 +376,7 @@ func (this *XcxApiController) GetMobileSchedule() {
390 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 381
 	if getSchedualErr != nil {
396 382
 		this.ErrorLog("获取患者排班信息失败:%v", getSchedualErr)
@@ -398,49 +384,49 @@ func (this *XcxApiController) GetMobileSchedule() {
398 384
 		return
399 385
 	}
400 386
 
401
-	receiverTreatmentAccess, getRTARErr := service.MobileGetReceiverTreatmentAccessRecordOne(adminInfo.Org.Id, patientID)
387
+	receiverTreatmentAccess, getRTARErr := service.MobileGetReceiverTreatmentAccessRecordOne(info.UserOrgId, patientID)
402 388
 	if getRTARErr != nil {
403 389
 		this.ErrorLog("获取接诊评估失败:%v", getRTARErr)
404 390
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
405 391
 		return
406 392
 	}
407 393
 
408
-	predialysisEvaluation, getPEErr := service.MobileGetPredialysisEvaluationOne(adminInfo.Org.Id, patientID)
394
+	predialysisEvaluation, getPEErr := service.MobileGetPredialysisEvaluationOne(info.UserOrgId, patientID)
409 395
 	if getPEErr != nil {
410 396
 		this.ErrorLog("获取透前评估失败:%v", getPEErr)
411 397
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
412 398
 		return
413 399
 	}
414 400
 
415
-	lastPredialysisEvaluation, getLPEErr := service.MobileGetLastTimePredialysisEvaluationOne(adminInfo.Org.Id, patientID)
401
+	lastPredialysisEvaluation, getLPEErr := service.MobileGetLastTimePredialysisEvaluationOne(info.UserOrgId, patientID)
416 402
 	if getLPEErr != nil {
417 403
 		this.ErrorLog("获取上一次透前评估失败:%v", getLPEErr)
418 404
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
419 405
 		return
420 406
 	}
421 407
 
422
-	doctorAdvices, getDoctorAdvicesErr := service.MobileGetDoctorAdvicesByGroupsOne(adminInfo.Org.Id, patientID)
408
+	doctorAdvices, getDoctorAdvicesErr := service.MobileGetDoctorAdvicesByGroupsOne(info.UserOrgId, patientID)
423 409
 	if getDoctorAdvicesErr != nil {
424 410
 		this.ErrorLog("获取临时医嘱失败:%v", getDoctorAdvicesErr)
425 411
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
426 412
 		return
427 413
 	}
428 414
 
429
-	dialysisOrder, getDialysisOrderErr := service.MobileGetSchedualDialysisRecordOne(adminInfo.Org.Id, patientID)
415
+	dialysisOrder, getDialysisOrderErr := service.MobileGetSchedualDialysisRecordOne(info.UserOrgId, patientID)
430 416
 	if getDialysisOrderErr != nil {
431 417
 		this.ErrorLog("获取透析记录失败:%v", getDialysisOrderErr)
432 418
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
433 419
 		return
434 420
 	}
435 421
 
436
-	doubleCheck, getDoubleCheckErr := service.MobileGetDoubleCheckOne(adminInfo.Org.Id, patientID)
422
+	doubleCheck, getDoubleCheckErr := service.MobileGetDoubleCheckOne(info.UserOrgId, patientID)
437 423
 	if getDoubleCheckErr != nil {
438 424
 		this.ErrorLog("获取双人核对记录失败:%v", getDoubleCheckErr)
439 425
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
440 426
 		return
441 427
 	}
442 428
 
443
-	monitorRecords, getMonitorRecordsErr := service.MobileGetMonitorRecordsOne(adminInfo.Org.Id, patientID)
429
+	monitorRecords, getMonitorRecordsErr := service.MobileGetMonitorRecordsOne(info.UserOrgId, patientID)
444 430
 	if getMonitorRecordsErr != nil {
445 431
 		this.ErrorLog("获取透析监测记录失败:%v", getMonitorRecordsErr)
446 432
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -448,60 +434,60 @@ func (this *XcxApiController) GetMobileSchedule() {
448 434
 	}
449 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 438
 	if getLastErr != nil {
453 439
 		this.ErrorLog("获取上一次透析的监测记录失败:%v", getLastErr)
454 440
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
455 441
 		return
456 442
 	}
457 443
 
458
-	assessmentAfterDislysis, getAADErr := service.MobileGetAssessmentAfterDislysisOne(adminInfo.Org.Id, patientID)
444
+	assessmentAfterDislysis, getAADErr := service.MobileGetAssessmentAfterDislysisOne(info.UserOrgId, patientID)
459 445
 	if getAADErr != nil {
460 446
 		this.ErrorLog("获取透后评估失败:%v", getAADErr)
461 447
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
462 448
 		return
463 449
 	}
464 450
 
465
-	lastAssessmentAfterDislysis, getLAADErr := service.MobileGetAssessmentAfterDislysisOne(adminInfo.Org.Id, patientID)
451
+	lastAssessmentAfterDislysis, getLAADErr := service.MobileGetAssessmentAfterDislysisOne(info.UserOrgId, patientID)
466 452
 	if getLAADErr != nil {
467 453
 		this.ErrorLog("获取上一次透后评估失败:%v", getLAADErr)
468 454
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
469 455
 		return
470 456
 	}
471 457
 
472
-	treatmentSummary, getTreatmentSummaryErr := service.MobileGetTreatmentSummaryOne(adminInfo.Org.Id, patientID)
458
+	treatmentSummary, getTreatmentSummaryErr := service.MobileGetTreatmentSummaryOne(info.UserOrgId, patientID)
473 459
 	if getTreatmentSummaryErr != nil {
474 460
 		this.ErrorLog("获取治疗小结失败:%v", getTreatmentSummaryErr)
475 461
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
476 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 488
 	var his_advices []*models.HisDoctorAdviceInfo
503 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 493
 	if getLPEErr != nil {
@@ -510,16 +496,16 @@ func (this *XcxApiController) GetMobileSchedule() {
510 496
 		return
511 497
 	}
512 498
 
513
-	lastDryWeightDislysis, getDryErr := service.MobileGetLastDryWeight(adminInfo.Org.Id, patientID)
499
+	lastDryWeightDislysis, getDryErr := service.MobileGetLastDryWeight(info.UserOrgId, patientID)
514 500
 	if getDryErr != nil {
515 501
 		this.ErrorLog("获取最后一条干体重失败:%v", getDryErr)
516 502
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
517 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 510
 	returnData := map[string]interface{}{
525 511
 		"patient":                        patient,