XMLWAN 4 vuotta sitten
vanhempi
commit
5221a456e1

+ 39 - 0
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go Näytä tiedosto

@@ -894,3 +894,42 @@ func (this *NewDialysisApiController) GetEducation() {
894 894
 		"total":     total,
895 895
 	})
896 896
 }
897
+
898
+func (this *NewDialysisApiController) GetSchedulingDetail() {
899
+	id, _ := this.GetInt64("id")
900
+	detail, err := service.GetSchedulingDetail(id)
901
+	patient, err := service.GetSchedulingTwo(id)
902
+	fmt.Print("errr", err)
903
+	if err != nil {
904
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
905
+		return
906
+	}
907
+	this.ServeSuccessJSON(map[string]interface{}{
908
+		"schedulingDetail": detail,
909
+		"patient":          patient,
910
+	})
911
+}
912
+
913
+func (this *NewDialysisApiController) DeleteScheduling() {
914
+	id, _ := this.GetInt64("id")
915
+	fmt.Print("id", id)
916
+	err := service.DeleteScheduling(id)
917
+	fmt.Println("错误是什么", err)
918
+	returnData := make(map[string]interface{}, 0)
919
+	returnData["msg"] = "ok"
920
+	this.ServeSuccessJSON(returnData)
921
+	return
922
+}
923
+
924
+func (this *NewDialysisApiController) GetEducationDetail() {
925
+	id, _ := this.GetInt64("id")
926
+	fmt.Print("id----------", id)
927
+	education, err := service.GetEducationDetailOne(id)
928
+	if err != nil {
929
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
930
+		return
931
+	}
932
+	this.ServeSuccessJSON(map[string]interface{}{
933
+		"education": education,
934
+	})
935
+}

+ 3 - 0
controllers/new_mobile_api_controllers/new_mobile_api_router_register.go Näytä tiedosto

@@ -50,4 +50,7 @@ func NewMobileAPIControllersRegisterRouters() {
50 50
 	beego.Router("/m/api/patient/getrescuerecord", &NewDialysisApiController{}, "Get:GetRescuerecord")
51 51
 	beego.Router("/m/api/patient/getscheduling", &NewDialysisApiController{}, "Get:GetScheduling")
52 52
 	beego.Router("/m/api/patient/geteducation", &NewDialysisApiController{}, "Get:GetEducation")
53
+	beego.Router("/m/api/patient/getschedulingdetail", &NewDialysisApiController{}, "Get:GetSchedulingDetail")
54
+	beego.Router("/m/api/patient/deletescheduling", &NewDialysisApiController{}, "Delete:DeleteScheduling")
55
+	beego.Router("/m/api/patient/geteducationdetail", &NewDialysisApiController{}, "Get:GetEducationDetail")
53 56
 }

+ 43 - 0
models/user_models.go Näytä tiedosto

@@ -368,6 +368,23 @@ func (XtPatientRescueRecord) TableName() string {
368 368
 	return "xt_patient_rescue_record"
369 369
 }
370 370
 
371
+type XtScheduless struct {
372
+	ID           int64  `gorm:"column:id" json:"id" form:"id"`
373
+	UserOrgId    int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
374
+	PartitionId  int64  `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
375
+	BedId        int64  `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
376
+	PatientId    int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
377
+	ScheduleDate int64  `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
378
+	ScheduleType int64  `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
379
+	ScheduleWeek int64  `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
380
+	ModeId       int64  `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
381
+	Status       int64  `gorm:"column:status" json:"status" form:"status"`
382
+	CreatedTime  int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
383
+	UpdatedTime  int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
384
+	Number       string `gorm:"column:number" json:"number"`
385
+	Name         string `gorm:"column:name" json:"name"`
386
+}
387
+
371 388
 type XtSchedules struct {
372 389
 	ID           int64  `gorm:"column:id" json:"id" form:"id"`
373 390
 	UserOrgId    int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
@@ -390,6 +407,32 @@ func (XtSchedules) TableName() string {
390 407
 	return "xt_schedule"
391 408
 }
392 409
 
410
+type XtTreatmentSummarys struct {
411
+	ID                int64  `gorm:"column:id" json:"id" form:"id"`
412
+	UserOrgId         int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
413
+	PatientId         int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
414
+	AssessmentDate    int64  `gorm:"column:assessment_date" json:"assessment_date" form:"assessment_date"`
415
+	DialysisOrderId   int64  `gorm:"column:dialysis_order_id" json:"dialysis_order_id" form:"dialysis_order_id"`
416
+	Mission           string `gorm:"column:mission" json:"mission" form:"mission"`
417
+	DialysisSummary   string `gorm:"column:dialysis_summary" json:"dialysis_summary" form:"dialysis_summary"`
418
+	Change            int64  `gorm:"column:change" json:"change" form:"change"`
419
+	SjNurse           int64  `gorm:"column:sj_nurse" json:"sj_nurse" form:"sj_nurse"`
420
+	ZlNurse           int64  `gorm:"column:zl_nurse" json:"zl_nurse" form:"zl_nurse"`
421
+	HdNurse           int64  `gorm:"column:hd_nurse" json:"hd_nurse" form:"hd_nurse"`
422
+	XjNurse           int64  `gorm:"column:xj_nurse" json:"xj_nurse" form:"xj_nurse"`
423
+	ZlDoctor          int64  `gorm:"column:zl_doctor" json:"zl_doctor" form:"zl_doctor"`
424
+	ChannelImage      string `gorm:"column:channel_image" json:"channel_image" form:"channel_image"`
425
+	Puncture          string `gorm:"column:puncture" json:"puncture" form:"puncture"`
426
+	PunctureNeedle    string `gorm:"column:puncture_needle" json:"puncture_needle" form:"puncture_needle"`
427
+	PunctureDirection string `gorm:"column:puncture_direction" json:"puncture_direction" form:"puncture_direction"`
428
+	Status            int64  `gorm:"column:status" json:"status" form:"status"`
429
+	CreatedTime       int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
430
+	UpdatedTime       int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
431
+	Creater           int64  `gorm:"column:creater" json:"creater" form:"creater"`
432
+	Modifier          int64  `gorm:"column:modifier" json:"modifier" form:"modifier"`
433
+	Name              string `gorm:"column:name" json:"name"`
434
+}
435
+
393 436
 type XtTreatmentSummary struct {
394 437
 	ID                int64  `gorm:"column:id" json:"id" form:"id"`
395 438
 	UserOrgId         int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`

+ 26 - 0
service/patientmanage_service.go Näytä tiedosto

@@ -634,3 +634,29 @@ func GetEducation(patientid int64, startime int64, endtime int64, limit int64, p
634 634
 		Select("x.id,x.user_org_id,x.patient_id,x.assessment_date,x.dialysis_order_id,x.mission,x.dialysis_summary,x.change,x.sj_nurse,x.zl_nurse,x.hd_nurse,x.xj_nurse,x.zl_doctor,x.channel_image,x.puncture,x.puncture_needle,x.puncture_direction,x.status,x.created_time,x.updated_time,x.creater,x.modifier").Scan(&treatment).Error
635 635
 	return
636 636
 }
637
+
638
+func GetSchedulingDetail(id int64) (models.XtScheduless, error) {
639
+	schedules := models.XtScheduless{}
640
+	db := XTReadDB().Table("xt_schedule as x")
641
+	err := db.Select("x.id,x.user_org_id,x.partition_id,x.bed_id,x.patient_id,x.schedule_date,x.schedule_type,x.schedule_week,x.mode_id,n.number,z.name").Joins("left join xt_device_number as n on n.id = x.bed_id").Joins("left join xt_device_zone as z on z.id = x.partition_id").Where("x.id =?", id).Scan(&schedules).Error
642
+	return schedules, err
643
+}
644
+
645
+func GetSchedulingTwo(id int64) (models.XtScheduless, error) {
646
+	schedules := models.XtScheduless{}
647
+	db := XTReadDB().Table("xt_schedule as x")
648
+	err := db.Select("x.id,x.user_org_id,x.partition_id,x.bed_id,x.patient_id,x.schedule_date,x.schedule_type,x.schedule_week,x.mode_id,z.name").Joins("left join xt_patients as z on z.id = x.patient_id").Where("x.id =?", id).Scan(&schedules).Error
649
+	return schedules, err
650
+}
651
+
652
+func DeleteScheduling(id int64) error {
653
+	err := XTWriteDB().Model(models.XtSchedules{}).Where("id=?", id).Update(map[string]interface{}{"status": 0, "updated_time": time.Now().Unix()}).Error
654
+	return err
655
+}
656
+
657
+func GetEducationDetailOne(id int64) (models.XtTreatmentSummarys, error) {
658
+	summarys := models.XtTreatmentSummarys{}
659
+	db := XTReadDB().Table("xt_treatment_summary as x")
660
+	err := db.Select("x.id,x.user_org_id,x.patient_id,x.assessment_date,x.dialysis_order_id,x.mission,x.dialysis_summary,x.change,x.sj_nurse,x.zl_nurse,x.hd_nurse,x.xj_nurse,x.zl_doctor,x.channel_image,x.puncture,x.puncture_needle,x.puncture_direction,x.status,x.created_time,x.creater,x.modifier,s.name").Joins("left join xt_patients as s on s.id = x.patient_id").Where("x.id = ?", id).Scan(&summarys).Error
661
+	return summarys, err
662
+}