|
@@ -3176,175 +3176,175 @@ func GetNowTime() (int64, int64) {
|
3176
|
3176
|
// })
|
3177
|
3177
|
// }
|
3178
|
3178
|
//}
|
3179
|
|
-func (c *HisApiController) ChangeDrugfour() {
|
3180
|
|
- patient_id, _ := c.GetInt64("patient_id")
|
3181
|
|
- admin_user_id, _ := c.GetInt64("admin_user_id")
|
3182
|
|
- //id_arr := strings.Split(ids, ",")
|
3183
|
|
- times := c.GetString("time", "")
|
3184
|
|
- timeLayout := "2006-01-02"
|
3185
|
|
- loc, _ := time.LoadLocation("Local")
|
3186
|
|
- var stime, etime int64
|
3187
|
|
- if times == "" {
|
3188
|
|
- stime, etime = GetNowTime()
|
3189
|
|
- } else {
|
3190
|
|
- stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
|
3191
|
|
- stime = stmp.Unix()
|
3192
|
|
- etime = stime + 86399
|
3193
|
|
- }
|
3194
|
|
- advicelist, _ := service.FindeHisAdviceDocAdvice(c.GetAdminUserInfo().CurrentOrgId, patient_id, stime, etime)
|
3195
|
|
- var flows []*models.DrugFlow
|
3196
|
|
- for _, item := range advicelist {
|
3197
|
|
- flow, _ := service.GetNewDrugFlowInfoByPatient(patient_id, item.DrugId, times, c.GetAdminUserInfo().CurrentOrgId)
|
3198
|
|
- flows = append(flows, flow...)
|
3199
|
|
- }
|
3200
|
|
- roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
|
3201
|
|
- miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
|
3202
|
|
- var err []string
|
3203
|
|
-
|
3204
|
|
- for _, item := range flows {
|
3205
|
|
- var res3 ResultSix
|
3206
|
|
- if item.ConsumableType == 3 { //3为自动出库 7为自动退库
|
3207
|
|
- prescription := service.GetHisPrescriptionByID(item.HisDoctorAdviceInfo.PrescriptionId)
|
3208
|
|
- if prescription.OrderStatus == 2 {
|
3209
|
|
- //已经结算
|
3210
|
|
- //判断是否已经销售
|
3211
|
|
- if item.IsSale == 1 { //是否已经销售,1是 0否
|
3212
|
|
- //是否已经变更 1是 0否
|
3213
|
|
- if item.IsChange == 0 { //没变更,进行变更操作
|
3214
|
|
- bg_number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3502"
|
3215
|
|
-
|
3216
|
|
- result, result2 := ChangeStock(item.Count, item, miConfig, "102", roles, bg_number)
|
3217
|
|
- saveLog(result, result2, "3502", "自动出库,已经销售,未变更3502")
|
3218
|
|
- var respJSON3 map[string]interface{}
|
3219
|
|
- if err := json.Unmarshal([]byte(string(result)), &respJSON3); err != nil {
|
3220
|
|
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
3221
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
3222
|
|
- return
|
3223
|
|
- }
|
3224
|
|
- userJSONBytes3, _ := json.Marshal(respJSON3)
|
3225
|
|
- if err := json.Unmarshal(userJSONBytes3, &res3); err != nil {
|
3226
|
|
- utils.ErrorLog("解析失败:%v", err)
|
3227
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
3228
|
|
- return
|
3229
|
|
- }
|
3230
|
|
- if res3.Infcode == 0 {
|
3231
|
|
- item.IsChange = 1
|
3232
|
|
- item.BgBchno = bg_number
|
3233
|
|
- service.SaveDF2(item)
|
3234
|
|
- } else {
|
3235
|
|
-
|
3236
|
|
- err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售变更失败:"+res3.ErrMsg)
|
3237
|
|
- }
|
3238
|
|
- }
|
3239
|
|
- } else { //没销售,
|
3240
|
|
- var res FJ3507Result
|
3241
|
|
- var res3507for10188 FJ3507ResultFor10188
|
3242
|
|
- number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3505"
|
3243
|
|
-
|
3244
|
|
- //进行商品销售接口
|
3245
|
|
- result3, result4 := SaleStock(c.GetAdminUserInfo().CurrentOrgId, prescription, item, miConfig, "", roles, number)
|
3246
|
|
- saveLog(result3, result4, "3505", "自动出库,未销售进行销售行为,3505")
|
3247
|
|
- var respJSON3 map[string]interface{}
|
3248
|
|
- if err := json.Unmarshal([]byte(string(result3)), &respJSON3); err != nil {
|
3249
|
|
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
3250
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
3251
|
|
- return
|
3252
|
|
- }
|
3253
|
|
- userJSONBytes3, _ := json.Marshal(respJSON3)
|
3254
|
|
- if c.GetAdminUserInfo().CurrentOrgId == 10188 || c.GetAdminUserInfo().CurrentOrgId == 10217 {
|
3255
|
|
- if err := json.Unmarshal(userJSONBytes3, &res3507for10188); err != nil {
|
3256
|
|
- utils.ErrorLog("解析失败:%v", err)
|
3257
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
3258
|
|
- return
|
3259
|
|
- }
|
3260
|
|
- //if res3507for10188.Infcode
|
3261
|
|
- res.InfRefmsgid = res3507for10188.InfRefmsgid
|
3262
|
|
- //res.Output = resSix10265.Output
|
3263
|
|
- res.ErrMsg = res3507for10188.ErrMsg
|
3264
|
|
- res.Cainfo = res3507for10188.Cainfo
|
3265
|
|
- res.WarnMsg = res3507for10188.WarnMsg
|
3266
|
|
- infocode, _ := strconv.ParseInt(res3507for10188.Infcode, 10, 64)
|
3267
|
|
- res.Infcode = infocode
|
3268
|
|
- } else {
|
3269
|
|
- if err := json.Unmarshal(userJSONBytes3, &res); err != nil {
|
3270
|
|
- utils.ErrorLog("解析失败:%v", err)
|
3271
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
3272
|
|
- return
|
3273
|
|
- }
|
3274
|
|
-
|
3275
|
|
- }
|
3276
|
|
- if res.Infcode == 0 {
|
3277
|
|
- item.IsSale = 1
|
3278
|
|
- item.Bchno = number
|
3279
|
|
- item.SaleDate = time.Now().Format("2006-01-02")
|
3280
|
|
-
|
3281
|
|
- err5 := service.SaveDF(item)
|
3282
|
|
- if err5 == nil {
|
3283
|
|
- if item.IsChange == 0 { //没变更,进行变更操作
|
3284
|
|
- bg_number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3502"
|
3285
|
|
-
|
3286
|
|
- result, result2 := ChangeStock(item.Count, item, miConfig, "102", roles, bg_number)
|
3287
|
|
- saveLog(result, result2, "3502", "自动出库,没销售,未变更3502")
|
3288
|
|
-
|
3289
|
|
- var respJSON3 map[string]interface{}
|
3290
|
|
- if err := json.Unmarshal([]byte(string(result)), &respJSON3); err != nil {
|
3291
|
|
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
3292
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
3293
|
|
- return
|
3294
|
|
- }
|
3295
|
|
- if c.GetAdminUserInfo().CurrentOrgId == 10188 || c.GetAdminUserInfo().CurrentOrgId == 10217 {
|
3296
|
|
- if err := json.Unmarshal(userJSONBytes3, &res3507for10188); err != nil {
|
3297
|
|
- utils.ErrorLog("解析失败:%v", err)
|
3298
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
3299
|
|
- return
|
3300
|
|
- }
|
3301
|
|
- //if res3507for10188.Infcode
|
3302
|
|
- res3.InfRefmsgid = res3507for10188.InfRefmsgid
|
3303
|
|
- //res.Output = resSix10265.Output
|
3304
|
|
- res3.ErrMsg = res3507for10188.ErrMsg
|
3305
|
|
- res3.Cainfo = res3507for10188.Cainfo
|
3306
|
|
- res3.WarnMsg = res3507for10188.WarnMsg
|
3307
|
|
- infocode, _ := strconv.ParseInt(res3507for10188.Infcode, 10, 64)
|
3308
|
|
- res3.Infcode = infocode
|
3309
|
|
- } else {
|
3310
|
|
- if err := json.Unmarshal(userJSONBytes3, &res3); err != nil {
|
3311
|
|
- utils.ErrorLog("解析失败:%v", err)
|
3312
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
3313
|
|
- return
|
3314
|
|
- }
|
3315
|
|
- }
|
3316
|
|
- if res3.Infcode == 0 {
|
3317
|
|
- item.IsChange = 1
|
3318
|
|
- item.BgBchno = bg_number
|
3319
|
|
- service.SaveDF2(item)
|
3320
|
|
- } else {
|
3321
|
|
-
|
3322
|
|
- err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售变更失败:"+res3.ErrMsg)
|
3323
|
|
- }
|
3324
|
|
- }
|
3325
|
|
- }
|
3326
|
|
- } else {
|
3327
|
|
-
|
3328
|
|
- err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售失败:"+res.ErrMsg)
|
3329
|
|
- }
|
3330
|
|
- }
|
3331
|
|
-
|
3332
|
|
- } else { //还没结,提示用户去结算,并药品追溯上传
|
3333
|
|
- err = append(err, item.HisDoctorAdviceInfo.AdviceName+"还没结算,请结算后,在药品追溯页面上传")
|
3334
|
|
- }
|
3335
|
|
- }
|
3336
|
|
- }
|
3337
|
|
- if len(err) == 0 {
|
3338
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
3339
|
|
- "msg": "销售变更成功",
|
3340
|
|
- })
|
3341
|
|
- } else {
|
3342
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
3343
|
|
- "failed_code": -10,
|
3344
|
|
- "msg": err,
|
3345
|
|
- })
|
3346
|
|
- }
|
3347
|
|
-}
|
|
3179
|
+//func (c *HisApiController) ChangeDrugfour() {
|
|
3180
|
+// patient_id, _ := c.GetInt64("patient_id")
|
|
3181
|
+// admin_user_id, _ := c.GetInt64("admin_user_id")
|
|
3182
|
+// //id_arr := strings.Split(ids, ",")
|
|
3183
|
+// times := c.GetString("time", "")
|
|
3184
|
+// timeLayout := "2006-01-02"
|
|
3185
|
+// loc, _ := time.LoadLocation("Local")
|
|
3186
|
+// var stime, etime int64
|
|
3187
|
+// if times == "" {
|
|
3188
|
+// stime, etime = GetNowTime()
|
|
3189
|
+// } else {
|
|
3190
|
+// stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
|
|
3191
|
+// stime = stmp.Unix()
|
|
3192
|
+// etime = stime + 86399
|
|
3193
|
+// }
|
|
3194
|
+// advicelist, _ := service.FindeHisAdviceDocAdvice(c.GetAdminUserInfo().CurrentOrgId, patient_id, stime, etime)
|
|
3195
|
+// var flows []*models.DrugFlow
|
|
3196
|
+// for _, item := range advicelist {
|
|
3197
|
+// flow, _ := service.GetNewDrugFlowInfoByPatient(patient_id, item.DrugId, times, c.GetAdminUserInfo().CurrentOrgId)
|
|
3198
|
+// flows = append(flows, flow...)
|
|
3199
|
+// }
|
|
3200
|
+// roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
|
|
3201
|
+// miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
|
|
3202
|
+// var err []string
|
|
3203
|
+//
|
|
3204
|
+// for _, item := range flows {
|
|
3205
|
+// var res3 ResultSix
|
|
3206
|
+// if item.ConsumableType == 3 { //3为自动出库 7为自动退库
|
|
3207
|
+// prescription := service.GetHisPrescriptionByID(item.HisDoctorAdviceInfo.PrescriptionId)
|
|
3208
|
+// if prescription.OrderStatus == 2 {
|
|
3209
|
+// //已经结算
|
|
3210
|
+// //判断是否已经销售
|
|
3211
|
+// if item.IsSale == 1 { //是否已经销售,1是 0否
|
|
3212
|
+// //是否已经变更 1是 0否
|
|
3213
|
+// if item.IsChange == 0 { //没变更,进行变更操作
|
|
3214
|
+// bg_number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3502"
|
|
3215
|
+//
|
|
3216
|
+// result, result2 := ChangeStock(item.Count, item, miConfig, "102", roles, bg_number)
|
|
3217
|
+// saveLog(result, result2, "3502", "自动出库,已经销售,未变更3502")
|
|
3218
|
+// var respJSON3 map[string]interface{}
|
|
3219
|
+// if err := json.Unmarshal([]byte(string(result)), &respJSON3); err != nil {
|
|
3220
|
+// utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
|
3221
|
+// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
3222
|
+// return
|
|
3223
|
+// }
|
|
3224
|
+// userJSONBytes3, _ := json.Marshal(respJSON3)
|
|
3225
|
+// if err := json.Unmarshal(userJSONBytes3, &res3); err != nil {
|
|
3226
|
+// utils.ErrorLog("解析失败:%v", err)
|
|
3227
|
+// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
3228
|
+// return
|
|
3229
|
+// }
|
|
3230
|
+// if res3.Infcode == 0 {
|
|
3231
|
+// item.IsChange = 1
|
|
3232
|
+// item.BgBchno = bg_number
|
|
3233
|
+// service.SaveDF2(item)
|
|
3234
|
+// } else {
|
|
3235
|
+//
|
|
3236
|
+// err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售变更失败:"+res3.ErrMsg)
|
|
3237
|
+// }
|
|
3238
|
+// }
|
|
3239
|
+// } else { //没销售,
|
|
3240
|
+// var res FJ3507Result
|
|
3241
|
+// var res3507for10188 FJ3507ResultFor10188
|
|
3242
|
+// number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3505"
|
|
3243
|
+//
|
|
3244
|
+// //进行商品销售接口
|
|
3245
|
+// result3, result4 := SaleStock(c.GetAdminUserInfo().CurrentOrgId, prescription, item, miConfig, "", roles, number)
|
|
3246
|
+// saveLog(result3, result4, "3505", "自动出库,未销售进行销售行为,3505")
|
|
3247
|
+// var respJSON3 map[string]interface{}
|
|
3248
|
+// if err := json.Unmarshal([]byte(string(result3)), &respJSON3); err != nil {
|
|
3249
|
+// utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
|
3250
|
+// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
3251
|
+// return
|
|
3252
|
+// }
|
|
3253
|
+// userJSONBytes3, _ := json.Marshal(respJSON3)
|
|
3254
|
+// if c.GetAdminUserInfo().CurrentOrgId == 10188 || c.GetAdminUserInfo().CurrentOrgId == 10217 {
|
|
3255
|
+// if err := json.Unmarshal(userJSONBytes3, &res3507for10188); err != nil {
|
|
3256
|
+// utils.ErrorLog("解析失败:%v", err)
|
|
3257
|
+// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
3258
|
+// return
|
|
3259
|
+// }
|
|
3260
|
+// //if res3507for10188.Infcode
|
|
3261
|
+// res.InfRefmsgid = res3507for10188.InfRefmsgid
|
|
3262
|
+// //res.Output = resSix10265.Output
|
|
3263
|
+// res.ErrMsg = res3507for10188.ErrMsg
|
|
3264
|
+// res.Cainfo = res3507for10188.Cainfo
|
|
3265
|
+// res.WarnMsg = res3507for10188.WarnMsg
|
|
3266
|
+// infocode, _ := strconv.ParseInt(res3507for10188.Infcode, 10, 64)
|
|
3267
|
+// res.Infcode = infocode
|
|
3268
|
+// } else {
|
|
3269
|
+// if err := json.Unmarshal(userJSONBytes3, &res); err != nil {
|
|
3270
|
+// utils.ErrorLog("解析失败:%v", err)
|
|
3271
|
+// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
3272
|
+// return
|
|
3273
|
+// }
|
|
3274
|
+//
|
|
3275
|
+// }
|
|
3276
|
+// if res.Infcode == 0 {
|
|
3277
|
+// item.IsSale = 1
|
|
3278
|
+// item.Bchno = number
|
|
3279
|
+// item.SaleDate = time.Now().Format("2006-01-02")
|
|
3280
|
+//
|
|
3281
|
+// err5 := service.SaveDF(item)
|
|
3282
|
+// if err5 == nil {
|
|
3283
|
+// if item.IsChange == 0 { //没变更,进行变更操作
|
|
3284
|
+// bg_number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3502"
|
|
3285
|
+//
|
|
3286
|
+// result, result2 := ChangeStock(item.Count, item, miConfig, "102", roles, bg_number)
|
|
3287
|
+// saveLog(result, result2, "3502", "自动出库,没销售,未变更3502")
|
|
3288
|
+//
|
|
3289
|
+// var respJSON3 map[string]interface{}
|
|
3290
|
+// if err := json.Unmarshal([]byte(string(result)), &respJSON3); err != nil {
|
|
3291
|
+// utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
|
3292
|
+// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
3293
|
+// return
|
|
3294
|
+// }
|
|
3295
|
+// if c.GetAdminUserInfo().CurrentOrgId == 10188 || c.GetAdminUserInfo().CurrentOrgId == 10217 {
|
|
3296
|
+// if err := json.Unmarshal(userJSONBytes3, &res3507for10188); err != nil {
|
|
3297
|
+// utils.ErrorLog("解析失败:%v", err)
|
|
3298
|
+// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
3299
|
+// return
|
|
3300
|
+// }
|
|
3301
|
+// //if res3507for10188.Infcode
|
|
3302
|
+// res3.InfRefmsgid = res3507for10188.InfRefmsgid
|
|
3303
|
+// //res.Output = resSix10265.Output
|
|
3304
|
+// res3.ErrMsg = res3507for10188.ErrMsg
|
|
3305
|
+// res3.Cainfo = res3507for10188.Cainfo
|
|
3306
|
+// res3.WarnMsg = res3507for10188.WarnMsg
|
|
3307
|
+// infocode, _ := strconv.ParseInt(res3507for10188.Infcode, 10, 64)
|
|
3308
|
+// res3.Infcode = infocode
|
|
3309
|
+// } else {
|
|
3310
|
+// if err := json.Unmarshal(userJSONBytes3, &res3); err != nil {
|
|
3311
|
+// utils.ErrorLog("解析失败:%v", err)
|
|
3312
|
+// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
3313
|
+// return
|
|
3314
|
+// }
|
|
3315
|
+// }
|
|
3316
|
+// if res3.Infcode == 0 {
|
|
3317
|
+// item.IsChange = 1
|
|
3318
|
+// item.BgBchno = bg_number
|
|
3319
|
+// service.SaveDF2(item)
|
|
3320
|
+// } else {
|
|
3321
|
+//
|
|
3322
|
+// err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售变更失败:"+res3.ErrMsg)
|
|
3323
|
+// }
|
|
3324
|
+// }
|
|
3325
|
+// }
|
|
3326
|
+// } else {
|
|
3327
|
+//
|
|
3328
|
+// err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售失败:"+res.ErrMsg)
|
|
3329
|
+// }
|
|
3330
|
+// }
|
|
3331
|
+//
|
|
3332
|
+// } else { //还没结,提示用户去结算,并药品追溯上传
|
|
3333
|
+// err = append(err, item.HisDoctorAdviceInfo.AdviceName+"还没结算,请结算后,在药品追溯页面上传")
|
|
3334
|
+// }
|
|
3335
|
+// }
|
|
3336
|
+// }
|
|
3337
|
+// if len(err) == 0 {
|
|
3338
|
+// c.ServeSuccessJSON(map[string]interface{}{
|
|
3339
|
+// "msg": "销售变更成功",
|
|
3340
|
+// })
|
|
3341
|
+// } else {
|
|
3342
|
+// c.ServeSuccessJSON(map[string]interface{}{
|
|
3343
|
+// "failed_code": -10,
|
|
3344
|
+// "msg": err,
|
|
3345
|
+// })
|
|
3346
|
+// }
|
|
3347
|
+//}
|
3348
|
3348
|
|
3349
|
3349
|
func (c *HisApiController) ChangeDrug() {
|
3350
|
3350
|
ids := c.GetString("ids")
|
|
@@ -4616,7 +4616,7 @@ func (c *HisApiController) ChangeDrugTen() {
|
4616
|
4616
|
//id_arr := strings.Split(ids, ",")
|
4617
|
4617
|
now := time.Now()
|
4618
|
4618
|
timestamp := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local).Unix()
|
4619
|
|
- flows, _ := service.GetNewDrugFlowInforTen(timestamp)
|
|
4619
|
+ flows, _ := service.GetNewDrugFlowInforTen(timestamp,c.GetAdminUserInfo().CurrentOrgId)
|
4620
|
4620
|
admin_user_id, _ := c.GetInt64("admin_user_id")
|
4621
|
4621
|
roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
|
4622
|
4622
|
miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
|
|
@@ -4624,7 +4624,14 @@ func (c *HisApiController) ChangeDrugTen() {
|
4624
|
4624
|
for _, item := range flows {
|
4625
|
4625
|
var res3 ResultSix
|
4626
|
4626
|
if item.ConsumableType == 3 { //3为自动出库 7为自动退库
|
|
4627
|
+ if item.HisDoctorAdviceInfo.PrescriptionId == 0{
|
|
4628
|
+ continue
|
|
4629
|
+ }
|
|
4630
|
+ if item.HisDoctorAdviceInfo.PrescriptionId == 0{
|
|
4631
|
+ continue
|
|
4632
|
+ }
|
4627
|
4633
|
prescription := service.GetHisPrescriptionByID(item.HisDoctorAdviceInfo.PrescriptionId)
|
|
4634
|
+
|
4628
|
4635
|
if prescription.OrderStatus == 2 {
|
4629
|
4636
|
//已经结算
|
4630
|
4637
|
//判断是否已经销售
|
|
@@ -5059,7 +5066,7 @@ func ChangeStock(count int64, drug *models.DrugFlow, miConfig models.MedicalInsu
|
5059
|
5066
|
struct3502.Code = miConfig.Code
|
5060
|
5067
|
|
5061
|
5068
|
struct3502.Opter = role.UserName
|
5062
|
|
- struct3502.RxFlag = "0"
|
|
5069
|
+ struct3502.RxFlag = "1"
|
5063
|
5070
|
struct3502.InvChgTime = time.Now().Format("2006-01-02")
|
5064
|
5071
|
struct3502.OrgName = miConfig.OrgName
|
5065
|
5072
|
struct3502.AccessKey = miConfig.AccessKey
|
|
@@ -5088,6 +5095,9 @@ func ChangeStock(count int64, drug *models.DrugFlow, miConfig models.MedicalInsu
|
5088
|
5095
|
result1, result2 := service.Gzyb3502(struct3502, struct3502.SecretKey)
|
5089
|
5096
|
return result1, result2
|
5090
|
5097
|
|
|
5098
|
+ }else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "440") {
|
|
5099
|
+ result1, result2 := service.Gdyb3502(struct3502, struct3502.SecretKey)
|
|
5100
|
+ return result1, result2
|
5091
|
5101
|
} else {
|
5092
|
5102
|
data := make(map[string]interface{})
|
5093
|
5103
|
data["struct_3502s"] = struct3502
|
|
@@ -5149,15 +5159,31 @@ func SaleStock(org_id int64, pre models.HisPrescription, drug *models.DrugFlow,
|
5149
|
5159
|
struct3505.PharPracCertNo = "210441200001378"
|
5150
|
5160
|
}
|
5151
|
5161
|
|
|
5162
|
+ if org_id == 10402 {
|
|
5163
|
+ struct3505.PharName = "刘韶健"
|
|
5164
|
+ struct3505.PharPracCertNo = "2015026440262015440501001198"
|
|
5165
|
+ }
|
|
5166
|
+
|
|
5167
|
+ if org_id == 10567 {
|
|
5168
|
+ struct3505.PharName = "范小兰"
|
|
5169
|
+ struct3505.PharPracCertNo = "0200102079485"
|
|
5170
|
+ }
|
5152
|
5171
|
order := service.GetHisOrderByNumber(pre.BatchNumber)
|
5153
|
5172
|
struct3505.SetlId = order.SetlId
|
5154
|
5173
|
struct3505.MdtrtSn = order.MdtrtId
|
5155
|
5174
|
struct3505.ManuLotnum = drug.Number
|
5156
|
5175
|
struct3505.ManuDate = time.Unix(drug.ProductDate, 0).Format("2006-01-02")
|
5157
|
5176
|
struct3505.ExpyEnd = ""
|
5158
|
|
- struct3505.RxFlag = "0"
|
|
5177
|
+ struct3505.RxFlag = "1"
|
5159
|
5178
|
struct3505.TrdnFlag = "1"
|
5160
|
5179
|
struct3505.RtalDocno = order.Number
|
|
5180
|
+ struct3505.PsnCertType = "01"
|
|
5181
|
+
|
|
5182
|
+ struct3505.CertNo = order.Certno
|
|
5183
|
+ struct3505.PsnNo = order.PsnNo
|
|
5184
|
+ struct3505.PsnName = order.PsnName
|
|
5185
|
+
|
|
5186
|
+
|
5161
|
5187
|
struct3505.Url = miConfig.Url
|
5162
|
5188
|
struct3505.AppId = miConfig.Cainfo
|
5163
|
5189
|
struct3505.AppSecret = miConfig.AppSecret
|
|
@@ -5188,6 +5214,9 @@ func SaleStock(org_id int64, pre models.HisPrescription, drug *models.DrugFlow,
|
5188
|
5214
|
} else if miConfig.MdtrtareaAdmvs == "440100" {
|
5189
|
5215
|
result1, result2 := service.Gzyb3505(struct3505, struct3505.SecretKey)
|
5190
|
5216
|
return result1, result2
|
|
5217
|
+ }else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "440") {
|
|
5218
|
+ result1, result2 := service.Gdyb3505(struct3505, struct3505.SecretKey)
|
|
5219
|
+ return result1, result2
|
5191
|
5220
|
} else {
|
5192
|
5221
|
data := make(map[string]interface{})
|
5193
|
5222
|
data["struct_3505s"] = struct3505
|