XMLWAN преди 3 години
родител
ревизия
85ba4bac76
променени са 3 файла, в които са добавени 45 реда и са изтрити 12 реда
  1. 14 12
      controllers/xcx_mobile_api_controller.go/xcx_api_controller.go
  2. 24 0
      models/xcx_user_models.go
  3. 7 0
      service/xcx_mobile_api_service.go

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

@@ -507,8 +507,10 @@ func (this *XcxApiController) GetMobileSchedule() {
507 507
 	loc, _ := time.LoadLocation("Local")
508 508
 	time_now := time.Now().Format("2006-01-02")
509 509
 	timeNowUnix, _ := time.ParseInLocation(timeLayout+"15:04:05", time_now+"00:00:00", loc)
510
-	fmt.Println("timeNowUnix", timeNowUnix.Unix())
511 510
 
511
+	fmt.Println("timeNowUnix", timeNowUnix.Unix())
512
+	//获取该患者最后一次排班
513
+	list, _ := service.GetLastScheduleList(patientID)
512 514
 	patient, getPatientErr := service.MobileGetPatientDetail(info.UserOrgId, patientID)
513 515
 	if getPatientErr != nil {
514 516
 		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
@@ -527,14 +529,14 @@ func (this *XcxApiController) GetMobileSchedule() {
527 529
 		return
528 530
 	}
529 531
 
530
-	receiverTreatmentAccess, getRTARErr := service.MobileGetReceiverTreatmentAccessRecordOne(info.UserOrgId, patientID, timeNowUnix.Unix())
532
+	receiverTreatmentAccess, getRTARErr := service.MobileGetReceiverTreatmentAccessRecordOne(info.UserOrgId, patientID, list.ScheduleDate)
531 533
 	if getRTARErr != nil {
532 534
 		this.ErrorLog("获取接诊评估失败:%v", getRTARErr)
533 535
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
534 536
 		return
535 537
 	}
536 538
 
537
-	predialysisEvaluation, getPEErr := service.MobileGetPredialysisEvaluationOne(info.UserOrgId, patientID, timeNowUnix.Unix())
539
+	predialysisEvaluation, getPEErr := service.MobileGetPredialysisEvaluationOne(info.UserOrgId, patientID, list.ScheduleDate)
538 540
 	if getPEErr != nil {
539 541
 		this.ErrorLog("获取透前评估失败:%v", getPEErr)
540 542
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -548,28 +550,28 @@ func (this *XcxApiController) GetMobileSchedule() {
548 550
 		return
549 551
 	}
550 552
 
551
-	doctorAdvices, getDoctorAdvicesErr := service.MobileGetDoctorAdvicesByGroupsOne(info.UserOrgId, patientID, timeNowUnix.Unix())
553
+	doctorAdvices, getDoctorAdvicesErr := service.MobileGetDoctorAdvicesByGroupsOne(info.UserOrgId, patientID, list.ScheduleDate)
552 554
 	if getDoctorAdvicesErr != nil {
553 555
 		this.ErrorLog("获取临时医嘱失败:%v", getDoctorAdvicesErr)
554 556
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
555 557
 		return
556 558
 	}
557 559
 
558
-	dialysisOrder, getDialysisOrderErr := service.MobileGetSchedualDialysisRecordOne(info.UserOrgId, patientID, timeNowUnix.Unix())
560
+	dialysisOrder, getDialysisOrderErr := service.MobileGetSchedualDialysisRecordOne(info.UserOrgId, patientID, list.ScheduleDate)
559 561
 	if getDialysisOrderErr != nil {
560 562
 		this.ErrorLog("获取透析记录失败:%v", getDialysisOrderErr)
561 563
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
562 564
 		return
563 565
 	}
564 566
 
565
-	doubleCheck, getDoubleCheckErr := service.MobileGetDoubleCheckOne(info.UserOrgId, patientID, timeNowUnix.Unix())
567
+	doubleCheck, getDoubleCheckErr := service.MobileGetDoubleCheckOne(info.UserOrgId, patientID, list.ScheduleDate)
566 568
 	if getDoubleCheckErr != nil {
567 569
 		this.ErrorLog("获取双人核对记录失败:%v", getDoubleCheckErr)
568 570
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
569 571
 		return
570 572
 	}
571 573
 
572
-	monitorRecords, getMonitorRecordsErr := service.MobileGetMonitorRecordsOne(info.UserOrgId, patientID, timeNowUnix.Unix())
574
+	monitorRecords, getMonitorRecordsErr := service.MobileGetMonitorRecordsOne(info.UserOrgId, patientID, list.ScheduleDate)
573 575
 	if getMonitorRecordsErr != nil {
574 576
 		this.ErrorLog("获取透析监测记录失败:%v", getMonitorRecordsErr)
575 577
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -584,21 +586,21 @@ func (this *XcxApiController) GetMobileSchedule() {
584 586
 		return
585 587
 	}
586 588
 
587
-	assessmentAfterDislysis, getAADErr := service.MobileGetAssessmentAfterDislysisOne(info.UserOrgId, patientID, timeNowUnix.Unix())
589
+	assessmentAfterDislysis, getAADErr := service.MobileGetAssessmentAfterDislysisOne(info.UserOrgId, patientID, list.ScheduleDate)
588 590
 	if getAADErr != nil {
589 591
 		this.ErrorLog("获取透后评估失败:%v", getAADErr)
590 592
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
591 593
 		return
592 594
 	}
593 595
 
594
-	lastAssessmentAfterDislysis, getLAADErr := service.MobileGetAssessmentAfterDislysisOne(info.UserOrgId, patientID, timeNowUnix.Unix())
596
+	lastAssessmentAfterDislysis, getLAADErr := service.MobileGetAssessmentAfterDislysisOne(info.UserOrgId, patientID, list.ScheduleDate)
595 597
 	if getLAADErr != nil {
596 598
 		this.ErrorLog("获取上一次透后评估失败:%v", getLAADErr)
597 599
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
598 600
 		return
599 601
 	}
600 602
 
601
-	treatmentSummary, getTreatmentSummaryErr := service.MobileGetTreatmentSummaryOne(info.UserOrgId, patientID, timeNowUnix.Unix())
603
+	treatmentSummary, getTreatmentSummaryErr := service.MobileGetTreatmentSummaryOne(info.UserOrgId, patientID, list.ScheduleDate)
602 604
 	if getTreatmentSummaryErr != nil {
603 605
 		this.ErrorLog("获取治疗小结失败:%v", getTreatmentSummaryErr)
604 606
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -625,10 +627,10 @@ func (this *XcxApiController) GetMobileSchedule() {
625 627
 	//获取最后一次血管通路
626 628
 	lastAssessment, _ := service.GetLastPassWayAssessment(info.UserOrgId, patientID)
627 629
 
628
-	prescribeOne, _ := service.MobileGetDialysisPrescribeByModeIdFive(info.UserOrgId, patientID, timeNowUnix.Unix())
630
+	prescribeOne, _ := service.MobileGetDialysisPrescribeByModeIdFive(info.UserOrgId, patientID, list.ScheduleDate)
629 631
 	var his_advices []*models.HisDoctorAdviceInfo
630 632
 	if is_open_config.IsOpen == 1 {
631
-		his_advices, _ = service.GetAllHisDoctorAdviceOne(info.UserOrgId, patientID, timeNowUnix.Unix())
633
+		his_advices, _ = service.GetAllHisDoctorAdviceOne(info.UserOrgId, patientID, list.ScheduleDate)
632 634
 	}
633 635
 
634 636
 	if getLPEErr != nil {

+ 24 - 0
models/xcx_user_models.go Целия файл

@@ -536,3 +536,27 @@ type XcxGobalTemplate struct {
536 536
 	Ctime      int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
537 537
 	Mtime      int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
538 538
 }
539
+
540
+func (XcxGobalTemplate) TableName() string {
541
+	return "xt_gobal_template"
542
+}
543
+
544
+type XcxSchedule struct {
545
+	ID           int64 `gorm:"column:id" json:"id" form:"id"`
546
+	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
547
+	PartitionId  int64 `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
548
+	BedId        int64 `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
549
+	PatientId    int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
550
+	ScheduleDate int64 `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
551
+	ScheduleType int64 `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
552
+	ScheduleWeek int64 `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
553
+	ModeId       int64 `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
554
+	Status       int64 `gorm:"column:status" json:"status" form:"status"`
555
+	CreatedTime  int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
556
+	UpdatedTime  int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
557
+	IsExport     int64 `gorm:"column:is_export" json:"is_export" form:"is_export"`
558
+}
559
+
560
+func (XcxSchedule) TableName() string {
561
+	return "his_doctor_advice_info"
562
+}

+ 7 - 0
service/xcx_mobile_api_service.go Целия файл

@@ -572,3 +572,10 @@ func GetDataConfig(orgid int64) (list []*models.XcxDataConfig, err error) {
572 572
 	err = XTReadDB().Model(&list).Where("(org_id = ? or org_id = 0) and status = 1", orgid).Find(&list).Error
573 573
 	return list, err
574 574
 }
575
+
576
+func GetLastScheduleList(patient_id int64) (models.XcxSchedule, error) {
577
+
578
+	schedule := models.XcxSchedule{}
579
+	err := XTReadDB().Where("patient_id = ? and status = 1", patient_id).Last(&schedule).Error
580
+	return schedule, err
581
+}