|
@@ -2284,15 +2284,11 @@ func (this *StockManagerApiController) AddGoodInformation() {
|
2284
|
2284
|
service.CreateExportErrLog(&err_log)
|
2285
|
2285
|
continue
|
2286
|
2286
|
}
|
2287
|
|
- fmt.Println("33333333", unit_id)
|
2288
|
|
- good.GoodUnit = unit_id
|
2289
|
2287
|
|
2290
|
|
- if goodNameM["retail_price"] == nil || reflect.TypeOf(goodNameM["retail_price"]).String() != "float64" {
|
2291
|
|
- utils.ErrorLog("retail_price")
|
2292
|
|
- return
|
2293
|
|
- }
|
|
2288
|
+ good.GoodUnit = unit_id
|
2294
|
2289
|
|
2295
|
|
- retail_price := goodNameM["retail_price"].(float64)
|
|
2290
|
+ retail_prices := goodNameM["retail_price"].(string)
|
|
2291
|
+ retail_price, _ := strconv.ParseFloat(retail_prices, 64)
|
2296
|
2292
|
if retail_price <= 0 { //名字为空则生成一条导入错误日志
|
2297
|
2293
|
err_log := models.ExportErrLog{
|
2298
|
2294
|
LogType: 5,
|
|
@@ -2333,7 +2329,7 @@ func (this *StockManagerApiController) AddGoodInformation() {
|
2333
|
2329
|
|
2334
|
2330
|
var dealer_id int64
|
2335
|
2331
|
dealerName := goodNameM["dealer"].(string)
|
2336
|
|
-
|
|
2332
|
+ fmt.Println("经销商33333333", dealerName)
|
2337
|
2333
|
dealer := models.Dealer{
|
2338
|
2334
|
OrgId: orgId,
|
2339
|
2335
|
Status: 1,
|
|
@@ -2371,14 +2367,10 @@ func (this *StockManagerApiController) AddGoodInformation() {
|
2371
|
2367
|
}
|
2372
|
2368
|
wubi := goodNameM["wubi"].(string)
|
2373
|
2369
|
|
2374
|
|
- good.Pinyin = wubi
|
|
2370
|
+ good.Wubi = wubi
|
2375
|
2371
|
|
2376
|
|
- if goodNameM["buy_price"] == nil || reflect.TypeOf(goodNameM["buy_price"]).String() != "float64" {
|
2377
|
|
- utils.ErrorLog("buy_price")
|
2378
|
|
- return
|
2379
|
|
- }
|
2380
|
|
-
|
2381
|
|
- buy_price := goodNameM["buy_price"].(float64)
|
|
2372
|
+ buy_prices := goodNameM["buy_price"].(string)
|
|
2373
|
+ buy_price, _ := strconv.ParseFloat(buy_prices, 64)
|
2382
|
2374
|
good.BuyPrice = buy_price
|
2383
|
2375
|
|
2384
|
2376
|
if goodNameM["social_security_directory_code"] == nil || reflect.TypeOf(goodNameM["social_security_directory_code"]).String() != "string" {
|
|
@@ -2474,7 +2466,11 @@ func (this *StockManagerApiController) AddGoodInformation() {
|
2474
|
2466
|
}
|
2475
|
2467
|
|
2476
|
2468
|
good.StatisticsCategory = statistic_id
|
|
2469
|
+
|
|
2470
|
+ special_medical := goodNameM["special_medical"].(string)
|
|
2471
|
+ good.SpecialMedical = special_medical
|
2477
|
2472
|
goods = append(goods, &good)
|
|
2473
|
+
|
2478
|
2474
|
}
|
2479
|
2475
|
|
2480
|
2476
|
export_time := time.Now().Unix()
|
|
@@ -2482,7 +2478,44 @@ func (this *StockManagerApiController) AddGoodInformation() {
|
2482
|
2478
|
if len(goods) > 0 {
|
2483
|
2479
|
|
2484
|
2480
|
for _, item := range goods {
|
2485
|
|
- service.CreateGoodsInfomation(item, orgId)
|
|
2481
|
+
|
|
2482
|
+ goodInfo := models.GoodInfo{
|
|
2483
|
+ GoodName: item.GoodName,
|
|
2484
|
+ SpecificationName: item.SpecificationName,
|
|
2485
|
+ GoodKind: item.GoodKind,
|
|
2486
|
+ GoodTypeId: item.GoodTypeId,
|
|
2487
|
+ Dealer: item.Dealer,
|
|
2488
|
+ GoodUnit: item.GoodUnit,
|
|
2489
|
+ IsRecord: item.IsRecord,
|
|
2490
|
+ IsSpecialDiseases: item.IsSpecialDiseases,
|
|
2491
|
+ Manufacturer: item.Manufacturer,
|
|
2492
|
+ Pinyin: item.Pinyin,
|
|
2493
|
+
|
|
2494
|
+ ProductionType: item.ProductionType,
|
|
2495
|
+ Remark: item.Remark,
|
|
2496
|
+ RetailPrice: item.RetailPrice,
|
|
2497
|
+ SocialSecurityDirectoryCode: item.SocialSecurityDirectoryCode,
|
|
2498
|
+ SpecialMedical: item.SpecialMedical,
|
|
2499
|
+ Wubi: item.Wubi,
|
|
2500
|
+ StockWarnCount: item.StockWarnCount,
|
|
2501
|
+ MedicalInsuranceLevel: item.MedicalInsuranceLevel,
|
|
2502
|
+ OrgId: orgId,
|
|
2503
|
+ Status: 1,
|
|
2504
|
+ Ctime: time.Now().Unix(),
|
|
2505
|
+ StatisticsCategory: item.StatisticsCategory,
|
|
2506
|
+ GoodCode: item.GoodCode,
|
|
2507
|
+ BuyPrice: item.BuyPrice,
|
|
2508
|
+ MedicalInsuranceNumber: item.MedicalInsuranceNumber,
|
|
2509
|
+ }
|
|
2510
|
+
|
|
2511
|
+ //查询同种耗材名称同种类型同种规格的耗材是否存在
|
|
2512
|
+ _, errcodegood := service.GetGoodsInformaitonIsExist(item.GoodName, item.GoodTypeId, item.SpecificationName, orgId)
|
|
2513
|
+
|
|
2514
|
+ if errcodegood == gorm.ErrRecordNotFound {
|
|
2515
|
+ service.CreateGoodsInfomation(&goodInfo)
|
|
2516
|
+ } else if errcodegood == nil {
|
|
2517
|
+ service.UpdateGoodsInformation(&goodInfo, item.GoodName, item.GoodTypeId, item.SpecificationName, orgId)
|
|
2518
|
+ }
|
2486
|
2519
|
|
2487
|
2520
|
log := models.ExportLog{
|
2488
|
2521
|
LogType: 5,
|
|
@@ -2572,19 +2605,6 @@ func (this *StockManagerApiController) AddDrugInformation() {
|
2572
|
2605
|
}
|
2573
|
2606
|
|
2574
|
2607
|
drug_alias, _ := goodNameM["drug_alias"].(string)
|
2575
|
|
- if len(drug_alias) == 0 { //名字为空则生成一条导入错误日志
|
2576
|
|
- err_log := models.ExportErrLog{
|
2577
|
|
- LogType: 4,
|
2578
|
|
- UserOrgId: this.GetAdminUserInfo().CurrentOrgId,
|
2579
|
|
- ErrMsg: "第" + strconv.Itoa(index+2) + "行" + "的药品别名不能为空",
|
2580
|
|
- Status: 1,
|
2581
|
|
- CreateTime: time.Now().Unix(),
|
2582
|
|
- UpdateTime: time.Now().Unix(),
|
2583
|
|
- ExportTime: time.Now().Unix(),
|
2584
|
|
- }
|
2585
|
|
- service.CreateExportErrLog(&err_log)
|
2586
|
|
- continue
|
2587
|
|
- }
|
2588
|
2608
|
|
2589
|
2609
|
drug.DrugAlias = drug_alias
|
2590
|
2610
|
|
|
@@ -2693,7 +2713,7 @@ func (this *StockManagerApiController) AddDrugInformation() {
|
2693
|
2713
|
drug.DrugOriginPlace = drug_origin_place
|
2694
|
2714
|
|
2695
|
2715
|
drug_dosage_form := goodNameM["drug_dosage_form"].(string)
|
2696
|
|
-
|
|
2716
|
+ fmt.Println("药品剂型2222222222", drug_dosage_form)
|
2697
|
2717
|
if len(drug_dosage_form) == 0 {
|
2698
|
2718
|
err_log := models.ExportErrLog{
|
2699
|
2719
|
LogType: 4,
|
|
@@ -2738,10 +2758,11 @@ func (this *StockManagerApiController) AddDrugInformation() {
|
2738
|
2758
|
|
2739
|
2759
|
drugDosageList, _ := service.GetParentDataConfig(drugDosageconfig.ID, orgId)
|
2740
|
2760
|
for _, it := range drugDosageList {
|
2741
|
|
- if drug_dosage == it.Name {
|
2742
|
|
- drug_dosage_form_id = int64(it.ID)
|
|
2761
|
+ if drug_dosage_form == it.Name {
|
|
2762
|
+ drug_dosage_form_id = int64(it.Value)
|
2743
|
2763
|
}
|
2744
|
2764
|
}
|
|
2765
|
+ fmt.Println("hhhhhhh66666666666666", drug_dosage_form_id)
|
2745
|
2766
|
drug.DrugDosageForm = drug_dosage_form_id
|
2746
|
2767
|
|
2747
|
2768
|
medical_insurance_level := goodNameM["medical_insurance_level"].(string)
|
|
@@ -2882,7 +2903,7 @@ func (this *StockManagerApiController) AddDrugInformation() {
|
2882
|
2903
|
drug.LastPrice = last_price
|
2883
|
2904
|
|
2884
|
2905
|
drug_classify := goodNameM["drug_classify"].(string)
|
2885
|
|
- fmt.Println("drug_classify22222222222222222", drug_classify)
|
|
2906
|
+
|
2886
|
2907
|
if len(drug_classify) == 0 { //名字为空则生成一条导入错误日志
|
2887
|
2908
|
err_log := models.ExportErrLog{
|
2888
|
2909
|
LogType: 4,
|
|
@@ -2929,12 +2950,11 @@ func (this *StockManagerApiController) AddDrugInformation() {
|
2929
|
2950
|
drugClassList, _ := service.GetParentDataConfig(drugClassifyConfig.ID, orgId)
|
2930
|
2951
|
for _, it := range drugClassList {
|
2931
|
2952
|
if drug_classify == it.Name {
|
2932
|
|
- fmt.Println("88888888888888888", it.Name)
|
2933
|
|
- fmt.Println("hhhhhhhhhhhh", drug_classify)
|
2934
|
2953
|
drug_classify_id = int64(it.Value)
|
2935
|
2954
|
}
|
2936
|
2955
|
}
|
2937
|
|
- drug.DrugCategory = drug_classify_id
|
|
2956
|
+
|
|
2957
|
+ drug.DrugClassify = strconv.FormatInt(drug_classify_id, 10)
|
2938
|
2958
|
|
2939
|
2959
|
manufacturer := goodNameM["manufacturer"].(string)
|
2940
|
2960
|
if len(manufacturer) == 0 { //名字为空则生成一条导入错误日志
|
|
@@ -3102,7 +3122,7 @@ func (this *StockManagerApiController) AddDrugInformation() {
|
3102
|
3122
|
social_security_directory_code := goodNameM["social_security_directory_code"].(string)
|
3103
|
3123
|
drug.SocialSecurityDirectoryCode = social_security_directory_code
|
3104
|
3124
|
record_date := goodNameM["record_date"].(string)
|
3105
|
|
- fmt.Println("日期2222222222", record_date)
|
|
3125
|
+
|
3106
|
3126
|
timeLayout := "2006-01-02"
|
3107
|
3127
|
loc, _ := time.LoadLocation("Local")
|
3108
|
3128
|
|
|
@@ -3196,9 +3216,82 @@ func (this *StockManagerApiController) AddDrugInformation() {
|
3196
|
3216
|
drug_category_id = int64(it.Value)
|
3197
|
3217
|
}
|
3198
|
3218
|
}
|
3199
|
|
- fmt.Println("666666666666666666666", drug_category_id)
|
|
3219
|
+
|
3200
|
3220
|
drug.DrugCategory = drug_category_id
|
3201
|
3221
|
|
|
3222
|
+ drug_dose := goodNameM["drug_dose"].(string)
|
|
3223
|
+
|
|
3224
|
+ if len(drug_dose) == 0 {
|
|
3225
|
+ err_log := models.ExportErrLog{
|
|
3226
|
+ LogType: 4,
|
|
3227
|
+ UserOrgId: this.GetAdminUserInfo().CurrentOrgId,
|
|
3228
|
+ ErrMsg: "第" + strconv.Itoa(index+2) + "行" + "的剂量不能为空",
|
|
3229
|
+ Status: 1,
|
|
3230
|
+ CreateTime: time.Now().Unix(),
|
|
3231
|
+ UpdateTime: time.Now().Unix(),
|
|
3232
|
+ ExportTime: time.Now().Unix(),
|
|
3233
|
+ }
|
|
3234
|
+ service.CreateExportErrLog(&err_log)
|
|
3235
|
+ continue
|
|
3236
|
+ }
|
|
3237
|
+ drugDoses, _ := strconv.ParseFloat(drug_dose, 64)
|
|
3238
|
+ drug.DrugDose = drugDoses
|
|
3239
|
+
|
|
3240
|
+ var units = "单位"
|
|
3241
|
+ var unit_id int64
|
|
3242
|
+ drugDoseUnit := goodNameM["drug_dose_unit"].(string)
|
|
3243
|
+
|
|
3244
|
+ if len(drugDoseUnit) == 0 {
|
|
3245
|
+ err_log := models.ExportErrLog{
|
|
3246
|
+ LogType: 4,
|
|
3247
|
+ UserOrgId: this.GetAdminUserInfo().CurrentOrgId,
|
|
3248
|
+ ErrMsg: "第" + strconv.Itoa(index+2) + "行" + "的剂量不能为空",
|
|
3249
|
+ Status: 1,
|
|
3250
|
+ CreateTime: time.Now().Unix(),
|
|
3251
|
+ UpdateTime: time.Now().Unix(),
|
|
3252
|
+ ExportTime: time.Now().Unix(),
|
|
3253
|
+ }
|
|
3254
|
+ service.CreateExportErrLog(&err_log)
|
|
3255
|
+ continue
|
|
3256
|
+ }
|
|
3257
|
+
|
|
3258
|
+ dataConfig, _ := service.GetDataConfigIsExist(0, units)
|
|
3259
|
+ if len(drugDoseUnit) != 0 {
|
|
3260
|
+ _, errcodedataconfig := service.GetChildeConfigIsExist(dataConfig.ID, drugDoseUnit, orgId)
|
|
3261
|
+ if errcodedataconfig == gorm.ErrRecordNotFound {
|
|
3262
|
+ dataconfig := models.Dataconfig{
|
|
3263
|
+ ParentId: dataConfig.ID,
|
|
3264
|
+ Module: "hemodialysis",
|
|
3265
|
+ OrgId: orgId,
|
|
3266
|
+ Name: drugDoseUnit,
|
|
3267
|
+ FieldName: "",
|
|
3268
|
+ Value: index + 50,
|
|
3269
|
+ CreatedTime: "",
|
|
3270
|
+ UpdatedTime: "",
|
|
3271
|
+ CreateUserId: adminUser.AdminUser.Id,
|
|
3272
|
+ Status: 1,
|
|
3273
|
+ Remark: "",
|
|
3274
|
+ DeleteIdSystem: 0,
|
|
3275
|
+ Title: "",
|
|
3276
|
+ Content: "",
|
|
3277
|
+ Order: 0,
|
|
3278
|
+ Code: "",
|
|
3279
|
+ FieldType: 0,
|
|
3280
|
+ }
|
|
3281
|
+ service.CreateDataConfig(&dataconfig)
|
|
3282
|
+ }
|
|
3283
|
+ }
|
|
3284
|
+ list, _ := service.FindAllDataConfigList(orgId, dataConfig.ID)
|
|
3285
|
+ for _, it := range list {
|
|
3286
|
+ if drugDoseUnit == it.Name {
|
|
3287
|
+ unit_id = int64(it.Value)
|
|
3288
|
+ }
|
|
3289
|
+ }
|
|
3290
|
+ drug.DrugDoseUnit = unit_id
|
|
3291
|
+
|
|
3292
|
+ lmt_used_flags := int64(goodNameM["lmt_used_flag"].(float64))
|
|
3293
|
+
|
|
3294
|
+ drug.LmtUsedFlag = lmt_used_flags
|
3202
|
3295
|
drugList = append(drugList, &drug)
|
3203
|
3296
|
}
|
3204
|
3297
|
|
|
@@ -3248,6 +3341,9 @@ func (this *StockManagerApiController) AddDrugInformation() {
|
3248
|
3341
|
DrugStatus: item.DrugStatus,
|
3249
|
3342
|
LimitRemark: item.LimitRemark,
|
3250
|
3343
|
DrugCategory: item.DrugCategory,
|
|
3344
|
+ DrugDose: item.DrugDose,
|
|
3345
|
+ DrugDoseUnit: item.DrugDoseUnit,
|
|
3346
|
+ LmtUsedFlag: item.LmtUsedFlag,
|
3251
|
3347
|
}
|
3252
|
3348
|
|
3253
|
3349
|
//查询同种药品同种规格是否存在
|