Browse Source

体积小

XMLWAN 3 years ago
parent
commit
80fe89c571

+ 15 - 0
conf/app.conf View File

@@ -113,6 +113,21 @@ writepatientuser = syh
113 113
 writepatientpass = xhPECP2nFObR8aUK
114 114
 writepatientname = sgj_cdm
115 115
 
116
+
117
+readswshost = shengws1.mysql.rds.aliyuncs.com
118
+readswsport = 3306
119
+readswsuser = syh
120
+readswspass = xhPECP2nFObR8aUK
121
+readswsname = shengws
122
+
123
+
124
+
125
+writeswshost = shengws1.mysql.rds.aliyuncs.com
126
+writeswsport = 3306
127
+writeswsuser = syh
128
+writeswspass = xhPECP2nFObR8aUK
129
+writeswsname = shengws
130
+
116 131
 redishost = 349e580b2a524290.redis.rds.aliyuncs.com
117 132
 redisport = 6379
118 133
 redispasswrod = TZtBW098WId3i27clkpj3q8dnUaVFP

+ 1 - 0
controllers/gobal_config_api_controller.go View File

@@ -1682,6 +1682,7 @@ func (c *GobalConfigApiController) GetDrugCancelDetail() {
1682 1682
 	keyword := c.GetString("keyword")
1683 1683
 	limit, _ := c.GetInt64("limit")
1684 1684
 	page, _ := c.GetInt64("page")
1685
+
1685 1686
 	order, total, err := service.GetDrugCancelOrder(startTime, endTime, adminInfo.CurrentOrgId, order_type, manufacturer_id, keyword, page, limit)
1686 1687
 	if err != nil {
1687 1688
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)

+ 25 - 0
controllers/xcx_mobile_api_controller.go/xcx_api_controller.go View File

@@ -59,6 +59,10 @@ func XcxApiControllersRegisterRouters() {
59 59
 	//检验检查
60 60
 	beego.Router("/xcx/api/mobile/getinspectionlist", &XcxApiController{}, "Get:GetInspectionList")
61 61
 
62
+	//肾有杯
63
+	beego.Router("/xcx/api/mobile/getarticlist", &XcxApiController{}, "Get:GetArticList")
64
+
65
+	beego.Router("/xcx/api/mobile/getarticlistdetail", &XcxApiController{}, "Get:GetArticListDetail")
62 66
 }
63 67
 
64 68
 type XcxApiController struct {
@@ -885,3 +889,24 @@ func (this *XcxApiController) GetInspectionList() {
885 889
 		"list": list,
886 890
 	})
887 891
 }
892
+
893
+func (this *XcxApiController) GetArticList() {
894
+
895
+	page, _ := this.GetInt64("page")
896
+	limit, _ := this.GetInt64("limit")
897
+	activity_id, _ := this.GetInt64("activity_id")
898
+	list, total, _ := service.GetArticList(activity_id, page, limit)
899
+	this.ServeSuccessJSON(map[string]interface{}{
900
+		"list":  list,
901
+		"total": total,
902
+	})
903
+}
904
+
905
+func (this *XcxApiController) GetArticListDetail() {
906
+
907
+	id, _ := this.GetInt64("id")
908
+	detail, _ := service.GetArticListDetail(id)
909
+	this.ServeSuccessJSON(map[string]interface{}{
910
+		"story": detail,
911
+	})
912
+}

+ 33 - 0
models/his_models.go View File

@@ -1513,3 +1513,36 @@ type XcxDataConfig struct {
1513 1513
 func (XcxDataConfig) TableName() string {
1514 1514
 	return "xt_data_config"
1515 1515
 }
1516
+
1517
+// 故事表
1518
+type SybStory struct {
1519
+	ID              int64   `gorm:"column:id" json:"id" form:"id"`
1520
+	UserId          int64   `gorm:"column:user_id" json:"user_id" form:"user_id"`
1521
+	ActivityId      int64   `gorm:"column:activity_id" json:"activity_id" form:"activity_id"`
1522
+	Theme           int64   `gorm:"column:theme" json:"theme" form:"theme"`
1523
+	Title           string  `gorm:"column:title" json:"title" form:"title"`
1524
+	Image           string  `gorm:"column:image" json:"image" form:"image"`
1525
+	Content         string  `gorm:"column:content" json:"content" form:"content"`
1526
+	FirstVoteCount  int64   `gorm:"column:first_vote_count" json:"first_vote_count" form:"first_vote_count"`
1527
+	SecondVoteCount int64   `gorm:"column:second_vote_count" json:"second_vote_count" form:"second_vote_count"`
1528
+	FirstScore      int64   `gorm:"column:first_score" json:"first_score" form:"first_score"`
1529
+	SecondScore     int64   `gorm:"column:second_score" json:"second_score" form:"second_score"`
1530
+	Score           float64 `gorm:"column:score" json:"score" form:"score"`
1531
+	RoseCount       int64   `gorm:"column:rose_count" json:"rose_count" form:"rose_count"`
1532
+	CommentCount    int64   `gorm:"column:comment_count" json:"comment_count" form:"comment_count"`
1533
+	AuditStatus     int64   `gorm:"column:audit_status" json:"audit_status" form:"audit_status"`
1534
+	Status          int64   `gorm:"column:status" json:"status" form:"status"`
1535
+	Ctime           int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
1536
+	Mtime           int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
1537
+	StoryNo         int64   `gorm:"column:story_no" json:"story_no" form:"story_no"`
1538
+	Round           int64   `gorm:"column:round" json:"round" form:"round"`
1539
+	Reason          string  `gorm:"column:reason" json:"reason" form:"reason"`
1540
+	ReadWx          int64   `gorm:"column:read_wx" json:"read_wx" form:"read_wx"`
1541
+	ReadApp         int64   `gorm:"column:read_app" json:"read_app" form:"read_app"`
1542
+	ReadPc          int64   `gorm:"column:read_pc" json:"read_pc" form:"read_pc"`
1543
+	PingweiNum      int64   `gorm:"column:pingwei_num" json:"pingwei_num" form:"pingwei_num"`
1544
+}
1545
+
1546
+func (SybStory) TableName() string {
1547
+	return "syb_story"
1548
+}

+ 35 - 0
models/service/db.go View File

@@ -41,6 +41,9 @@ var writeSgjPatientDb *gorm.DB
41 41
 var readUserDbT *gorm.DB
42 42
 var writeUserDbT *gorm.DB
43 43
 
44
+var readSwsDb *gorm.DB
45
+var writeSwsDb *gorm.DB
46
+
44 47
 var err error
45 48
 
46 49
 func ConnectDB() {
@@ -116,6 +119,18 @@ func ConnectDB() {
116 119
 	writeUserPassT := beego.AppConfig.String("writeuserpassTest")
117 120
 	writeUserNameT := beego.AppConfig.String("writeusernameTest")
118 121
 
122
+	readSwsHost := beego.AppConfig.String("readswshost")
123
+	readSwsPort := beego.AppConfig.String("readswsport")
124
+	readSwsUser := beego.AppConfig.String("readswsuser")
125
+	readSwsPass := beego.AppConfig.String("readswspass")
126
+	readSwsName := beego.AppConfig.String("readswsname")
127
+
128
+	writeSwsHost := beego.AppConfig.String("writeswshost")
129
+	writeSwsPort := beego.AppConfig.String("writeswsport")
130
+	writeSwsUser := beego.AppConfig.String("writeswsuser")
131
+	writeSwsPass := beego.AppConfig.String("writeswspass")
132
+	writeSwsName := beego.AppConfig.String("writeswsname")
133
+
119 134
 	rdsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", readUser, readPass, readHost, readPort, readName)
120 135
 	wdsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", writeUser, writePass, writeHost, writePort, writeName)
121 136
 
@@ -134,7 +149,11 @@ func ConnectDB() {
134 149
 	rudsnT := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", readUserUserT, readUserPassT, readUserHostT, readUserPortT, readUserNameT)
135 150
 	wudsnT := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", writeUserUserT, writeUserPassT, writeUserHostT, writeUserPortT, writeUserNameT)
136 151
 
152
+	rsdsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", readSwsUser, readSwsPass, readSwsHost, readSwsPort, readSwsName)
153
+	wsdsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", writeSwsUser, writeSwsPass, writeSwsHost, writeSwsPort, writeSwsName)
154
+
137 155
 	readDb, err = gorm.Open("mysql", rdsn)
156
+
138 157
 	if err != nil {
139 158
 		//beego.Error(err)
140 159
 	}
@@ -229,6 +248,22 @@ func ConnectDB() {
229 248
 	writeSgjPatientDb.DB().SetMaxIdleConns(10)
230 249
 	writeSgjPatientDb.DB().SetMaxOpenConns(100)
231 250
 	writeSgjPatientDb.LogMode(true)
251
+
252
+	readSwsDb, err = gorm.Open("mysql", rsdsn)
253
+	if err != nil {
254
+		//beego.Error(err)
255
+	}
256
+	readSwsDb.DB().SetMaxIdleConns(10)
257
+	readSwsDb.DB().SetMaxOpenConns(100)
258
+	readSwsDb.LogMode(true)
259
+
260
+	writeSwsDb, err = gorm.Open("mysql", wsdsn)
261
+	if err != nil {
262
+		//beego.Error(err)
263
+	}
264
+	writeSwsDb.DB().SetMaxIdleConns(10)
265
+	writeSwsDb.DB().SetMaxOpenConns(100)
266
+	writeSwsDb.LogMode(true)
232 267
 }
233 268
 
234 269
 //func DisconnectDB() {

+ 14 - 0
service/xcx_mobile_api_service.go View File

@@ -612,3 +612,17 @@ func GetInsepctionList(patientid int64, startime int64, endtime int64) (inspecti
612 612
 	err = db.Group("x.id").Select("x.id,x.patient_id,x.org_id,x.project_id,x.item_id,x.item_name,x.project_name,x.inspect_type,x.inspect_value,x.inspect_date,x.status,x.created_time,x.updated_time,r.range_type,r.range_min,r.range_max,r.range_value,r.range_options,r.unit").Joins("left join xt_inspection_reference as r on (r.item_id = x.item_id AND r.org_id > 0) OR ( x.item_id = r.id AND r.org_id = 0)   ").Scan(&inspection).Error
613 613
 	return inspection, err
614 614
 }
615
+
616
+func GetArticList(activityID int64, page int64, limit int64) (story []*models.SybStory, total int64, err error) {
617
+
618
+	offset := (page - 1) * limit
619
+	err = UserReadDB().Model(&story).Where("activity_id = ? and  audit_status = 2", activityID).Count(&total).Order("ctime desc").Offset(offset).Limit(limit).Find(&story).Error
620
+	return story, total, err
621
+}
622
+
623
+func GetArticListDetail(id int64) (models.SybStory, error) {
624
+
625
+	story := models.SybStory{}
626
+	err := UserReadDB().Where("id = ?", id).Find(&story).Error
627
+	return story, err
628
+}