张保健 4 years ago
parent
commit
a572a3be88

+ 45 - 1
controllers/doctors_api_controller.go View File

@@ -3,7 +3,7 @@ package controllers
3 3
 import (
4 4
 	"XT_New/service"
5 5
 	"strconv"
6
-
6
+	"XT_New/enums"
7 7
 	"XT_New/models"
8 8
 	"XT_New/utils"
9 9
 	"fmt"
@@ -26,6 +26,50 @@ func DoctorApiRegistRouters() {
26 26
 	beego.Router("/api/paients/getdryweightdetail", &DoctorsApiController{}, "Get:GetDryWeightDetail")
27 27
 	beego.Router("/api/patients/modifydryweightdata", &DoctorsApiController{}, "Get:ModifydryWeightData")
28 28
 	beego.Router("/api/patient/deletedryweight", &DoctorsApiController{}, "Delete:DeleteDryWeight")
29
+	beego.Router("/api/schedule/advices", &DoctorsApiController{}, "Get:ScheduleAdvices")
30
+}
31
+
32
+func (c *DoctorsApiController) ScheduleAdvices() {
33
+	schedualDate := c.GetString("date")
34
+	adviceType, _ := c.GetInt("advice_type")
35
+	patientType, _ := c.GetInt("patient_type")
36
+
37
+	if adviceType != 1 && adviceType != 3 && adviceType != 2 {
38
+		adviceType = 0
39
+	}
40
+
41
+	if patientType != 1 && patientType != 2 {
42
+
43
+		patientType = 0
44
+	}
45
+
46
+	date, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", schedualDate)
47
+	if parseDateErr != nil {
48
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
49
+		return
50
+	}
51
+
52
+	adminUserInfo := c.GetAdminUserInfo()
53
+	orgID := adminUserInfo.CurrentOrgId
54
+
55
+	scheduals, err := service.MobileGetScheduleDoctorAdvices(orgID, date.Unix(), adviceType, patientType, adminUserInfo.AdminUser.Id)
56
+	adminUser, _ := service.GetAllAdminUsers(orgID, adminUserInfo.CurrentAppId)
57
+	if err != nil {
58
+		c.ErrorLog("获取排班信息失败:%v", err)
59
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
60
+	} else {
61
+		filtedScheduals := []*service.MScheduleDoctorAdviceVM{}
62
+		for _, schedual := range scheduals {
63
+			if len(schedual.DoctorAdvices) > 0 {
64
+				filtedScheduals = append(filtedScheduals, schedual)
65
+			}
66
+		}
67
+		c.ServeSuccessJSON(map[string]interface{}{
68
+			"scheduals": filtedScheduals,
69
+
70
+			"adminUser": adminUser,
71
+		})
72
+	}
29 73
 }
30 74
 
31 75
 func (c *DoctorsApiController) GetAllDoctorAndNurse() {

+ 10 - 10
controllers/mobile_api_controllers/check_weight_api_controller.go View File

@@ -754,18 +754,18 @@ func (c *CheckWeightApiController) GetPatientListForSchedulesFind() {
754 754
 	theStartTime, _ := time.ParseInLocation(timeLayout, scheduleDateStart, loc)
755 755
 	syncTime := theStartTime.Unix()
756 756
 	adminUserInfo := c.GetMobileAdminUserInfo()
757
-	if len(patient_name) == 0 {
758
-		patientList, total, error := service.GetPatientListBySchedules(adminUserInfo.Org.Id, syncTime)
759
-	} else {
760
-		patientList, total, error := service.GetPatientListBySchedulesFind(adminUserInfo.Org.Id, syncTime,patient_name)
761
-	}
757
+	
758
+	patientList, total, error := service.GetPatientListBySchedulesFind(adminUserInfo.Org.Id, syncTime,patient_name)
759
+	
762 760
 	patientSchedule := make([]map[string]interface{},0)
763 761
 	for _, item := range patientList {
764
-		patientTemp := make(map[string]interface{})
765
-		patientTemp["patient_id"] = item.PatientId
766
-		patientTemp["patient_name"] = item.Patient.Name
767
-		patientTemp["schedule_type"] = item.ScheduleType
768
-		patientSchedule = append(patientSchedule, patientTemp)
762
+		if len(item.Patient.Name) > 0 {
763
+			patientTemp := make(map[string]interface{})
764
+			patientTemp["patient_id"] = item.PatientId
765
+			patientTemp["patient_name"] = item.Patient.Name
766
+			patientTemp["schedule_type"] = item.ScheduleType
767
+			patientSchedule = append(patientSchedule, patientTemp)
768
+		}
769 769
 	}
770 770
 
771 771
 	if error != nil {

+ 1 - 0
controllers/mobile_api_controllers/mobile_api_router_register.go View File

@@ -13,6 +13,7 @@ func MobileAPIControllersRegisterRouters() {
13 13
 	beego.Router("/m/api/checkbeforedialysis", &CheckWeightApiController{}, "get:GetPatientInfoBeforeDialysis")
14 14
 	beego.Router("/m/api/getpatientlist", &CheckWeightApiController{}, "get:GetPatientList")
15 15
 	beego.Router("/m/api/getschedulepatient", &CheckWeightApiController{}, "get:GetPatientListForSchedules")
16
+	beego.Router("/m/api/getschedulepatientfind", &CheckWeightApiController{}, "get:GetPatientListForSchedulesFind")
16 17
 	beego.Router("/m/api/getpatientinfo", &CheckWeightApiController{}, "get:GetPatientListById")
17 18
 	beego.Router("/m/api/checkdialysis", &CheckWeightApiController{}, "get:GetPatientInfoDialysis")
18 19
 	beego.Router("/m/api/savecheckdialysis", &CheckWeightApiController{}, "Post:SavePatientInfoDialysis")