XMLWAN 5 years ago
parent
commit
efc060f9ac
3 changed files with 45 additions and 0 deletions
  1. 33 0
      controllers/patientManage_api_controller.go
  2. 3 0
      routers/router.go
  3. 9 0
      service/patientmanage_service.go

+ 33 - 0
controllers/patientManage_api_controller.go View File

@@ -0,0 +1,33 @@
1
+package controllers
2
+
3
+import (
4
+	"XT/controllers"
5
+	"XT_New/enums"
6
+	"XT_New/service"
7
+	"fmt"
8
+	"github.com/astaxie/beego"
9
+)
10
+
11
+type PatientAPIController struct {
12
+	controllers.BaseAuthAPIController
13
+}
14
+
15
+func PatientRouters() {
16
+	beego.Router("/api/patient/getbloodDialysisPatient", &PatientAPIController{}, "Get:GetBloodDialysisPatient")
17
+}
18
+
19
+func (this *PatientAPIController) GetBloodDialysisPatient() {
20
+	//adminUser := this.GetAdminUserInfo()
21
+	//orgId := adminUser.CurrentOrgId
22
+	//fmt.Print("orgId")
23
+	fmt.Print("-----------------------触发了咩哟u")
24
+	patient, err := service.GetBloodDialysisPatient(7957)
25
+	fmt.Print("报错------------------", err)
26
+	if err != nil {
27
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
28
+		return
29
+	}
30
+	this.ServeSuccessJSON(map[string]interface{}{
31
+		"patient": patient,
32
+	})
33
+}

+ 3 - 0
routers/router.go View File

@@ -4,6 +4,7 @@ import (
4 4
 	"XT_New/controllers"
5 5
 	admin_api "XT_New/controllers/admin_api_controllers"
6 6
 	m_api "XT_New/controllers/mobile_api_controllers"
7
+	"fmt"
7 8
 
8 9
 	"github.com/astaxie/beego"
9 10
 	"github.com/astaxie/beego/plugins/cors"
@@ -55,4 +56,6 @@ func init() {
55 56
 	admin_api.AdminAPIControllersRegisterRouters()
56 57
 
57 58
 	controllers.ManageRouters()
59
+	fmt.Print("进来了美欧")
60
+	controllers.PatientRouters()
58 61
 }

+ 9 - 0
service/patientmanage_service.go View File

@@ -0,0 +1,9 @@
1
+package service
2
+
3
+import "XT_New/models"
4
+
5
+func GetBloodDialysisPatient(orgid int64) (paitents []*models.Patients, err error) {
6
+
7
+	err = XTReadDB().Model(&paitents).Where("user_org_id = ? and status =1", orgid).Find(&paitents).Error
8
+	return paitents, err
9
+}