|
@@ -6541,6 +6541,12 @@ func (c *HisApiController) GetUploadInfo() {
|
6541
|
6541
|
reg_type, _ := c.GetInt64("p_type")
|
6542
|
6542
|
order_id, _ := c.GetInt64("order_id")
|
6543
|
6543
|
|
|
6544
|
+ cash_pay := c.GetString("cash_pay")
|
|
6545
|
+ wechat_pay := c.GetString("wechat_pay")
|
|
6546
|
+ ali_pay := c.GetString("ali_pay")
|
|
6547
|
+ jifen_pay := c.GetString("jifen_pay")
|
|
6548
|
+ band_card_pay := c.GetString("band_card_pay")
|
|
6549
|
+
|
6544
|
6550
|
dec_way := c.GetString("dec_way") //是否使用押金支付bool类型
|
6545
|
6551
|
tmp_decimal := c.GetString("tmp_decimal")
|
6546
|
6552
|
var decimal float64 //本次使用的押金
|
|
@@ -6568,10 +6574,7 @@ func (c *HisApiController) GetUploadInfo() {
|
6568
|
6574
|
}
|
6569
|
6575
|
tt, errs := strconv.ParseFloat(tmp_decimal, 64)
|
6570
|
6576
|
fmt.Println(errs)
|
6571
|
|
- //if errs != nil {
|
6572
|
|
- // c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "押金金额错误")
|
6573
|
|
- // return
|
6574
|
|
- //}
|
|
6577
|
+
|
6575
|
6578
|
decimal = tt
|
6576
|
6579
|
|
6577
|
6580
|
his, _ := service.GetHisPatientByIdThreeTX(his_patient_id, tx)
|
|
@@ -7138,232 +7141,8 @@ func (c *HisApiController) GetUploadInfo() {
|
7138
|
7141
|
})
|
7139
|
7142
|
|
7140
|
7143
|
}
|
7141
|
|
- } else {
|
7142
|
|
- if tempOrder.IsPre > 0 {
|
7143
|
|
- allTotal := fmt.Sprintf("%.2f", tempOrder.MedfeeSumamt)
|
7144
|
|
- totals, _ := strconv.ParseFloat(allTotal, 64)
|
7145
|
|
- tempOrder.OrderStatus = 2
|
7146
|
|
- tempOrder.PayWay = pay_way
|
7147
|
|
- tempOrder.PayPrice = pay_price
|
7148
|
|
- tempOrder.PayCardNo = pay_card_no
|
7149
|
|
- tempOrder.DiscountPrice = discount_price
|
7150
|
|
- tempOrder.PreferentialPrice = preferential_price
|
7151
|
|
- tempOrder.RealityPrice = reality_price
|
7152
|
|
- tempOrder.FoundPrice = found_price
|
7153
|
|
- tempOrder.MedicalInsurancePrice = medical_insurance_price
|
7154
|
|
- tempOrder.PrivatePrice = private_price
|
7155
|
|
- tempOrder.FaPiaoCode = fapiao_code
|
7156
|
|
- tempOrder.FaPiaoNumber = fapiao_number
|
7157
|
|
- tempOrder.PType = 2
|
7158
|
|
- tempOrder.MedfeeSumamt = totals
|
7159
|
|
- tempOrder.Diagnosis = diagnosis_id
|
7160
|
|
- err = service.SaveHisOrder(&tempOrder)
|
7161
|
|
- err = service.UpdataOrderStatusTwo(tempOrder.Number, adminUser.CurrentOrgId)
|
7162
|
|
- if err != nil {
|
7163
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateOrderException)
|
7164
|
|
- return
|
7165
|
|
- }
|
7166
|
|
- if err == nil {
|
7167
|
|
- houseConfig, _ := service.GetAllStoreHouseConfig(adminUser.CurrentOrgId)
|
7168
|
|
- var goods []*models.DialysisBeforePrepareGoods
|
7169
|
|
- var newGoods []*models.NewDialysisBeforePrepareGoods
|
7170
|
|
- var infos []*models.HisDoctorAdviceInfo
|
7171
|
|
- var hisAdvice []*models.HisDoctorAdviceInfo
|
7172
|
|
- var newGoodOne []*models.NewDialysisBeforePrepareGoods
|
7173
|
|
- var infolist []*models.HisDoctorAdviceInfo
|
7174
|
|
- var oldGoods []*models.OldDialysisBeforePrepareGoods
|
7175
|
|
- for _, info := range prescriptions {
|
7176
|
|
- if info.Type == 1 {
|
7177
|
|
- infos = append(infos, info.HisDoctorAdviceInfo...)
|
7178
|
|
- }
|
7179
|
|
- if info.Type == 2 {
|
7180
|
|
- for _, sumItem := range info.HisPrescriptionProject {
|
7181
|
|
- if sumItem.Type == 3 {
|
7182
|
|
- var good models.DialysisBeforePrepareGoods
|
7183
|
|
- var newGood models.NewDialysisBeforePrepareGoods
|
7184
|
|
- good.GoodId = sumItem.GoodInfo.ID
|
7185
|
|
- good.GoodTypeId = sumItem.GoodInfo.GoodTypeId
|
7186
|
|
- count, _ := strconv.Atoi(sumItem.Count)
|
7187
|
|
- good.Count = int64(count)
|
7188
|
|
- good.StorehouseId = houseConfig.StorehouseOutInfo
|
7189
|
|
- good.ProjectId = sumItem.ID
|
7190
|
|
- goods = append(goods, &good)
|
7191
|
|
-
|
7192
|
|
- newGood.GoodId = sumItem.GoodInfo.ID
|
7193
|
|
- newGood.GoodTypeId = sumItem.GoodInfo.GoodTypeId
|
7194
|
|
- count2, _ := strconv.Atoi(sumItem.Count)
|
7195
|
|
- newGood.Count = int64(count2)
|
7196
|
|
- newGood.StorehouseId = houseConfig.StorehouseOutInfo
|
7197
|
|
- newGood.ProjectId = sumItem.ID
|
7198
|
|
- newGoods = append(newGoods, &newGood)
|
7199
|
|
- }
|
7200
|
|
-
|
7201
|
|
- }
|
7202
|
|
-
|
7203
|
|
- }
|
7204
|
|
- }
|
7205
|
|
-
|
7206
|
|
- settConfig, _ := service.GetSettleOpenConfigByOrgId(adminUser.CurrentOrgId)
|
7207
|
|
- if settConfig.IsOpen == 1 {
|
7208
|
|
-
|
7209
|
|
- //判断库存的地方
|
7210
|
|
- for _, info := range prescriptions {
|
7211
|
|
- if info.Type == 1 {
|
7212
|
|
- infolist = append(infolist, info.HisDoctorAdviceInfo...)
|
7213
|
|
-
|
7214
|
|
- }
|
7215
|
|
- if info.Type == 2 {
|
7216
|
|
- for _, sumItem := range info.HisPrescriptionProject {
|
7217
|
|
- if sumItem.Type == 3 {
|
7218
|
|
- var good models.DialysisBeforePrepareGoods
|
7219
|
|
- var newGood models.NewDialysisBeforePrepareGoods
|
7220
|
|
- var oldGood models.OldDialysisBeforePrepareGoods
|
7221
|
|
- good.GoodId = sumItem.GoodInfo.ID
|
7222
|
|
- good.GoodTypeId = sumItem.GoodInfo.GoodTypeId
|
7223
|
|
- count, _ := strconv.Atoi(sumItem.Count)
|
7224
|
|
- good.Count = int64(count)
|
7225
|
|
- good.StorehouseId = houseConfig.StorehouseOutInfo
|
7226
|
|
- good.ProjectId = sumItem.ID
|
7227
|
|
- goods = append(goods, &good)
|
7228
|
|
-
|
7229
|
|
- newGood.GoodId = sumItem.GoodInfo.ID
|
7230
|
|
- newGood.GoodTypeId = sumItem.GoodInfo.GoodTypeId
|
7231
|
|
- count2, _ := strconv.Atoi(sumItem.Count)
|
7232
|
|
- newGood.Count = int64(count2)
|
7233
|
|
- newGood.StorehouseId = houseConfig.StorehouseOutInfo
|
7234
|
|
- newGood.ProjectId = sumItem.ID
|
7235
|
|
- newGoods = append(newGoods, &newGood)
|
7236
|
|
-
|
7237
|
|
- oldGood.GoodId = sumItem.GoodInfo.ID
|
7238
|
|
- oldGood.GoodTypeId = sumItem.GoodInfo.GoodTypeId
|
7239
|
|
- count3, _ := strconv.Atoi(sumItem.Count)
|
7240
|
|
- oldGood.Count = int64(count3)
|
7241
|
|
- oldGood.StorehouseId = houseConfig.StorehouseOutInfo
|
7242
|
|
- oldGood.ProjectId = sumItem.ID
|
7243
|
|
- oldGood.RecordDate = sumItem.RecordDate
|
7244
|
|
-
|
7245
|
|
- oldGoods = append(oldGoods, &oldGood)
|
7246
|
|
- }
|
7247
|
|
- }
|
7248
|
|
- }
|
7249
|
|
- }
|
7250
|
|
-
|
7251
|
|
- for _, info := range prescriptionsOne {
|
7252
|
|
- if info.Type == 1 {
|
7253
|
|
- hisAdvice = append(hisAdvice, info.HisDoctorAdviceInfo...)
|
7254
|
|
- }
|
7255
|
|
-
|
7256
|
|
- if info.Type == 2 {
|
7257
|
|
- for _, sumItem := range info.HisPrescriptionProject {
|
7258
|
|
- if sumItem.Type == 3 {
|
7259
|
|
- var newGood models.NewDialysisBeforePrepareGoods
|
7260
|
|
-
|
7261
|
|
- newGood.GoodId = sumItem.GoodInfo.ID
|
7262
|
|
- newGood.GoodTypeId = sumItem.GoodInfo.GoodTypeId
|
7263
|
|
- count2, _ := strconv.Atoi(sumItem.Count)
|
7264
|
|
- newGood.Count = int64(count2)
|
7265
|
|
- newGood.StorehouseId = houseConfig.StorehouseOutInfo
|
7266
|
|
- newGood.ProjectId = sumItem.ID
|
7267
|
|
- newGoodOne = append(newGoodOne, &newGood)
|
7268
|
|
- }
|
7269
|
|
- }
|
7270
|
|
- }
|
7271
|
|
- }
|
7272
|
|
-
|
7273
|
|
- //判断
|
7274
|
|
- for _, itemOne := range infos {
|
7275
|
|
- for _, itemTwo := range hisAdvice {
|
7276
|
|
- if itemOne.DrugId == itemTwo.DrugId {
|
7277
|
|
- itemTwo.Child = append(itemTwo.ChildDoctorAdvice, itemOne)
|
7278
|
|
- }
|
7279
|
|
- }
|
7280
|
|
- }
|
7281
|
|
-
|
7282
|
|
- for _, itemTwo := range hisAdvice {
|
7283
|
|
- medical, _ := service.GetBaseDrugMedical(itemTwo.DrugId)
|
7284
|
|
- var sum_out_count int64
|
7285
|
|
- for _, itemThree := range itemTwo.Child {
|
7286
|
|
- var prescribing_number int64
|
7287
|
|
- stringPrescribingNumber := strconv.FormatFloat(itemThree.PrescribingNumber, 'f', -1, 64)
|
7288
|
|
- parseIntPrescribingNumber, _ := strconv.ParseInt(stringPrescribingNumber, 10, 64)
|
7289
|
|
- if itemThree.PrescribingNumberUnit == medical.MaxUnit && medical.MaxUnit != medical.MinUnit {
|
7290
|
|
- prescribing_number = parseIntPrescribingNumber * medical.MinNumber
|
7291
|
|
- }
|
7292
|
|
- if itemThree.PrescribingNumberUnit == medical.MinUnit && medical.MaxUnit != medical.MinUnit {
|
7293
|
|
- prescribing_number = parseIntPrescribingNumber
|
7294
|
|
- }
|
7295
|
|
- if itemThree.PrescribingNumberUnit == medical.MinUnit && medical.MaxUnit == medical.MinUnit {
|
7296
|
|
- prescribing_number = parseIntPrescribingNumber
|
7297
|
|
- }
|
7298
|
|
- sum_out_count += prescribing_number
|
7299
|
|
- }
|
7300
|
|
- houseConfig, _ := service.GetAllStoreHouseConfig(adminUser.CurrentOrgId)
|
7301
|
|
- drugStockOut, _ := service.GetDrugSumOutCountByDrugId(itemTwo.DrugId, adminUser.CurrentOrgId, houseConfig.DrugStorehouseOut)
|
7302
|
|
-
|
7303
|
|
- if sum_out_count > drugStockOut.FlushCount {
|
7304
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
7305
|
|
- "msg": "2",
|
7306
|
|
- "drug": medical,
|
7307
|
|
- })
|
7308
|
|
- return
|
7309
|
|
- }
|
7310
|
|
- }
|
7311
|
|
-
|
7312
|
|
- for _, itemOne := range newGoods {
|
7313
|
|
- for _, item := range newGoodOne {
|
7314
|
|
- if itemOne.ProjectId == item.ProjectId {
|
7315
|
|
- item.ChildNewDialysisBeforePrepareGoods = append(item.ChildNewDialysisBeforePrepareGoods, item)
|
7316
|
|
- }
|
7317
|
|
- }
|
7318
|
|
- }
|
7319
|
|
-
|
7320
|
|
- for _, item := range newGoodOne {
|
7321
|
|
- var sum_out_count_one int64
|
7322
|
|
- good, _ := service.GetGoodInformationByGoodIdOne(item.GoodId)
|
7323
|
|
-
|
7324
|
|
- for _, itemOne := range item.ChildNewDialysisBeforePrepareGoods {
|
7325
|
|
- sum_out_count_one += itemOne.Count
|
7326
|
|
- }
|
7327
|
|
- list, _ := service.GetStockGoodList(item.GoodId, adminUser.CurrentOrgId, houseConfig.StorehouseOutInfo)
|
7328
|
|
- fmt.Println("sum_out_count_one", sum_out_count_one)
|
7329
|
|
- fmt.Println("list.FlushCount", list.FlushCount)
|
7330
|
|
- if sum_out_count_one > list.FlushCount {
|
7331
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
7332
|
|
- "msg": "3",
|
7333
|
|
- "good": good,
|
7334
|
|
- })
|
7335
|
|
- return
|
7336
|
|
- }
|
7337
|
|
- }
|
7338
|
|
- for _, item := range infolist {
|
7339
|
|
- service.HisDrugsDelivery(item.UserOrgId, adminUser.AdminUser.Id, item)
|
7340
|
|
- }
|
7341
|
|
- for _, item := range oldGoods {
|
7342
|
|
- dialyPrepareOne := models.DialysisBeforePrepare{
|
7343
|
|
- GoodTypeId: item.GoodTypeId,
|
7344
|
|
- GoodId: item.GoodId,
|
7345
|
|
- PatientId: item.PatientId,
|
7346
|
|
- RecordDate: item.RecordDate,
|
7347
|
|
- UserOrgId: item.UserOrgId,
|
7348
|
|
- Count: item.Count,
|
7349
|
|
- Ctime: time.Now().Unix(),
|
7350
|
|
- Creater: adminUser.AdminUser.Id,
|
7351
|
|
- CommdityCode: item.CommdityCode,
|
7352
|
|
- Status: 1,
|
7353
|
|
- StorehouseId: houseConfig.StorehouseOutInfo,
|
7354
|
|
- }
|
7355
|
|
- err = service.CreateDialysisBeforePrepareOne(&dialyPrepareOne)
|
7356
|
|
- }
|
7357
|
|
-
|
7358
|
|
- service.ConsumablesDeliveryTotal(adminUser.CurrentOrgId, his.PatientId, his.RecordDate, goods, newGoods, adminUser.AdminUser.Id)
|
7359
|
|
- }
|
7360
|
|
-
|
7361
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
7362
|
|
- "msg": "结算成功",
|
7363
|
|
- })
|
7364
|
|
- }
|
7365
|
|
- }
|
7366
|
7144
|
}
|
|
7145
|
+
|
7367
|
7146
|
}
|
7368
|
7147
|
|
7369
|
7148
|
// 退款
|