XMLWAN vor 4 Jahren
Ursprung
Commit
29cd3ff431

+ 1 - 1
conf/app.conf Datei anzeigen

@@ -1,5 +1,5 @@
1 1
 appname = 血透
2
-httpport = 9531
2
+httpport = 9529
3 3
 runmode = dev
4 4
 
5 5
 

+ 8 - 2
controllers/patient_api_controller.go Datei anzeigen

@@ -1991,7 +1991,10 @@ func (c *PatientApiController) GetDoctorAdvices() {
1991 1991
 	startTime := c.GetString("start_time", "")
1992 1992
 	endTime := c.GetString("end_time", "")
1993 1993
 	keywords := c.GetString("keywords", "")
1994
-
1994
+	page, _ := c.GetInt64("page")
1995
+	fmt.Println("page", page)
1996
+	limit, _ := c.GetInt64("limit")
1997
+	fmt.Println("limit", limit)
1995 1998
 	adminUserInfo := c.GetAdminUserInfo()
1996 1999
 
1997 2000
 	operatorIDs := make([]int64, 0)
@@ -2020,7 +2023,9 @@ func (c *PatientApiController) GetDoctorAdvices() {
2020 2023
 		theEndtTIme = theTime.Unix()
2021 2024
 	}
2022 2025
 
2023
-	advices, total, _ := service.GetDoctorAdviceList(adminUserInfo.CurrentOrgId, id, adviceType, stopType, theStartTIme, theEndtTIme, keywords)
2026
+	advices, _, _ := service.GetDoctorAdviceListOne(adminUserInfo.CurrentOrgId, id, adviceType, stopType, theStartTIme, theEndtTIme, keywords)
2027
+	advicestwo, total, _ := service.GetDoctorAdviceListTwo(adminUserInfo.CurrentOrgId, id, adviceType, stopType, theStartTIme, theEndtTIme, keywords, limit, page)
2028
+
2024 2029
 	if len(advices) > 0 {
2025 2030
 		for _, item := range advices {
2026 2031
 			if item.AdviceDoctor > 0 {
@@ -2045,6 +2050,7 @@ func (c *PatientApiController) GetDoctorAdvices() {
2045 2050
 		"advices":   advices,
2046 2051
 		"operators": operators,
2047 2052
 		"total":     total,
2053
+		"advicetwo": advicestwo,
2048 2054
 	})
2049 2055
 	return
2050 2056
 

+ 80 - 6
service/patient_service.go Datei anzeigen

@@ -683,7 +683,6 @@ func FindDoctorAdviceByGroupNo(orgID, groupNo int64) (advice models.DoctorAdvice
683 683
 }
684 684
 func GetDoctorAdviceList(orgID, patientID, advice_type, stop, start, end int64, keywords string) (advices []*models.DoctorAdvices, total int64, err error) {
685 685
 
686
-	fmt.Println("advicetype-----", advice_type)
687 686
 	db := readDb.Table("xt_doctor_advice as x").Where("x.status = 1")
688 687
 	table := UserReadDB().Table("sgj_user_admin_role as r")
689 688
 	fmt.Print("table", table)
@@ -693,11 +692,44 @@ func GetDoctorAdviceList(orgID, patientID, advice_type, stop, start, end int64,
693 692
 	if patientID > 0 {
694 693
 		db = db.Where("x.patient_id = ?", patientID)
695 694
 	}
696
-	//if advice_type > 0 {
697
-	//	db = db.Where("x.advice_type = ?", advice_type)
698
-	//} else if advice_type == 0 {
699
-	//	db = db.Where("x.advice_type in (?)", []int{1, 3})
700
-	//}
695
+	if advice_type > 0 {
696
+		db = db.Where("x.advice_type = ?", advice_type)
697
+	} else if advice_type == 0 {
698
+		db = db.Where("x.advice_type in (?)", []int{1, 3})
699
+	}
700
+
701
+	if stop == 1 {
702
+		db = db.Where("(x.stop_state=? or x.execution_state=?)", stop, stop)
703
+	} else if stop == 2 {
704
+		db = db.Where("x.stop_state=? and x.execution_state=?", stop, stop)
705
+	}
706
+
707
+	if start != 0 {
708
+		db = db.Where("x.start_time>=?", start)
709
+	}
710
+	if end != 0 {
711
+		db = db.Where("start_time<=?", end)
712
+	}
713
+	if len(keywords) > 0 {
714
+		likeKey := "%" + keywords + "%"
715
+		db = db.Where("x.advice_name LIKE ?", likeKey)
716
+	}
717
+	err = db.Group("x.id").Count(&total).Select("x.id, x.user_org_id, x.patient_id, x.advice_type, x.advice_date, x.record_date, x.start_time, x.advice_name,x.advice_desc, x.reminder_date, x.drug_spec, x.drug_spec_unit, x.single_dose, x.single_dose_unit, x.prescribing_number, x.prescribing_number_unit, x.delivery_way, x.execution_frequency, x.advice_doctor, x.status, x.created_time,x.updated_time, x.advice_affirm, x.remark, x.stop_time, x.stop_reason, x.stop_doctor, x.stop_state, x.parent_id, x.execution_time, x.execution_staff, x.execution_state, x.checker, x.check_state, x.check_time, x.groupno,x.remind_type,x.frequency_type,x.day_count,x.week_day,x.parent_id,r.user_name, IF(x.parent_id > 0, x.parent_id, x.id) as advice_order").Joins("Left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = x.advice_doctor").Order("start_time desc, groupno desc, advice_order desc, id asc").Scan(&advices).Error
718
+	fmt.Print("err", err)
719
+	return
720
+}
721
+
722
+func GetDoctorAdviceListOne(orgID, patientID, advice_type, stop, start, end int64, keywords string) (advices []*models.DoctorAdvices, total int64, err error) {
723
+
724
+	db := readDb.Table("xt_doctor_advice as x").Where("x.status = 1")
725
+	table := UserReadDB().Table("sgj_user_admin_role as r")
726
+	fmt.Print("table", table)
727
+	if orgID > 0 {
728
+		db = db.Where("x.user_org_id=?", orgID)
729
+	}
730
+	if patientID > 0 {
731
+		db = db.Where("x.patient_id = ?", patientID)
732
+	}
701 733
 	if advice_type == 1 && advice_type > 0 {
702 734
 		db = db.Where("x.advice_type = ?", advice_type)
703 735
 	}
@@ -724,6 +756,48 @@ func GetDoctorAdviceList(orgID, patientID, advice_type, stop, start, end int64,
724 756
 	fmt.Print("err", err)
725 757
 	return
726 758
 }
759
+
760
+func GetDoctorAdviceListTwo(orgID int64, patientID int64, advice_type int64, stop int64, start int64, end int64, keywords string, limit int64, page int64) (advices []*models.DoctorAdvices, total int64, err error) {
761
+
762
+	db := readDb.Table("xt_doctor_advice as x").Where("x.status = 1")
763
+	table := UserReadDB().Table("sgj_user_admin_role as r")
764
+	fmt.Println(table)
765
+	if orgID > 0 {
766
+		db = db.Where("x.user_org_id=?", orgID)
767
+	}
768
+	if patientID > 0 {
769
+		db = db.Where("x.patient_id = ?", patientID)
770
+	}
771
+	if advice_type == 1 {
772
+		db = db.Where("x.advice_type = ?", advice_type)
773
+	}
774
+	if advice_type == 3 {
775
+		db = db.Where("x.advice_type <> 1")
776
+	}
777
+
778
+	if stop == 1 {
779
+		db = db.Where("(x.stop_state=? or x.execution_state=?)", stop, stop)
780
+	} else if stop == 2 {
781
+		db = db.Where("x.stop_state=? and x.execution_state=?", stop, stop)
782
+	}
783
+
784
+	if start != 0 {
785
+		db = db.Where("x.start_time>=?", start)
786
+	}
787
+	if end != 0 {
788
+		db = db.Where("start_time<=?", end)
789
+	}
790
+	if len(keywords) > 0 {
791
+		likeKey := "%" + keywords + "%"
792
+		db = db.Where("x.advice_name LIKE ?", likeKey)
793
+	}
794
+	offset := (page - 1) * limit
795
+	err = db.Order("x.start_time desc").Group("x.start_time").Count(&total).Offset(offset).Limit(limit).Select("x.id, x.user_org_id, x.patient_id, x.advice_type, x.advice_date, x.record_date, x.start_time, x.advice_name,x.advice_desc, x.reminder_date, x.drug_spec, x.drug_spec_unit, x.single_dose, x.single_dose_unit, x.prescribing_number, x.prescribing_number_unit, x.delivery_way, x.execution_frequency, x.advice_doctor, x.status, x.created_time,x.updated_time, x.advice_affirm, x.remark, x.stop_time, x.stop_reason, x.stop_doctor, x.stop_state, x.parent_id, x.execution_time, x.execution_staff, x.execution_state, x.checker, x.check_state, x.check_time, x.groupno,x.remind_type,x.frequency_type,x.day_count,x.week_day,x.parent_id,r.user_name, IF(x.parent_id > 0, x.parent_id, x.id) as advice_order").Joins("Left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = x.advice_doctor").Scan(&advices).Error
796
+	fmt.Print("错误是什么", err)
797
+	return
798
+
799
+}
800
+
727 801
 func GetDoctorAdvicePageList(orgID, patientID, advice_type, stop, start, end int64, keywords string, page, limit int64) (advices []*models.DoctorAdvice, total int64, err error) {
728 802
 
729 803
 	offset := (page - 1) * limit

+ 0 - 1
service/patientmanage_service.go Datei anzeigen

@@ -524,7 +524,6 @@ func GetNewDoctorAdvice(patientID int64, advice_type int64, start int64, end int
524 524
 }
525 525
 
526 526
 func GetNewDoctorAdviceOne(patientID int64, advice_type int64, start int64, end int64, limit int64, page int64, orgID int64) (doctoradvice []*models.DoctorAdvice, total int64, err error) {
527
-	fmt.Println("advicetype------------------------------", advice_type)
528 527
 	db := readDb.Table("xt_doctor_advice as x").Where("x.status = 1")
529 528
 	table := UserReadDB().Table("sgj_user_admin_role as r")
530 529
 	fmt.Println("table", table)