XMLWAN před 4 roky
rodič
revize
58c2d18055

+ 98 - 0
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go Zobrazit soubor

@@ -515,6 +515,8 @@ func (this *NewDialysisApiController) GetPatientDetail() {
515 515
 	id, _ := this.GetInt64("id")
516 516
 	//获取病人详情信息
517 517
 	detail, err := service.GetPatientDetailTwo(id)
518
+	//获取传染病详情
519
+	diseases := service.GetPatientDiseasesTwo(detail.BloodId)
518 520
 	//获取血透医嘱管理
519 521
 	if err != nil {
520 522
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
@@ -522,6 +524,7 @@ func (this *NewDialysisApiController) GetPatientDetail() {
522 524
 	}
523 525
 	this.ServeSuccessJSON(map[string]interface{}{
524 526
 		"patientDetail": detail,
527
+		"diseases":      diseases,
525 528
 	})
526 529
 }
527 530
 
@@ -766,3 +769,98 @@ func (this *NewDialysisApiController) GetlongDialysisrecord() {
766 769
 		"total":          total,
767 770
 	})
768 771
 }
772
+
773
+func (this *NewDialysisApiController) GetRescuerecord() {
774
+	timeLayout := "2006-01-02"
775
+	loc, _ := time.LoadLocation("Local")
776
+	id, _ := this.GetInt64("id")
777
+	fmt.Print("id", id)
778
+	patient, _ := service.GetPatientDetailTwo(id)
779
+	start := this.GetString("startime")
780
+	startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", start+" 00:00:00", loc)
781
+	startime := startTimes.Unix()
782
+	fmt.Print("startime", startime)
783
+	end := this.GetString("endtime")
784
+	endTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", end+" 00:00:00", loc)
785
+	endtime := endTimes.Unix()
786
+	fmt.Print("endtime", endtime)
787
+	limit, _ := this.GetInt64("limit")
788
+	fmt.Print("limit", limit)
789
+	page, _ := this.GetInt64("page")
790
+	fmt.Print("page", page)
791
+	adminInfo := this.GetMobileAdminUserInfo()
792
+	orgid := adminInfo.Org.Id
793
+	rescuerecord, total, err := service.GetRescuerecord(patient.BloodId, startime, endtime, limit, page, orgid)
794
+	if err != nil {
795
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
796
+		return
797
+	}
798
+	this.ServeSuccessJSON(map[string]interface{}{
799
+		"rescuerecord": rescuerecord,
800
+		"total":        total,
801
+	})
802
+}
803
+
804
+func (this *NewDialysisApiController) GetScheduling() {
805
+	timeLayout := "2006-01-02"
806
+	loc, _ := time.LoadLocation("Local")
807
+	id, _ := this.GetInt64("id")
808
+	fmt.Print("id", id)
809
+	patient, _ := service.GetPatientDetailTwo(id)
810
+	start := this.GetString("startime")
811
+	startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", start+" 00:00:00", loc)
812
+	startime := startTimes.Unix()
813
+	fmt.Print("startime", startime)
814
+	end := this.GetString("endtime")
815
+	endTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", end+" 00:00:00", loc)
816
+	endtime := endTimes.Unix()
817
+	fmt.Print("endtime", endtime)
818
+	limit, _ := this.GetInt64("limit")
819
+	fmt.Print("limit", limit)
820
+	page, _ := this.GetInt64("page")
821
+	fmt.Print("page", page)
822
+	mode_type, _ := this.GetInt64("mode_types")
823
+	fmt.Print("透析模式", mode_type)
824
+	adminInfo := this.GetMobileAdminUserInfo()
825
+	orgid := adminInfo.Org.Id
826
+	scheduling, total, err := service.GetScheduling(patient.BloodId, startime, endtime, limit, page, orgid, mode_type)
827
+	if err != nil {
828
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
829
+		return
830
+	}
831
+	this.ServeSuccessJSON(map[string]interface{}{
832
+		"scheduling": scheduling,
833
+		"total":      total,
834
+	})
835
+}
836
+
837
+func (this *NewDialysisApiController) GetEducation() {
838
+	timeLayout := "2006-01-02"
839
+	loc, _ := time.LoadLocation("Local")
840
+	id, _ := this.GetInt64("id")
841
+	fmt.Print("id", id)
842
+	patient, _ := service.GetPatientDetailTwo(id)
843
+	start := this.GetString("startime")
844
+	startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", start+" 00:00:00", loc)
845
+	startime := startTimes.Unix()
846
+	fmt.Print("startime", startime)
847
+	end := this.GetString("endtime")
848
+	endTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", end+" 00:00:00", loc)
849
+	endtime := endTimes.Unix()
850
+	fmt.Print("endtime", endtime)
851
+	limit, _ := this.GetInt64("limit")
852
+	fmt.Print("limit", limit)
853
+	page, _ := this.GetInt64("page")
854
+	fmt.Print("page", page)
855
+	adminInfo := this.GetMobileAdminUserInfo()
856
+	orgid := adminInfo.Org.Id
857
+	education, total, err := service.GetEducation(patient.BloodId, startime, endtime, limit, page, orgid)
858
+	if err != nil {
859
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
860
+		return
861
+	}
862
+	this.ServeSuccessJSON(map[string]interface{}{
863
+		"education": education,
864
+		"total":     total,
865
+	})
866
+}

+ 3 - 0
controllers/new_mobile_api_controllers/new_mobile_api_router_register.go Zobrazit soubor

@@ -47,4 +47,7 @@ func NewMobileAPIControllersRegisterRouters() {
47 47
 	beego.Router("/m/api/patient/deletedryweight", &NewDialysisApiController{}, "Delete:DeleteDryWeight")
48 48
 	beego.Router("/m/api/patient/getdryweightdetail", &NewDialysisApiController{}, "Get:GetDryWeightDetail")
49 49
 	beego.Router("/m/api/patient/getlongdialysisrecord", &NewDialysisApiController{}, "Get:GetlongDialysisrecord")
50
+	beego.Router("/m/api/patient/getrescuerecord", &NewDialysisApiController{}, "Get:GetRescuerecord")
51
+	beego.Router("/m/api/patient/getscheduling", &NewDialysisApiController{}, "Get:GetScheduling")
52
+	beego.Router("/m/api/patient/geteducation", &NewDialysisApiController{}, "Get:GetEducation")
50 53
 }

+ 14 - 0
models/patient_models.go Zobrazit soubor

@@ -615,3 +615,17 @@ func (PatientCourseOfDisease) TableName() string {
615 615
 
616 616
 	return "xt_patient_course_of_disease"
617 617
 }
618
+
619
+type XtPatientsInfectiousDiseases struct {
620
+	ID          int64 `gorm:"column:id" json:"id" form:"id"`
621
+	PatientId   int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
622
+	DiseaseId   int64 `gorm:"column:disease_id" json:"disease_id" form:"disease_id"`
623
+	Status      int64 `gorm:"column:status" json:"status" form:"status"`
624
+	CreatedTime int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
625
+	UpdatedTime int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
626
+}
627
+
628
+func (XtPatientsInfectiousDiseases) TableName() string {
629
+
630
+	return "xt_patients_infectious_diseases"
631
+}

+ 82 - 0
models/user_models.go Zobrazit soubor

@@ -337,3 +337,85 @@ func (XtDialysisSolution) TableName() string {
337 337
 
338 338
 	return "xt_dialysis_prescription"
339 339
 }
340
+
341
+type XtPatientRescueRecords struct {
342
+	ID         int64  `gorm:"column:id" json:"id" form:"id"`
343
+	OrgId      int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
344
+	PatientId  int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
345
+	Recorder   int64  `gorm:"column:recorder" json:"recorder" form:"recorder"`
346
+	RecordTime int64  `gorm:"column:record_time" json:"record_time" form:"record_time"`
347
+	Content    string `gorm:"column:content" json:"content" form:"content"`
348
+	Status     int64  `gorm:"column:status" json:"status" form:"status"`
349
+	Ctime      int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
350
+	Mtime      int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
351
+	UserName   string `gorm:"column:user_name" json:"user_name" form:"user_name"`
352
+}
353
+
354
+type XtPatientRescueRecord struct {
355
+	ID         int64  `gorm:"column:id" json:"id" form:"id"`
356
+	OrgId      int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
357
+	PatientId  int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
358
+	Recorder   int64  `gorm:"column:recorder" json:"recorder" form:"recorder"`
359
+	RecordTime int64  `gorm:"column:record_time" json:"record_time" form:"record_time"`
360
+	Content    string `gorm:"column:content" json:"content" form:"content"`
361
+	Status     int64  `gorm:"column:status" json:"status" form:"status"`
362
+	Ctime      int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
363
+	Mtime      int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
364
+}
365
+
366
+func (XtPatientRescueRecord) TableName() string {
367
+
368
+	return "xt_patient_rescue_record"
369
+}
370
+
371
+type XtSchedules 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
+
388
+func (XtSchedules) TableName() string {
389
+
390
+	return "xt_schedule"
391
+}
392
+
393
+type XtTreatmentSummary struct {
394
+	ID                int64  `gorm:"column:id" json:"id" form:"id"`
395
+	UserOrgId         int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
396
+	PatientId         int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
397
+	AssessmentDate    int64  `gorm:"column:assessment_date" json:"assessment_date" form:"assessment_date"`
398
+	DialysisOrderId   int64  `gorm:"column:dialysis_order_id" json:"dialysis_order_id" form:"dialysis_order_id"`
399
+	Mission           string `gorm:"column:mission" json:"mission" form:"mission"`
400
+	DialysisSummary   string `gorm:"column:dialysis_summary" json:"dialysis_summary" form:"dialysis_summary"`
401
+	Change            int64  `gorm:"column:change" json:"change" form:"change"`
402
+	SjNurse           int64  `gorm:"column:sj_nurse" json:"sj_nurse" form:"sj_nurse"`
403
+	ZlNurse           int64  `gorm:"column:zl_nurse" json:"zl_nurse" form:"zl_nurse"`
404
+	HdNurse           int64  `gorm:"column:hd_nurse" json:"hd_nurse" form:"hd_nurse"`
405
+	XjNurse           int64  `gorm:"column:xj_nurse" json:"xj_nurse" form:"xj_nurse"`
406
+	ZlDoctor          int64  `gorm:"column:zl_doctor" json:"zl_doctor" form:"zl_doctor"`
407
+	ChannelImage      string `gorm:"column:channel_image" json:"channel_image" form:"channel_image"`
408
+	Puncture          string `gorm:"column:puncture" json:"puncture" form:"puncture"`
409
+	PunctureNeedle    string `gorm:"column:puncture_needle" json:"puncture_needle" form:"puncture_needle"`
410
+	PunctureDirection string `gorm:"column:puncture_direction" json:"puncture_direction" form:"puncture_direction"`
411
+	Status            int64  `gorm:"column:status" json:"status" form:"status"`
412
+	CreatedTime       int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
413
+	UpdatedTime       int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
414
+	Creater           int64  `gorm:"column:creater" json:"creater" form:"creater"`
415
+	Modifier          int64  `gorm:"column:modifier" json:"modifier" form:"modifier"`
416
+}
417
+
418
+func (XtTreatmentSummary) TableName() string {
419
+
420
+	return "xt_treatment_summary"
421
+}

+ 1 - 1
routers/router.go Zobrazit soubor

@@ -12,7 +12,7 @@ import (
12 12
 func init() {
13 13
 	beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{
14 14
 		// AllowAllOrigins:  true,
15
-		AllowOrigins: []string{"https://xt.kuyicloud.com", "http://localhost:9528", "http://xt.test.shengws.com", "https://xt.test.shengws.com", "http://xt.test.sgjyun.com", "https://xt.test.sgjyun.com", "http://localhost:8081", "http://localhost:8082", "https://pad.kuyicloud.com", "http://pad.kuyicloud.com", "http://pad.test.sgjyun.com", "https://pad.test.sgjyun.com", "http://admin.xt.test.sgjyun.com", "http://admin.xt.kuyicloud.com", "http://mobile.sgjyun.com", "http://mobile.kuyicloud.com"},
15
+		AllowOrigins: []string{"https://xt.kuyicloud.com", "http://localhost:9528", "http://localhost:9531", "http://xt.test.shengws.com", "http://new_mobile.test.sgjyun.com", "https://xt.test.shengws.com", "http://xt.test.sgjyun.com", "https://xt.test.sgjyun.com", "http://localhost:8081", "http://localhost:8082", "https://pad.kuyicloud.com", "http://pad.kuyicloud.com", "http://pad.test.sgjyun.com", "https://pad.test.sgjyun.com", "http://admin.xt.test.sgjyun.com", "http://admin.xt.kuyicloud.com", "http://mobile.sgjyun.com", "http://mobile.kuyicloud.com"},
16 16
 		//AllowOrigins:     []string{"https://xt.kuyicloud.com", "http://localhost:9528", "http://xt.test.shengws.com","https://xt.test.shengws.com", "http://xt.test.sgjyun.com","https://xt.test.sgjyun.com", "http://localhost:8081", "http://localhost:8082", "https://pad.kuyicloud.com", "http://pad.kuyicloud.com", "http://pad.test.sgjyun.com","https://pad.test.sgjyun.com", "http://admin.xt.test.sgjyun.com", "http://admin.xt.kuyicloud.com","http://mobile.sgjyun.com","http://mobile.kuyicloud.com"},
17 17
 		AllowMethods:     []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
18 18
 		AllowHeaders:     []string{"Origin", "Authorization", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type", "X-XSRF-TOKEN", "Permission"},

+ 77 - 0
service/patientmanage_service.go Zobrazit soubor

@@ -236,6 +236,19 @@ func GetPatientDetailTwo(id int64) (models.XtPatientsNew, error) {
236 236
 	return patients, err
237 237
 }
238 238
 
239
+func GetPatientDiseasesTwo(id int64) []int64 {
240
+	var dis []models.XtPatientsInfectiousDiseases
241
+	ids := make([]int64, 0)
242
+	err := XTReadDB().Model(&models.XtPatientsInfectiousDiseases{}).Where("patient_id = ? and status = 1", id).Find(&dis).Error
243
+	if err != nil || len(dis) == 0 {
244
+		return ids
245
+	}
246
+	for _, item := range dis {
247
+		ids = append(ids, item.DiseaseId)
248
+	}
249
+	return ids
250
+}
251
+
239 252
 func CreatePatientTwo(patient *models.Patients, contagions []int64, diseases []int64) (err error) {
240 253
 
241 254
 	user, _ := GetSgjUserByMobild(patient.Phone)
@@ -526,3 +539,67 @@ func GetlongDialysisrecord(patientid int64, startime int64, endtime int64, limit
526 539
 
527 540
 	return
528 541
 }
542
+
543
+func GetRescuerecord(patientid int64, startime int64, endtime int64, limit int64, page int64, orgid int64) (rescuerecord []*models.XtPatientRescueRecords, total int64, err error) {
544
+	db := XTReadDB().Table("xt_patient_rescue_record as x").Where("x.status = 1")
545
+	if patientid > 0 {
546
+		db = db.Where("x.patient_id = ?", patientid)
547
+	}
548
+	if orgid > 0 {
549
+		db = db.Where("x.org_id = ?", orgid)
550
+	}
551
+	if startime > 0 {
552
+		db = db.Where("x.record_time >=?", startime)
553
+	}
554
+	if endtime > 0 {
555
+		db = db.Where("x.record_time <= ?", endtime)
556
+	}
557
+	offset := (page - 1) * limit
558
+	err = db.Count(&total).Order("x.record_time desc").Offset(offset).Limit(limit).Group("x.id").
559
+		Select("x.id,x.org_id,x.patient_id,x.recorder,x.record_time,x.content,x.status,r.user_name").Joins("left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = x.recorder").Scan(&rescuerecord).Error
560
+	return
561
+}
562
+
563
+func GetScheduling(patientid int64, startime int64, endtime int64, limit int64, page int64, orgid int64, modeType int64) (schedules []*models.XtSchedules, total int64, err error) {
564
+	db := XTReadDB().Table("xt_schedule as x").Where("x.status = 1")
565
+	if patientid > 0 {
566
+		db = db.Where("x.patient_id = ?", patientid)
567
+	}
568
+	if orgid > 0 {
569
+		db = db.Where("x.user_org_id = ?", orgid)
570
+	}
571
+	if startime > 0 {
572
+		db = db.Where("x.schedule_date >=?", startime)
573
+	}
574
+	if endtime > 0 {
575
+		db = db.Where("x.schedule_date <= ?", endtime)
576
+	}
577
+	if modeType > 0 {
578
+		db = db.Where("x.mode_id = ?", modeType)
579
+	}
580
+	offset := (page - 1) * limit
581
+	err = db.Count(&total).Order("x.schedule_date desc").Offset(offset).Limit(limit).Group("x.id").
582
+		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,x.status,x.created_time,x.updated_time,s.number,z.name").Joins("left join xt_device_number as s on s.id = x.bed_id").Joins("left join xt_device_zone as z on z.id = x.partition_id").Scan(&schedules).Error
583
+	return
584
+}
585
+
586
+func GetEducation(patientid int64, startime int64, endtime int64, limit int64, page int64, orgid int64) (treatment []*models.XtTreatmentSummary, total int64, err error) {
587
+
588
+	db := XTReadDB().Table("xt_treatment_summary as x").Where("x.status = 1")
589
+	if patientid > 0 {
590
+		db = db.Where("x.patient_id = ?", patientid)
591
+	}
592
+	if orgid > 0 {
593
+		db = db.Where("x.user_org_id = ?", orgid)
594
+	}
595
+	if startime > 0 {
596
+		db = db.Where("x.assessment_date >=?", startime)
597
+	}
598
+	if endtime > 0 {
599
+		db = db.Where("x.assessment_date <= ?", endtime)
600
+	}
601
+	offset := (page - 1) * limit
602
+	err = db.Count(&total).Order("x.assessment_date").Offset(offset).Limit(limit).Group("x.id").
603
+		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
604
+	return
605
+}