|
@@ -108,6 +108,18 @@ func HisManagerApiRegistRouters() {
|
108
|
108
|
|
109
|
109
|
beego.Router("/api/getallgoodinforlist", &HisApiController{}, "Get:GetAllGoodInforList")
|
110
|
110
|
|
|
111
|
+ beego.Router("/api/savegoodlist", &HisApiController{}, "Post:SaveGoodList")
|
|
112
|
+
|
|
113
|
+ beego.Router("/api/getgoodlist", &HisApiController{}, "Get:GetGoodList")
|
|
114
|
+
|
|
115
|
+ beego.Router("/api/getgoodnamedetail", &HisApiController{}, "Get:GetGoodNameDetail")
|
|
116
|
+
|
|
117
|
+ beego.Router("/api/updategoodlist", &HisApiController{}, "Post:UpdateGoodList")
|
|
118
|
+
|
|
119
|
+ beego.Router("/api/deletegoodteam", &HisApiController{}, "Get:DeleteGoodTeam")
|
|
120
|
+
|
|
121
|
+ beego.Router("/api/deletegood", &HisApiController{}, "Get:DeleteGood")
|
|
122
|
+
|
111
|
123
|
}
|
112
|
124
|
|
113
|
125
|
func (c *HisApiController) CheckHisPatient() {
|
|
@@ -14187,3 +14199,190 @@ func (c *HisApiController) GetAllGoodInforList() {
|
14187
|
14199
|
})
|
14188
|
14200
|
return
|
14189
|
14201
|
}
|
|
14202
|
+
|
|
14203
|
+func (this *HisApiController) SaveGoodList() {
|
|
14204
|
+
|
|
14205
|
+ project_name := this.GetString("project_name")
|
|
14206
|
+ sort, _ := this.GetInt64("sort")
|
|
14207
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
|
14208
|
+
|
|
14209
|
+ dataBody := make(map[string]interface{}, 0)
|
|
14210
|
+ err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
|
|
14211
|
+ if err != nil {
|
|
14212
|
+ utils.ErrorLog(err.Error())
|
|
14213
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
14214
|
+ return
|
|
14215
|
+ }
|
|
14216
|
+
|
|
14217
|
+ goodTeam := models.XtGoodTeam{
|
|
14218
|
+ ProjectName: project_name,
|
|
14219
|
+ Sort: sort,
|
|
14220
|
+ UserOrgId: orgId,
|
|
14221
|
+ Status: 1,
|
|
14222
|
+ Ctime: time.Now().Unix(),
|
|
14223
|
+ Mtime: time.Now().Unix(),
|
|
14224
|
+ }
|
|
14225
|
+
|
|
14226
|
+ service.CreateGoodTeam(goodTeam)
|
|
14227
|
+
|
|
14228
|
+ lastGoodTeam, _ := service.GetLastGoodTeam(orgId)
|
|
14229
|
+
|
|
14230
|
+ if dataBody["info"] != nil && reflect.TypeOf(dataBody["info"]).String() == "[]interface {}" {
|
|
14231
|
+ infos, _ := dataBody["info"].([]interface{})
|
|
14232
|
+ if len(infos) > 0 {
|
|
14233
|
+ for _, item := range infos {
|
|
14234
|
+ items := item.(map[string]interface{})
|
|
14235
|
+ if items["good_id"] == nil || reflect.TypeOf(items["good_id"]).String() != "float64" {
|
|
14236
|
+ utils.ErrorLog("good_id")
|
|
14237
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
14238
|
+ return
|
|
14239
|
+ }
|
|
14240
|
+ good_id := int64(items["good_id"].(float64))
|
|
14241
|
+
|
|
14242
|
+ if items["number"] == nil || reflect.TypeOf(items["number"]).String() != "float64" {
|
|
14243
|
+ utils.ErrorLog("number")
|
|
14244
|
+ }
|
|
14245
|
+
|
|
14246
|
+ number := int64(items["number"].(float64))
|
|
14247
|
+
|
|
14248
|
+ xtGoodTeamList := models.XtGoodTeamList{
|
|
14249
|
+ GoodId: good_id,
|
|
14250
|
+ Count: number,
|
|
14251
|
+ TeamId: lastGoodTeam.ID,
|
|
14252
|
+ UserOrgId: orgId,
|
|
14253
|
+ Status: 1,
|
|
14254
|
+ Ctime: time.Now().Unix(),
|
|
14255
|
+ Mtime: time.Now().Unix(),
|
|
14256
|
+ }
|
|
14257
|
+
|
|
14258
|
+ service.CreateGoodList(xtGoodTeamList)
|
|
14259
|
+ }
|
|
14260
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
14261
|
+ "lastGoodTeam": lastGoodTeam,
|
|
14262
|
+ })
|
|
14263
|
+ }
|
|
14264
|
+ }
|
|
14265
|
+ return
|
|
14266
|
+}
|
|
14267
|
+
|
|
14268
|
+func (this *HisApiController) GetGoodList() {
|
|
14269
|
+
|
|
14270
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
|
14271
|
+ limit, _ := this.GetInt64("limit")
|
|
14272
|
+ page, _ := this.GetInt64("page")
|
|
14273
|
+ keyword := this.GetString("keyword")
|
|
14274
|
+ list, total, _ := service.GetGoodList(orgId, limit, page, keyword)
|
|
14275
|
+
|
|
14276
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
14277
|
+ "list": list,
|
|
14278
|
+ "total": total,
|
|
14279
|
+ })
|
|
14280
|
+}
|
|
14281
|
+
|
|
14282
|
+func (this *HisApiController) GetGoodNameDetail() {
|
|
14283
|
+
|
|
14284
|
+ id, _ := this.GetInt64("id")
|
|
14285
|
+
|
|
14286
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
|
14287
|
+ goodNameDetail, _ := service.GetGoodNameDetail(id, orgId)
|
|
14288
|
+ goodList, _ := service.GetAllGoodList(orgId)
|
|
14289
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
14290
|
+ "goodNameDetail": goodNameDetail,
|
|
14291
|
+ "goodList": goodList,
|
|
14292
|
+ })
|
|
14293
|
+}
|
|
14294
|
+
|
|
14295
|
+func (this *HisApiController) UpdateGoodList() {
|
|
14296
|
+
|
|
14297
|
+ project_name := this.GetString("project_name")
|
|
14298
|
+ sort, _ := this.GetInt64("sort")
|
|
14299
|
+ id, _ := this.GetInt64("id")
|
|
14300
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
|
14301
|
+
|
|
14302
|
+ dataBody := make(map[string]interface{}, 0)
|
|
14303
|
+ err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
|
|
14304
|
+ if err != nil {
|
|
14305
|
+ utils.ErrorLog(err.Error())
|
|
14306
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
14307
|
+ return
|
|
14308
|
+ }
|
|
14309
|
+
|
|
14310
|
+ goodTeam := models.XtGoodTeam{
|
|
14311
|
+ ProjectName: project_name,
|
|
14312
|
+ Sort: sort,
|
|
14313
|
+ UserOrgId: orgId,
|
|
14314
|
+ Status: 1,
|
|
14315
|
+ Ctime: time.Now().Unix(),
|
|
14316
|
+ Mtime: time.Now().Unix(),
|
|
14317
|
+ ID: id,
|
|
14318
|
+ }
|
|
14319
|
+
|
|
14320
|
+ service.SaveGoodTeam(goodTeam)
|
|
14321
|
+
|
|
14322
|
+ lastGoodTeam, _ := service.GetLastGoodTeam(orgId)
|
|
14323
|
+
|
|
14324
|
+ if dataBody["info"] != nil && reflect.TypeOf(dataBody["info"]).String() == "[]interface {}" {
|
|
14325
|
+ infos, _ := dataBody["info"].([]interface{})
|
|
14326
|
+ if len(infos) > 0 {
|
|
14327
|
+ for _, item := range infos {
|
|
14328
|
+ items := item.(map[string]interface{})
|
|
14329
|
+ if items["good_id"] == nil || reflect.TypeOf(items["good_id"]).String() != "float64" {
|
|
14330
|
+ utils.ErrorLog("good_id")
|
|
14331
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
14332
|
+ return
|
|
14333
|
+ }
|
|
14334
|
+ good_id := int64(items["good_id"].(float64))
|
|
14335
|
+
|
|
14336
|
+ if items["id"] == nil || reflect.TypeOf(items["id"]).String() != "float64" {
|
|
14337
|
+ utils.ErrorLog("id")
|
|
14338
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
14339
|
+ return
|
|
14340
|
+ }
|
|
14341
|
+ id := int64(items["id"].(float64))
|
|
14342
|
+
|
|
14343
|
+ if items["number"] == nil || reflect.TypeOf(items["number"]).String() != "float64" {
|
|
14344
|
+ utils.ErrorLog("number")
|
|
14345
|
+ }
|
|
14346
|
+
|
|
14347
|
+ number := int64(items["number"].(float64))
|
|
14348
|
+
|
|
14349
|
+ xtGoodTeamList := models.XtGoodTeamList{
|
|
14350
|
+ ID: id,
|
|
14351
|
+ GoodId: good_id,
|
|
14352
|
+ Count: number,
|
|
14353
|
+ TeamId: lastGoodTeam.ID,
|
|
14354
|
+ UserOrgId: orgId,
|
|
14355
|
+ Status: 1,
|
|
14356
|
+ Ctime: time.Now().Unix(),
|
|
14357
|
+ Mtime: time.Now().Unix(),
|
|
14358
|
+ }
|
|
14359
|
+
|
|
14360
|
+ service.SaveGoodList(xtGoodTeamList)
|
|
14361
|
+ }
|
|
14362
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
14363
|
+ "lastGoodTeam": lastGoodTeam,
|
|
14364
|
+ })
|
|
14365
|
+ }
|
|
14366
|
+ }
|
|
14367
|
+ return
|
|
14368
|
+}
|
|
14369
|
+
|
|
14370
|
+func (this *HisApiController) DeleteGoodTeam() {
|
|
14371
|
+
|
|
14372
|
+ id, _ := this.GetInt64("id")
|
|
14373
|
+ team, _ := service.DeleteGoodTeam(id)
|
|
14374
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
14375
|
+ "team": team,
|
|
14376
|
+ })
|
|
14377
|
+}
|
|
14378
|
+
|
|
14379
|
+func (this *HisApiController) DeleteGood() {
|
|
14380
|
+
|
|
14381
|
+ id, _ := this.GetInt64("id")
|
|
14382
|
+
|
|
14383
|
+ good, _ := service.DeleteGood(id)
|
|
14384
|
+
|
|
14385
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
14386
|
+ "good": good,
|
|
14387
|
+ })
|
|
14388
|
+}
|