Pārlūkot izejas kodu

病人头像接口

XMLWAN 4 gadus atpakaļ
vecāks
revīzija
57ce85bf67

+ 5 - 5
conf/app.conf Parādīt failu

@@ -142,33 +142,33 @@ aliquid = 83
142 142
 [dev]
143 143
 mobile_token_expiration_second = 3600
144 144
 httpdomain = http://new_mobile.xt.api.sgjyun.com
145
-sso_domain = http://localhost:8091
145
+sso_domain = https://testsso.sgjyun.com
146 146
 front_end_domain = "http://xt.test.sgjyun.com/#"
147 147
 
148 148
 readmysqlhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
149 149
 readmysqlport = 3306
150 150
 readmysqluser = root
151 151
 readmysqlpass = 1Q2W3e4r!@#$
152
-readmysqlname = test_xt
152
+readmysqlname = sgj_xt
153 153
 
154 154
 writemysqlhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
155 155
 writemysqlport = 3306
156 156
 writemysqluser = root
157 157
 writemysqlpass = 1Q2W3e4r!@#$
158
-writemysqlname = test_xt
158
+writemysqlname = sgj_xt
159 159
 
160 160
 readuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
161 161
 readuserport = 3306
162 162
 readuseruser = root
163 163
 readuserpass = 1Q2W3e4r!@#$
164
-readusername = test_users
164
+readusername = sgj_users
165 165
 
166 166
 
167 167
 writeuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
168 168
 writeuserport = 3306
169 169
 writeuseruser = root
170 170
 writeuserpass = 1Q2W3e4r!@#$
171
-writeusername = test_users
171
+writeusername = sgj_users
172 172
 
173 173
 
174 174
 

+ 1 - 2
controllers/dialysis_api_controller.go Parādīt failu

@@ -4364,7 +4364,7 @@ func (c *DialysisApiController) GetDialysisOrder() {
4364 4364
 	//透析监测
4365 4365
 	Record, _ := service.FindAllMonitorRecord(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4366 4366
 	//透析检测
4367
-	monitor, err := service.FindAllMonitor(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4367
+	//monitor, err := service.FindAllMonitor(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4368 4368
 	//透析小结
4369 4369
 	TreatmentSummary, _ := service.FindTreatmentSummaryById(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4370 4370
 
@@ -4402,7 +4402,6 @@ func (c *DialysisApiController) GetDialysisOrder() {
4402 4402
 		"total":                     total,
4403 4403
 		"startNuse":                 startNuse,
4404 4404
 		"DoctorName":                DoctorName,
4405
-		"monitor":                   monitor,
4406 4405
 		"assessmentAfterDislysis":   assessmentAfterDislysis,
4407 4406
 		"predialysName":             predialysName,
4408 4407
 		"FinishNuse":                FinishNuse,

+ 46 - 0
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go Parādīt failu

@@ -8,6 +8,7 @@ import (
8 8
 	"crypto/md5"
9 9
 	"encoding/json"
10 10
 	"fmt"
11
+	"github.com/astaxie/beego"
11 12
 	"github.com/jinzhu/gorm"
12 13
 	"strconv"
13 14
 	"strings"
@@ -2633,3 +2634,48 @@ func (this *NewDialysisApiController) GetNewPatientId() {
2633 2634
 		"patient": patients,
2634 2635
 	})
2635 2636
 }
2637
+
2638
+func (this *NewDialysisApiController) UpdateImage() {
2639
+
2640
+	adminUserInfo := this.GetMobileAdminUserInfo()
2641
+
2642
+	es, _ := service.GetPatinentHead(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserInfo.AdminUser.Id)
2643
+
2644
+	action := "update"
2645
+	timeNow := time.Now().Unix()
2646
+	if es == nil {
2647
+		es = new(models.SgjUserAdminPatientHead)
2648
+		es.Status = 1
2649
+		es.UserOrgId = adminUserInfo.Org.Id
2650
+		es.AppId = adminUserInfo.App.Id
2651
+		es.Ctime = timeNow
2652
+		es.Creator = adminUserInfo.AdminUser.Id
2653
+		action = "create"
2654
+	}
2655
+	es.Mtime = timeNow
2656
+
2657
+	var esdata models.SgjUserAdminPatientHead
2658
+	var err error
2659
+	if err = json.Unmarshal(this.Ctx.Input.RequestBody, &esdata); err != nil {
2660
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2661
+		return
2662
+	}
2663
+
2664
+	es.Hash = esdata.Hash
2665
+	es.Url = beego.AppConfig.String("qiniu_domain") + esdata.Hash
2666
+
2667
+	if action == "create" {
2668
+		err = service.CreateAdminUserHead(es)
2669
+	} else {
2670
+		err = service.SaveAdminUserHead(es)
2671
+	}
2672
+	if err != nil {
2673
+		fmt.Println(err)
2674
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBUpdate)
2675
+		return
2676
+	}
2677
+	fmt.Println("esss-================", es)
2678
+	this.ServeSuccessJSON(map[string]interface{}{
2679
+		"electronic_signature": es,
2680
+	})
2681
+}

+ 1 - 0
controllers/new_mobile_api_controllers/new_mobile_api_router_register.go Parādīt failu

@@ -155,4 +155,5 @@ func NewMobileAPIControllersRegisterRouters() {
155 155
 	beego.Router("/m/api/patient/getmobile", &NewDialysisApiController{}, "Get:GetMobile")
156 156
 	beego.Router("/m/api/patient/getorgs", &NewDialysisApiController{}, "Get:GetOrgs")
157 157
 	beego.Router("/m/api/patient/getnewpatientid", &NewDialysisApiController{}, "Get:GetNewPatientId")
158
+	beego.Router("/m/api/patient/updateimage", &NewDialysisApiController{}, "Post:UpdateImage")
158 159
 }

+ 16 - 0
models/admin_user_models.go Parādīt failu

@@ -71,6 +71,22 @@ func (AdminUserElectronicSignature) TableName() string {
71 71
 	return "sgj_user_admin_electronic_signature"
72 72
 }
73 73
 
74
+type SgjUserAdminPatientHead struct {
75
+	ID        int64  `gorm:"column:id" json:"id" form:"id"`
76
+	UserOrgId int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
77
+	AppId     int64  `gorm:"column:app_id" json:"app_id" form:"app_id"`
78
+	Creator   int64  `gorm:"column:creator" json:"creator" form:"creator"`
79
+	Url       string `gorm:"column:url" json:"url" form:"url"`
80
+	Hash      string `gorm:"column:hash" json:"hash" form:"hash"`
81
+	Status    int64  `gorm:"column:status" json:"status" form:"status"`
82
+	Ctime     int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
83
+	Mtime     int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
84
+}
85
+
86
+func (SgjUserAdminPatientHead) TableName() string {
87
+	return "sgj_user_admin_patient_head"
88
+}
89
+
74 90
 type SgjUserAdminRoles struct {
75 91
 	ID            int64  `gorm:"column:id" json:"id" form:"id"`
76 92
 	AdminUserId   int64  `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`

+ 21 - 0
service/admin_service.go Parādīt failu

@@ -299,6 +299,18 @@ func GetAdminUserElectronicSignature(orgID int64, appID int64, userID int64) (*m
299 299
 	return &es, nil
300 300
 }
301 301
 
302
+func GetPatinentHead(orgid int64, appid int64, userid int64) (*models.SgjUserAdminPatientHead, error) {
303
+	var es models.SgjUserAdminPatientHead
304
+	err := readUserDb.Model(&models.SgjUserAdminPatientHead{}).Where("org_id = ? and app_id = ? and creator=? and status =1", orgid, appid, userid).First(&es).Error
305
+	if err == gorm.ErrRecordNotFound {
306
+		return nil, nil
307
+	}
308
+	if err != nil {
309
+		return nil, err
310
+	}
311
+	return &es, nil
312
+}
313
+
302 314
 func CreateAdminUserElectronicSignature(es *models.AdminUserElectronicSignature) error {
303 315
 	err := writeUserDb.Create(es).Error
304 316
 	return err
@@ -309,6 +321,15 @@ func SaveAdminUserElectronicSignature(es *models.AdminUserElectronicSignature) e
309 321
 	return err
310 322
 }
311 323
 
324
+func CreateAdminUserHead(es *models.SgjUserAdminPatientHead) error {
325
+	err := writeUserDb.Create(es).Error
326
+	return err
327
+}
328
+func SaveAdminUserHead(es *models.SgjUserAdminPatientHead) error {
329
+	err := writeUserDb.Create(es).Error
330
+	return err
331
+}
332
+
312 333
 func GetAdminUserSpecialPermission(orgID int64, appID int64, adminUserID int64, permissionType models.SpecialPermissionType) (*models.AdminUserSpecialPermission, error) {
313 334
 	var record models.AdminUserSpecialPermission
314 335
 	err := readDb.Model(&models.AdminUserSpecialPermission{}).Where("org_id = ? AND app_id = ? AND admin_user_id = ? AND permission = ? AND status = 1", orgID, appID, adminUserID, permissionType).First(&record).Error