Browse Source

修改人脸识别接口

张保健 4 years ago
parent
commit
6a08b3bd1d

+ 19 - 0
controllers/mobile_api_controllers/check_weight_api_controller.go View File

@@ -697,6 +697,25 @@ func (c *CheckWeightApiController) GetPatientList() {
697 697
 	})
698 698
 }
699 699
 
700
+func (c *CheckWeightApiController) GetPatientListById() {
701
+	patientId, _ := c.GetInt64("patient_id", 0)
702
+	if patientId <= 0 {
703
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
704
+		return
705
+	}
706
+
707
+	adminUserInfo := c.GetMobileAdminUserInfo()
708
+	patient, error := service.GetPatientListById(adminUserInfo.Org.Id, patientId)
709
+	if error != nil {
710
+		c.ErrorLog("获取病人详情失败:%v", error)
711
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
712
+		return
713
+	}
714
+	c.ServeSuccessJSON(map[string]interface{}{
715
+		"patientinfo": patient,
716
+	})
717
+}
718
+
700 719
 func (c *CheckWeightApiController) GetPatientInfoDialysis() {
701 720
 	id, _ := c.GetInt64("patient", 0)
702 721
 	if id <= 0 {

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

@@ -12,6 +12,7 @@ func MobileAPIControllersRegisterRouters() {
12 12
 	beego.Router("/m/api/savebloodpressure", &CheckWeightApiController{}, "Post:SaveBloodPressure")
13 13
 	beego.Router("/m/api/checkbeforedialysis", &CheckWeightApiController{}, "get:GetPatientInfoBeforeDialysis")
14 14
 	beego.Router("/m/api/getpatientlist", &CheckWeightApiController{}, "get:GetPatientList")
15
+	beego.Router("/m/api/getpatientinfo", &CheckWeightApiController{}, "get:GetPatientListById")
15 16
 	beego.Router("/m/api/checkdialysis", &CheckWeightApiController{}, "get:GetPatientInfoDialysis")
16 17
 	beego.Router("/m/api/savecheckdialysis", &CheckWeightApiController{}, "Post:SavePatientInfoDialysis")
17 18
 	beego.Router("/m/api/scheduals", &DialysisAPIController{}, "get:Scheduals")

+ 9 - 0
models/patient_models.go View File

@@ -1,5 +1,14 @@
1 1
 package models
2 2
 
3
+type PatientListForFaceList struct {
4
+	ID          int64  `gorm:"column:id" json:"id" form:"id"`
5
+	UpdatedTime int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
6
+}
7
+
8
+func (PatientListForFaceList) TableName() string {
9
+	return "xt_patients"
10
+}
11
+
3 12
 type PatientListForFace struct {
4 13
 	ID          int64  `gorm:"column:id" json:"id" form:"id"`
5 14
 	UserOrgId   int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`

+ 7 - 2
service/patient_service.go View File

@@ -80,8 +80,8 @@ func GetAllPatientList(orgID int64) (patients []*models.Patients, total int64, e
80 80
 	return
81 81
 }
82 82
 
83
-func GetPatientListByUpdateTime(orgID int64, syncTime int64, force int64) (patients []*models.PatientListForFace, total int64, err error) {
84
-	db := readDb.Model(&models.PatientListForFace{}).Where("user_org_id=? and status=1", orgID)
83
+func GetPatientListByUpdateTime(orgID int64, syncTime int64, force int64) (patients []*models.PatientListForFaceList, total int64, err error) {
84
+	db := readDb.Model(&models.PatientListForFaceList{}).Where("user_org_id=? and status=1", orgID)
85 85
 	if force == 0 {
86 86
 		db = db.Where("updated_time >= ?", syncTime)
87 87
 	}
@@ -89,6 +89,11 @@ func GetPatientListByUpdateTime(orgID int64, syncTime int64, force int64) (patie
89 89
 	return
90 90
 }
91 91
 
92
+func GetPatientListById(orgID int64, patientId int64) (patients models.PatientListForFace, err error) {
93
+	err = readDb.Model(&models.PatientListForFaceList{}).Where("user_org_id=? and id = ? and status=1", orgID,patientId).First(&patients).Error
94
+	return
95
+}
96
+
92 97
 func GetPatientCount(orgID int64) (total int64) {
93 98
 	readDb.Model(&models.Patients{}).Where("user_org_id=? and status=1", orgID).Count(&total)
94 99
 	return