|
@@ -13,6 +13,9 @@ import (
|
13
|
13
|
"time"
|
14
|
14
|
"strings"
|
15
|
15
|
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
16
|
19
|
func siteRouters() {
|
17
|
20
|
beego.Router("/api/site/addrotationchart",&Microwebsite{},"Post:AddRotaionChart")
|
18
|
21
|
beego.Router("/api/site/savehispital",&Microwebsite{},"Post:SaveHispital")
|
|
@@ -46,6 +49,13 @@ func siteRouters() {
|
46
|
49
|
beego.Router("/api/site/editdoctor",&Microwebsite{},"Get:Editdoctor")
|
47
|
50
|
beego.Router("/api/site/savedocinfo",&Microwebsite{},"Post:SaveDocInfo")
|
48
|
51
|
beego.Router("/api/site/deletedoctor",&Microwebsite{},"Get:DeleteDoctor")
|
|
52
|
+ beego.Router("/api/site/edithospital",&Microwebsite{},"Get:EditHospital")
|
|
53
|
+ beego.Router("/api/site/savehostpital",&Microwebsite{},"Post:SaveHospital")
|
|
54
|
+ beego.Router("api/site/editoffice",&Microwebsite{},"Get:EditOffice")
|
|
55
|
+ beego.Router("/api/site/deletemodlebyid",&Microwebsite{},"Get:Deletemodlebyid")
|
|
56
|
+ beego.Router("/api/site/saveoffice",&Microwebsite{},"Post:SaveOffice")
|
|
57
|
+ beego.Router("/api/site/gethospital",&Microwebsite{},"Post:GetHospital")
|
|
58
|
+ beego.Router("/api/site/getdata",&Microwebsite{},"Post:GetData")
|
49
|
59
|
}
|
50
|
60
|
|
51
|
61
|
type Microwebsite struct {
|
|
@@ -92,6 +102,7 @@ func (this *Microwebsite) AddRotaionChart() {
|
92
|
102
|
UserOrgId: userOrgID,
|
93
|
103
|
Status: 1,
|
94
|
104
|
Ctime: time.Now().Unix(),
|
|
105
|
+ ModeType: 1,
|
95
|
106
|
}
|
96
|
107
|
//fmt.Println(model)
|
97
|
108
|
site_service.AddPatientModel(&model)
|
|
@@ -157,6 +168,7 @@ func (this *Microwebsite) SaveHispital() {
|
157
|
168
|
UserOrgId: userOrgID,
|
158
|
169
|
Ctime: time.Now().Unix(),
|
159
|
170
|
Status: 1,
|
|
171
|
+ ModeType: 2,
|
160
|
172
|
}
|
161
|
173
|
|
162
|
174
|
site_service.AddPatientModel(&model)
|
|
@@ -223,6 +235,7 @@ func (this *Microwebsite) AddOffices() {
|
223
|
235
|
UserOrgId: userOrgID,
|
224
|
236
|
Ctime: time.Now().Unix(),
|
225
|
237
|
Status: 1,
|
|
238
|
+ ModeType: 3,
|
226
|
239
|
}
|
227
|
240
|
|
228
|
241
|
site_service.AddPatientModel(&model)
|
|
@@ -288,6 +301,7 @@ func (this *Microwebsite) AddDoctor() {
|
288
|
301
|
UserOrgId: userOrgID,
|
289
|
302
|
Ctime: time.Now().Unix(),
|
290
|
303
|
Status: 1,
|
|
304
|
+ ModeType: 4,
|
291
|
305
|
}
|
292
|
306
|
|
293
|
307
|
site_service.AddPatientModel(&model)
|
|
@@ -301,6 +315,7 @@ func (this *Microwebsite) AddDoctor() {
|
301
|
315
|
Ctime:time.Now().Unix(),
|
302
|
316
|
Status:1,
|
303
|
317
|
Modelid:patientModel.ID,
|
|
318
|
+
|
304
|
319
|
}
|
305
|
320
|
|
306
|
321
|
err = site_service.AddDoctor(doctor)
|
|
@@ -412,21 +427,13 @@ func (this *Microwebsite) AddKeEnvironment() {
|
412
|
427
|
replace := strings.Replace(strings.Trim(fmt.Sprint(keImages), "[]"), " ", ",", -1)
|
413
|
428
|
fmt.Println("图片:",keImages)
|
414
|
429
|
fmt.Println("字符串",replace)
|
415
|
|
- //offenvironment := models.SgjPatientOffenvironment{
|
416
|
|
- // Title: title,
|
417
|
|
- // Sort: sortt,
|
418
|
|
- // Keimages: replace,
|
419
|
|
- // Mtime: time.Now().Unix(),
|
420
|
|
- // UserOrgId: userOrgID,
|
421
|
|
- // Status: 1,
|
422
|
|
- //}
|
423
|
|
-
|
424
|
430
|
model := models.SgjPatientModel{
|
425
|
431
|
Title: title,
|
426
|
432
|
Sort: sortt,
|
427
|
433
|
UserOrgId: userOrgID,
|
428
|
434
|
Ctime: time.Now().Unix(),
|
429
|
435
|
Status: 1,
|
|
436
|
+ ModeType: 5,
|
430
|
437
|
}
|
431
|
438
|
|
432
|
439
|
site_service.AddPatientModel(&model)
|
|
@@ -505,7 +512,6 @@ func (this * Microwebsite) GetDoctorInfo() {
|
505
|
512
|
adminUserInfo := this.GetAdminUserInfo()
|
506
|
513
|
userOrgID := int64(adminUserInfo.CurrentOrgId)
|
507
|
514
|
doc, err := site_service.GetDoctorInfo(userOrgID)
|
508
|
|
- fmt.Println("doc是什么",doc)
|
509
|
515
|
if err !=nil{
|
510
|
516
|
this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取名医介绍失败")
|
511
|
517
|
return
|
|
@@ -546,6 +552,8 @@ func (this * Microwebsite) GetOffEnvironment() {
|
546
|
552
|
adminUserInfo := this.GetAdminUserInfo()
|
547
|
553
|
userOrgID := int64(adminUserInfo.CurrentOrgId)
|
548
|
554
|
offenvironment, err := site_service.GetOffEnvironment(userOrgID)
|
|
555
|
+ fmt.Println("错误是什么",err)
|
|
556
|
+ fmt.Println("科室环境数据",offenvironment)
|
549
|
557
|
if err !=nil{
|
550
|
558
|
this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取名医介绍失败")
|
551
|
559
|
return
|
|
@@ -1132,4 +1140,214 @@ func (this *Microwebsite) DeleteDoctor() {
|
1132
|
1140
|
returnData["msg"] = "ok"
|
1133
|
1141
|
this.ServeSuccessJSON(returnData)
|
1134
|
1142
|
return
|
1135
|
|
-}
|
|
1143
|
+}
|
|
1144
|
+
|
|
1145
|
+func (this *Microwebsite) EditHospital() {
|
|
1146
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
1147
|
+ id, _ := this.GetInt64("id")
|
|
1148
|
+ fmt.Println("保存id是啥?",id)
|
|
1149
|
+ userOrgID := int64(adminUserInfo.CurrentOrgId)
|
|
1150
|
+ hospital, err := site_service.EditHospital(id, userOrgID)
|
|
1151
|
+ fmt.Println("参训是什么",hospital)
|
|
1152
|
+ fmt.Println(err)
|
|
1153
|
+ if err !=nil{
|
|
1154
|
+ this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
|
|
1155
|
+ return
|
|
1156
|
+ }
|
|
1157
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1158
|
+ "hospital":hospital,
|
|
1159
|
+ })
|
|
1160
|
+}
|
|
1161
|
+
|
|
1162
|
+func (this *Microwebsite) SaveHospital() {
|
|
1163
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
1164
|
+ id, _ := this.GetInt64("id")
|
|
1165
|
+ fmt.Println("保存id是啥?",id)
|
|
1166
|
+ userOrgID := int64(adminUserInfo.CurrentOrgId)
|
|
1167
|
+ fmt.Println(userOrgID)
|
|
1168
|
+ dataBody := make(map[string]interface{}, 0)
|
|
1169
|
+ err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
|
|
1170
|
+ if err != nil {
|
|
1171
|
+ utils.ErrorLog(err.Error())
|
|
1172
|
+ this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
|
|
1173
|
+ return
|
|
1174
|
+ }
|
|
1175
|
+
|
|
1176
|
+ title := dataBody["title"].(string)
|
|
1177
|
+ if len(title) == 0 {
|
|
1178
|
+ this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
|
|
1179
|
+ return
|
|
1180
|
+ }
|
|
1181
|
+ fmt.Println("标题:", title)
|
|
1182
|
+
|
|
1183
|
+ sort := int64(dataBody["sort"].(float64))
|
|
1184
|
+ fmt.Println("sort是神",sort)
|
|
1185
|
+ if sort <= 0 {
|
|
1186
|
+ this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
|
|
1187
|
+ return
|
|
1188
|
+ }
|
|
1189
|
+ fmt.Println("排序:", sort)
|
|
1190
|
+ introduction := dataBody["introduction"].(string)
|
|
1191
|
+ if len(introduction) == 0 {
|
|
1192
|
+ this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
|
|
1193
|
+ return
|
|
1194
|
+ }
|
|
1195
|
+
|
|
1196
|
+ modleid := int64(dataBody["modleid"].(float64))
|
|
1197
|
+ if modleid <= 0 {
|
|
1198
|
+ this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块ID不能为空")
|
|
1199
|
+ return
|
|
1200
|
+ }
|
|
1201
|
+ fmt.Println("模块id",modleid)
|
|
1202
|
+ hospital := models.SgjPatientHospital{
|
|
1203
|
+ Title: title,
|
|
1204
|
+ Sort: sort,
|
|
1205
|
+ Introduction: introduction,
|
|
1206
|
+ }
|
|
1207
|
+ err = site_service.UpdateHospital(id, userOrgID, hospital)
|
|
1208
|
+
|
|
1209
|
+ model := models.SgjPatientModel{
|
|
1210
|
+ Title: title,
|
|
1211
|
+ Sort: sort,
|
|
1212
|
+ }
|
|
1213
|
+ fmt.Println(hospital)
|
|
1214
|
+ Modelerr := site_service.UpdateModel(modleid, userOrgID, model)
|
|
1215
|
+ fmt.Println("错误是什么",Modelerr)
|
|
1216
|
+ fmt.Println("错误是什么",err)
|
|
1217
|
+ if err !=nil{
|
|
1218
|
+ this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
|
|
1219
|
+ return
|
|
1220
|
+ }
|
|
1221
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1222
|
+ "hospital":hospital,
|
|
1223
|
+ "model":model,
|
|
1224
|
+ })
|
|
1225
|
+}
|
|
1226
|
+
|
|
1227
|
+func (this *Microwebsite) EditOffice() {
|
|
1228
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
1229
|
+ id, _ := this.GetInt64("id")
|
|
1230
|
+ fmt.Println("保存id是啥?",id)
|
|
1231
|
+ userOrgID := int64(adminUserInfo.CurrentOrgId)
|
|
1232
|
+ offices, err := site_service.EditOffice(id, userOrgID)
|
|
1233
|
+ if err !=nil{
|
|
1234
|
+ this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
|
|
1235
|
+ return
|
|
1236
|
+ }
|
|
1237
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1238
|
+ "offices":offices,
|
|
1239
|
+ })
|
|
1240
|
+}
|
|
1241
|
+
|
|
1242
|
+func (this *Microwebsite) Deletemodlebyid() {
|
|
1243
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
1244
|
+ id, _ := this.GetInt64("id")
|
|
1245
|
+ fmt.Println("保存id是啥?",id)
|
|
1246
|
+ userOrgID := int64(adminUserInfo.CurrentOrgId)
|
|
1247
|
+ err := site_service.DeletemodleById(id, userOrgID)
|
|
1248
|
+ modelid := site_service.DeleteHospitalByModelid(id, userOrgID)
|
|
1249
|
+ byModelid := site_service.DeleteOfficeByModelid(id, userOrgID)
|
|
1250
|
+ fmt.Println(modelid,byModelid)
|
|
1251
|
+ if err !=nil{
|
|
1252
|
+ this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除成功")
|
|
1253
|
+ return
|
|
1254
|
+ }
|
|
1255
|
+ returnData := make(map[string]interface{}, 0)
|
|
1256
|
+ returnData["msg"] = "ok"
|
|
1257
|
+ this.ServeSuccessJSON(returnData)
|
|
1258
|
+ return
|
|
1259
|
+}
|
|
1260
|
+
|
|
1261
|
+func (this *Microwebsite) SaveOffice() {
|
|
1262
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
1263
|
+ id, _ := this.GetInt64("id")
|
|
1264
|
+ fmt.Println("科室介绍id是啥?",id)
|
|
1265
|
+ userOrgID := int64(adminUserInfo.CurrentOrgId)
|
|
1266
|
+ fmt.Println(userOrgID)
|
|
1267
|
+ dataBody := make(map[string]interface{}, 0)
|
|
1268
|
+ err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
|
|
1269
|
+ if err != nil {
|
|
1270
|
+ utils.ErrorLog(err.Error())
|
|
1271
|
+ this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
|
|
1272
|
+ return
|
|
1273
|
+ }
|
|
1274
|
+
|
|
1275
|
+ title := dataBody["title"].(string)
|
|
1276
|
+ if len(title) == 0 {
|
|
1277
|
+ this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
|
|
1278
|
+ return
|
|
1279
|
+ }
|
|
1280
|
+ fmt.Println("标题:", title)
|
|
1281
|
+
|
|
1282
|
+ sort := int64(dataBody["sort"].(float64))
|
|
1283
|
+ fmt.Println("sort是神",sort)
|
|
1284
|
+ if sort <= 0 {
|
|
1285
|
+ this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
|
|
1286
|
+ return
|
|
1287
|
+ }
|
|
1288
|
+ fmt.Println("排序:", sort)
|
|
1289
|
+ introduction := dataBody["introduction"].(string)
|
|
1290
|
+ if len(introduction) == 0 {
|
|
1291
|
+ this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
|
|
1292
|
+ return
|
|
1293
|
+ }
|
|
1294
|
+
|
|
1295
|
+ modleid := int64(dataBody["modleid"].(float64))
|
|
1296
|
+ if modleid <= 0 {
|
|
1297
|
+ this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块ID不能为空")
|
|
1298
|
+ return
|
|
1299
|
+ }
|
|
1300
|
+ fmt.Println("模块ID",modleid)
|
|
1301
|
+
|
|
1302
|
+ offices := models.SgjPatientOffices{
|
|
1303
|
+ Title: title,
|
|
1304
|
+ Sort: sort,
|
|
1305
|
+ Introduction: introduction,
|
|
1306
|
+ }
|
|
1307
|
+ updateOffices := site_service.UpdateOffices(id, userOrgID, offices)
|
|
1308
|
+
|
|
1309
|
+ model := models.SgjPatientModel{
|
|
1310
|
+ Title: title,
|
|
1311
|
+ Sort: sort,
|
|
1312
|
+ }
|
|
1313
|
+ updateModel := site_service.UpdateModel(modleid, userOrgID, model)
|
|
1314
|
+ fmt.Println(updateModel)
|
|
1315
|
+ if updateOffices !=nil{
|
|
1316
|
+ this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
|
|
1317
|
+ return
|
|
1318
|
+ }
|
|
1319
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1320
|
+ "offices":offices,
|
|
1321
|
+ "model":model,
|
|
1322
|
+ })
|
|
1323
|
+}
|
|
1324
|
+
|
|
1325
|
+func (this *Microwebsite) GetHospital() {
|
|
1326
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
1327
|
+ userOrgID := int64(adminUserInfo.CurrentOrgId)
|
|
1328
|
+
|
|
1329
|
+ hostital, err := site_service.GetHospital(userOrgID)
|
|
1330
|
+
|
|
1331
|
+ if err !=nil{
|
|
1332
|
+ this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
|
|
1333
|
+ return
|
|
1334
|
+ }
|
|
1335
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1336
|
+ "hostital":hostital,
|
|
1337
|
+ })
|
|
1338
|
+}
|
|
1339
|
+
|
|
1340
|
+func (this *Microwebsite) GetData() {
|
|
1341
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
1342
|
+ userOrgID := int64(adminUserInfo.CurrentOrgId)
|
|
1343
|
+ fmt.Println("机构ID" ,userOrgID)
|
|
1344
|
+ model, err := site_service.GetData(userOrgID)
|
|
1345
|
+ fmt.Println("错误是什么",err)
|
|
1346
|
+ if err !=nil{
|
|
1347
|
+ this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
|
|
1348
|
+ return
|
|
1349
|
+ }
|
|
1350
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1351
|
+ "patientModels":model,
|
|
1352
|
+ })
|
|
1353
|
+}
|