|
@@ -2607,21 +2607,85 @@ func (this *StockManagerApiController) AddDrugInformation() {
|
2607
|
2607
|
|
2608
|
2608
|
drug.DrugName = drug_name
|
2609
|
2609
|
|
2610
|
|
- if goodNameM["drug_alias"] == nil || reflect.TypeOf(goodNameM["drug_alias"]).String() != "string" {
|
2611
|
|
- utils.ErrorLog("drug_alias")
|
|
2610
|
+ if goodNameM["unval"] == nil || reflect.TypeOf(goodNameM["unval"]).String() != "string" {
|
|
2611
|
+ utils.ErrorLog("unval")
|
2612
|
2612
|
return
|
2613
|
2613
|
}
|
2614
|
2614
|
|
2615
|
|
- drug_alias, _ := goodNameM["drug_alias"].(string)
|
|
2615
|
+ unval, _ := goodNameM["unval"].(string)
|
|
2616
|
+ if len(drug_name) == 0 { //名字为空则生成一条导入错误日志
|
|
2617
|
+ err_log := models.ExportErrLog{
|
|
2618
|
+ LogType: 4,
|
|
2619
|
+ UserOrgId: this.GetAdminUserInfo().CurrentOrgId,
|
|
2620
|
+ ErrMsg: "第" + strconv.Itoa(index+2) + "行" + "的拆零不能为空",
|
|
2621
|
+ Status: 1,
|
|
2622
|
+ CreateTime: time.Now().Unix(),
|
|
2623
|
+ UpdateTime: time.Now().Unix(),
|
|
2624
|
+ ExportTime: time.Now().Unix(),
|
|
2625
|
+ }
|
|
2626
|
+ service.CreateExportErrLog(&err_log)
|
|
2627
|
+ continue
|
|
2628
|
+ }
|
2616
|
2629
|
|
2617
|
|
- drug.DrugAlias = drug_alias
|
|
2630
|
+ drug.Unval = unval
|
|
2631
|
+
|
|
2632
|
+ min_unit := goodNameM["min_unit"].(string)
|
|
2633
|
+ if len(min_unit) == 0 { //名字为空则生成一条导入错误日志
|
|
2634
|
+ err_log := models.ExportErrLog{
|
|
2635
|
+ LogType: 4,
|
|
2636
|
+ UserOrgId: this.GetAdminUserInfo().CurrentOrgId,
|
|
2637
|
+ ErrMsg: "第" + strconv.Itoa(index+2) + "行" + "的拆零单位不能为空",
|
|
2638
|
+ Status: 1,
|
|
2639
|
+ CreateTime: time.Now().Unix(),
|
|
2640
|
+ UpdateTime: time.Now().Unix(),
|
|
2641
|
+ ExportTime: time.Now().Unix(),
|
|
2642
|
+ }
|
|
2643
|
+ service.CreateExportErrLog(&err_log)
|
|
2644
|
+ continue
|
|
2645
|
+ }
|
|
2646
|
+
|
|
2647
|
+ drug.MinUnit = min_unit
|
|
2648
|
+
|
|
2649
|
+ dosage, _ := goodNameM["dosage"].(string)
|
|
2650
|
+ if len(dosage) == 0 { //名字为空则生成一条导入错误日志
|
|
2651
|
+ err_log := models.ExportErrLog{
|
|
2652
|
+ LogType: 4,
|
|
2653
|
+ UserOrgId: this.GetAdminUserInfo().CurrentOrgId,
|
|
2654
|
+ ErrMsg: "第" + strconv.Itoa(index+2) + "行" + "的剂量不能为空",
|
|
2655
|
+ Status: 1,
|
|
2656
|
+ CreateTime: time.Now().Unix(),
|
|
2657
|
+ UpdateTime: time.Now().Unix(),
|
|
2658
|
+ ExportTime: time.Now().Unix(),
|
|
2659
|
+ }
|
|
2660
|
+ service.CreateExportErrLog(&err_log)
|
|
2661
|
+ continue
|
|
2662
|
+ }
|
|
2663
|
+
|
|
2664
|
+ drug.Dosage = dosage
|
|
2665
|
+
|
|
2666
|
+ max_unit_id := goodNameM["max_unit"].(string)
|
|
2667
|
+ if len(max_unit_id) == 0 { //名字为空则生成一条导入错误日志
|
|
2668
|
+ err_log := models.ExportErrLog{
|
|
2669
|
+ LogType: 4,
|
|
2670
|
+ UserOrgId: this.GetAdminUserInfo().CurrentOrgId,
|
|
2671
|
+ ErrMsg: "第" + strconv.Itoa(index+2) + "行" + "的剂量单位不能为空",
|
|
2672
|
+ Status: 1,
|
|
2673
|
+ CreateTime: time.Now().Unix(),
|
|
2674
|
+ UpdateTime: time.Now().Unix(),
|
|
2675
|
+ ExportTime: time.Now().Unix(),
|
|
2676
|
+ }
|
|
2677
|
+ service.CreateExportErrLog(&err_log)
|
|
2678
|
+ continue
|
|
2679
|
+ }
|
2618
|
2680
|
|
2619
|
|
- drug_spec, _ := goodNameM["drug_spec"].(string)
|
2620
|
|
- if len(drug_spec) == 0 { //名字为空则生成一条导入错误日志
|
|
2681
|
+ drug.MaxUnit = max_unit_id
|
|
2682
|
+
|
|
2683
|
+ packing_unit := goodNameM["packing_unit"].(string)
|
|
2684
|
+ if len(packing_unit) == 0 { //名字为空则生成一条导入错误日志
|
2621
|
2685
|
err_log := models.ExportErrLog{
|
2622
|
2686
|
LogType: 4,
|
2623
|
2687
|
UserOrgId: this.GetAdminUserInfo().CurrentOrgId,
|
2624
|
|
- ErrMsg: "第" + strconv.Itoa(index+2) + "行" + "的药品规格不能为空",
|
|
2688
|
+ ErrMsg: "第" + strconv.Itoa(index+2) + "行" + "的包装单位不能为空",
|
2625
|
2689
|
Status: 1,
|
2626
|
2690
|
CreateTime: time.Now().Unix(),
|
2627
|
2691
|
UpdateTime: time.Now().Unix(),
|
|
@@ -2631,7 +2695,58 @@ func (this *StockManagerApiController) AddDrugInformation() {
|
2631
|
2695
|
continue
|
2632
|
2696
|
}
|
2633
|
2697
|
|
2634
|
|
- drug.DrugSpec = drug_spec
|
|
2698
|
+ drug.PackingUnit = packing_unit
|
|
2699
|
+
|
|
2700
|
+ delivery_way := goodNameM["delivery_way"].(string)
|
|
2701
|
+ if len(delivery_way) == 0 { //名字为空则生成一条导入错误日志
|
|
2702
|
+ err_log := models.ExportErrLog{
|
|
2703
|
+ LogType: 4,
|
|
2704
|
+ UserOrgId: this.GetAdminUserInfo().CurrentOrgId,
|
|
2705
|
+ ErrMsg: "第" + strconv.Itoa(index+2) + "行" + "的默认给药途径不能为空",
|
|
2706
|
+ Status: 1,
|
|
2707
|
+ CreateTime: time.Now().Unix(),
|
|
2708
|
+ UpdateTime: time.Now().Unix(),
|
|
2709
|
+ ExportTime: time.Now().Unix(),
|
|
2710
|
+ }
|
|
2711
|
+ service.CreateExportErrLog(&err_log)
|
|
2712
|
+ continue
|
|
2713
|
+ }
|
|
2714
|
+
|
|
2715
|
+ drug.DeliveryWay = delivery_way
|
|
2716
|
+
|
|
2717
|
+ execution_frequency := goodNameM["execution_frequency"].(string)
|
|
2718
|
+ if len(execution_frequency) == 0 { //名字为空则生成一条导入错误日志
|
|
2719
|
+ err_log := models.ExportErrLog{
|
|
2720
|
+ LogType: 4,
|
|
2721
|
+ UserOrgId: this.GetAdminUserInfo().CurrentOrgId,
|
|
2722
|
+ ErrMsg: "第" + strconv.Itoa(index+2) + "行" + "的默认执行频率不能为空",
|
|
2723
|
+ Status: 1,
|
|
2724
|
+ CreateTime: time.Now().Unix(),
|
|
2725
|
+ UpdateTime: time.Now().Unix(),
|
|
2726
|
+ ExportTime: time.Now().Unix(),
|
|
2727
|
+ }
|
|
2728
|
+ service.CreateExportErrLog(&err_log)
|
|
2729
|
+ continue
|
|
2730
|
+ }
|
|
2731
|
+
|
|
2732
|
+ drug.ExecutionFrequency = execution_frequency
|
|
2733
|
+
|
|
2734
|
+ drug_day := goodNameM["drug_day"].(string)
|
|
2735
|
+ if len(drug_day) == 0 { //名字为空则生成一条导入错误日志
|
|
2736
|
+ err_log := models.ExportErrLog{
|
|
2737
|
+ LogType: 4,
|
|
2738
|
+ UserOrgId: this.GetAdminUserInfo().CurrentOrgId,
|
|
2739
|
+ ErrMsg: "第" + strconv.Itoa(index+2) + "行" + "的默认执行频率不能为空",
|
|
2740
|
+ Status: 1,
|
|
2741
|
+ CreateTime: time.Now().Unix(),
|
|
2742
|
+ UpdateTime: time.Now().Unix(),
|
|
2743
|
+ ExportTime: time.Now().Unix(),
|
|
2744
|
+ }
|
|
2745
|
+ service.CreateExportErrLog(&err_log)
|
|
2746
|
+ continue
|
|
2747
|
+ }
|
|
2748
|
+
|
|
2749
|
+ drug.DrugDay = drug_day
|
2635
|
2750
|
|
2636
|
2751
|
drug_type := goodNameM["drug_type"].(string)
|
2637
|
2752
|
if len(drug_type) == 0 { //名字为空则生成一条导入错误日志
|
|
@@ -2828,12 +2943,12 @@ func (this *StockManagerApiController) AddDrugInformation() {
|
2828
|
2943
|
}
|
2829
|
2944
|
drug.MedicalInsuranceLevel = medical_insurance_level_id
|
2830
|
2945
|
|
2831
|
|
- max_unit_id := goodNameM["max_unit"].(string)
|
|
2946
|
+ unit_matrixing := goodNameM["unit_matrixing"].(string)
|
2832
|
2947
|
if len(max_unit_id) == 0 { //名字为空则生成一条导入错误日志
|
2833
|
2948
|
err_log := models.ExportErrLog{
|
2834
|
2949
|
LogType: 4,
|
2835
|
2950
|
UserOrgId: this.GetAdminUserInfo().CurrentOrgId,
|
2836
|
|
- ErrMsg: "第" + strconv.Itoa(index+2) + "行" + "的最大不能为空",
|
|
2951
|
+ ErrMsg: "第" + strconv.Itoa(index+2) + "行" + "的单位换算不能为空",
|
2837
|
2952
|
Status: 1,
|
2838
|
2953
|
CreateTime: time.Now().Unix(),
|
2839
|
2954
|
UpdateTime: time.Now().Unix(),
|
|
@@ -2843,14 +2958,15 @@ func (this *StockManagerApiController) AddDrugInformation() {
|
2843
|
2958
|
continue
|
2844
|
2959
|
}
|
2845
|
2960
|
|
2846
|
|
- drug.MaxUnit = max_unit_id
|
|
2961
|
+ drug.UnitMatrixing = unit_matrixing
|
|
2962
|
+ retail_prices := goodNameM["retail_price"].(string)
|
|
2963
|
+ retail_price, _ := strconv.ParseFloat(retail_prices, 64)
|
2847
|
2964
|
|
2848
|
|
- min_unit := goodNameM["min_unit"].(string)
|
2849
|
|
- if len(max_unit_id) == 0 { //名字为空则生成一条导入错误日志
|
|
2965
|
+ if retail_price <= 0 { //名字为空则生成一条导入错误日志
|
2850
|
2966
|
err_log := models.ExportErrLog{
|
2851
|
2967
|
LogType: 4,
|
2852
|
2968
|
UserOrgId: this.GetAdminUserInfo().CurrentOrgId,
|
2853
|
|
- ErrMsg: "第" + strconv.Itoa(index+2) + "行" + "的最小单位不能为空",
|
|
2969
|
+ ErrMsg: "第" + strconv.Itoa(index+2) + "行" + "的拆零售价不能为空",
|
2854
|
2970
|
Status: 1,
|
2855
|
2971
|
CreateTime: time.Now().Unix(),
|
2856
|
2972
|
UpdateTime: time.Now().Unix(),
|
|
@@ -2860,32 +2976,16 @@ func (this *StockManagerApiController) AddDrugInformation() {
|
2860
|
2976
|
continue
|
2861
|
2977
|
}
|
2862
|
2978
|
|
2863
|
|
- drug.MinUnit = min_unit
|
2864
|
|
-
|
2865
|
|
- unit_matrixing := goodNameM["unit_matrixing"].(string)
|
2866
|
|
- if len(max_unit_id) == 0 { //名字为空则生成一条导入错误日志
|
2867
|
|
- err_log := models.ExportErrLog{
|
2868
|
|
- LogType: 4,
|
2869
|
|
- UserOrgId: this.GetAdminUserInfo().CurrentOrgId,
|
2870
|
|
- ErrMsg: "第" + strconv.Itoa(index+2) + "行" + "的单位换算不能为空",
|
2871
|
|
- Status: 1,
|
2872
|
|
- CreateTime: time.Now().Unix(),
|
2873
|
|
- UpdateTime: time.Now().Unix(),
|
2874
|
|
- ExportTime: time.Now().Unix(),
|
2875
|
|
- }
|
2876
|
|
- service.CreateExportErrLog(&err_log)
|
2877
|
|
- continue
|
2878
|
|
- }
|
|
2979
|
+ drug.RetailPrice = retail_price
|
2879
|
2980
|
|
2880
|
|
- drug.UnitMatrixing = unit_matrixing
|
2881
|
|
- retail_prices := goodNameM["retail_price"].(string)
|
2882
|
|
- retail_price, _ := strconv.ParseFloat(retail_prices, 64)
|
|
2981
|
+ packing_prices := goodNameM["packing_price"].(string)
|
|
2982
|
+ packing_price, _ := strconv.ParseFloat(packing_prices, 64)
|
2883
|
2983
|
|
2884
|
|
- if retail_price <= 0 { //名字为空则生成一条导入错误日志
|
|
2984
|
+ if packing_price <= 0 { //名字为空则生成一条导入错误日志
|
2885
|
2985
|
err_log := models.ExportErrLog{
|
2886
|
2986
|
LogType: 4,
|
2887
|
2987
|
UserOrgId: this.GetAdminUserInfo().CurrentOrgId,
|
2888
|
|
- ErrMsg: "第" + strconv.Itoa(index+2) + "行" + "的零售价不能为空",
|
|
2988
|
+ ErrMsg: "第" + strconv.Itoa(index+2) + "行" + "的包装零售价不能为空",
|
2889
|
2989
|
Status: 1,
|
2890
|
2990
|
CreateTime: time.Now().Unix(),
|
2891
|
2991
|
UpdateTime: time.Now().Unix(),
|
|
@@ -2903,7 +3003,7 @@ func (this *StockManagerApiController) AddDrugInformation() {
|
2903
|
3003
|
err_log := models.ExportErrLog{
|
2904
|
3004
|
LogType: 4,
|
2905
|
3005
|
UserOrgId: this.GetAdminUserInfo().CurrentOrgId,
|
2906
|
|
- ErrMsg: "第" + strconv.Itoa(index+2) + "行" + "的上次进价不能为空",
|
|
3006
|
+ ErrMsg: "第" + strconv.Itoa(index+2) + "行" + "的进货价不能为空",
|
2907
|
3007
|
Status: 1,
|
2908
|
3008
|
CreateTime: time.Now().Unix(),
|
2909
|
3009
|
UpdateTime: time.Now().Unix(),
|
|
@@ -2968,6 +3068,77 @@ func (this *StockManagerApiController) AddDrugInformation() {
|
2968
|
3068
|
}
|
2969
|
3069
|
}
|
2970
|
3070
|
|
|
3071
|
+ drug_dose := goodNameM["drug_dose"].(string)
|
|
3072
|
+
|
|
3073
|
+ if len(drug_dose) == 0 {
|
|
3074
|
+ err_log := models.ExportErrLog{
|
|
3075
|
+ LogType: 4,
|
|
3076
|
+ UserOrgId: this.GetAdminUserInfo().CurrentOrgId,
|
|
3077
|
+ ErrMsg: "第" + strconv.Itoa(index+2) + "行" + "的默认单次用量不能为空",
|
|
3078
|
+ Status: 1,
|
|
3079
|
+ CreateTime: time.Now().Unix(),
|
|
3080
|
+ UpdateTime: time.Now().Unix(),
|
|
3081
|
+ ExportTime: time.Now().Unix(),
|
|
3082
|
+ }
|
|
3083
|
+ service.CreateExportErrLog(&err_log)
|
|
3084
|
+ continue
|
|
3085
|
+ }
|
|
3086
|
+ drugDoses, _ := strconv.ParseFloat(drug_dose, 64)
|
|
3087
|
+ drug.DrugDose = drugDoses
|
|
3088
|
+
|
|
3089
|
+ var units = "单位"
|
|
3090
|
+ var unit_id int64
|
|
3091
|
+ drugDoseUnit := goodNameM["drug_dose_unit"].(string)
|
|
3092
|
+
|
|
3093
|
+ if len(drugDoseUnit) == 0 {
|
|
3094
|
+ err_log := models.ExportErrLog{
|
|
3095
|
+ LogType: 4,
|
|
3096
|
+ UserOrgId: this.GetAdminUserInfo().CurrentOrgId,
|
|
3097
|
+ ErrMsg: "第" + strconv.Itoa(index+2) + "行" + "的默认单次用量单位不能为空",
|
|
3098
|
+ Status: 1,
|
|
3099
|
+ CreateTime: time.Now().Unix(),
|
|
3100
|
+ UpdateTime: time.Now().Unix(),
|
|
3101
|
+ ExportTime: time.Now().Unix(),
|
|
3102
|
+ }
|
|
3103
|
+ service.CreateExportErrLog(&err_log)
|
|
3104
|
+ continue
|
|
3105
|
+ }
|
|
3106
|
+
|
|
3107
|
+ dataConfig, _ := service.GetDataConfigIsExist(0, units)
|
|
3108
|
+ if len(drugDoseUnit) != 0 {
|
|
3109
|
+ _, errcodedataconfig := service.GetChildeConfigIsExist(dataConfig.ID, drugDoseUnit, orgId)
|
|
3110
|
+ if errcodedataconfig == gorm.ErrRecordNotFound {
|
|
3111
|
+ childConfig, _ := service.GetLastChildeConfig(dataConfig.ID, orgId)
|
|
3112
|
+ dataconfig := models.Dataconfig{
|
|
3113
|
+ ParentId: dataConfig.ID,
|
|
3114
|
+ Module: "hemodialysis",
|
|
3115
|
+ OrgId: orgId,
|
|
3116
|
+ Name: drugDoseUnit,
|
|
3117
|
+ FieldName: "",
|
|
3118
|
+ Value: childConfig.Value + 1,
|
|
3119
|
+ CreatedTime: "",
|
|
3120
|
+ UpdatedTime: "",
|
|
3121
|
+ CreateUserId: adminUser.AdminUser.Id,
|
|
3122
|
+ Status: 1,
|
|
3123
|
+ Remark: "",
|
|
3124
|
+ DeleteIdSystem: 0,
|
|
3125
|
+ Title: "",
|
|
3126
|
+ Content: "",
|
|
3127
|
+ Order: 0,
|
|
3128
|
+ Code: "",
|
|
3129
|
+ FieldType: 0,
|
|
3130
|
+ }
|
|
3131
|
+ service.CreateDataConfig(&dataconfig)
|
|
3132
|
+ }
|
|
3133
|
+ }
|
|
3134
|
+ list, _ := service.FindAllDataConfigList(orgId, dataConfig.ID)
|
|
3135
|
+ for _, it := range list {
|
|
3136
|
+ if drugDoseUnit == it.Name {
|
|
3137
|
+ unit_id = int64(it.Value)
|
|
3138
|
+ }
|
|
3139
|
+ }
|
|
3140
|
+ drug.DrugDoseUnit = unit_id
|
|
3141
|
+
|
2971
|
3142
|
drug.DrugClassify = strconv.FormatInt(drug_classify_id, 10)
|
2972
|
3143
|
|
2973
|
3144
|
manufacturer := goodNameM["manufacturer"].(string)
|
|
@@ -3033,14 +3204,61 @@ func (this *StockManagerApiController) AddDrugInformation() {
|
3033
|
3204
|
}
|
3034
|
3205
|
drug.Dealer = dealer_id
|
3035
|
3206
|
|
3036
|
|
- pinyin := goodNameM["pinyin"].(string)
|
|
3207
|
+ lmt_used_flags := int64(goodNameM["lmt_used_flag"].(float64))
|
3037
|
3208
|
|
3038
|
|
- drug.Pinyin = pinyin
|
3039
|
|
- wubi := goodNameM["wubi"].(string)
|
3040
|
|
- drug.Wubi = wubi
|
|
3209
|
+ drug.LmtUsedFlag = lmt_used_flags
|
|
3210
|
+
|
|
3211
|
+ if goodNameM["drug_alias"] == nil || reflect.TypeOf(goodNameM["drug_alias"]).String() != "string" {
|
|
3212
|
+ utils.ErrorLog("drug_alias")
|
|
3213
|
+ return
|
|
3214
|
+ }
|
3041
|
3215
|
|
3042
|
|
- drug_alias_pinyin := goodNameM["drug_alias_pinyin"].(string)
|
3043
|
|
- drug.DrugAliasPinyin = drug_alias_pinyin
|
|
3216
|
+ drug_alias, _ := goodNameM["drug_alias"].(string)
|
|
3217
|
+
|
|
3218
|
+ drug.DrugAlias = drug_alias
|
|
3219
|
+
|
|
3220
|
+ drug_category := goodNameM["drug_category"].(string)
|
|
3221
|
+
|
|
3222
|
+ var drugCategory = "药品类别"
|
|
3223
|
+ var drug_category_id int64
|
|
3224
|
+
|
|
3225
|
+ drugCategoryConfig, _ := service.GetDrugDataConfig(0, drugCategory)
|
|
3226
|
+
|
|
3227
|
+ if len(drug_category) != 0 {
|
|
3228
|
+ _, drugcategoryerrcodes := service.IsExistDicConfig(drugCategoryConfig.ID, drug_category, orgId)
|
|
3229
|
+ if drugcategoryerrcodes == gorm.ErrRecordNotFound {
|
|
3230
|
+ drugCategoryConfigSix, _ := service.GetLastDicConfig(drugCategoryConfig.ID, orgId)
|
|
3231
|
+ dataconfig := models.DictDataconfig{
|
|
3232
|
+ ParentId: drugCategoryConfig.ID,
|
|
3233
|
+ Module: "system",
|
|
3234
|
+ OrgId: orgId,
|
|
3235
|
+ Name: drug_category,
|
|
3236
|
+ FieldName: "",
|
|
3237
|
+ Value: drugCategoryConfigSix.Value + 1,
|
|
3238
|
+ CreatedTime: "",
|
|
3239
|
+ UpdatedTime: "",
|
|
3240
|
+ CreateUserId: adminUser.AdminUser.Id,
|
|
3241
|
+ Status: 1,
|
|
3242
|
+ Remark: "",
|
|
3243
|
+ DeleteIdSystem: 0,
|
|
3244
|
+ Title: "",
|
|
3245
|
+ Content: "",
|
|
3246
|
+ Order: 0,
|
|
3247
|
+ Code: "",
|
|
3248
|
+ }
|
|
3249
|
+ service.CreatedDicConfig(&dataconfig)
|
|
3250
|
+ }
|
|
3251
|
+ }
|
|
3252
|
+
|
|
3253
|
+ drugCategoryList, _ := service.GetParentDataConfig(drugCategoryConfig.ID, orgId)
|
|
3254
|
+ fmt.Println("drugCategoryList", drugCategoryList)
|
|
3255
|
+ for _, it := range drugCategoryList {
|
|
3256
|
+ if drug_category == it.Name {
|
|
3257
|
+ drug_category_id = int64(it.Value)
|
|
3258
|
+ }
|
|
3259
|
+ }
|
|
3260
|
+
|
|
3261
|
+ drug.DrugCategory = drug_category_id
|
3044
|
3262
|
|
3045
|
3263
|
statistics_category := goodNameM["statistics_category"].(string)
|
3046
|
3264
|
|
|
@@ -3153,9 +3371,6 @@ func (this *StockManagerApiController) AddDrugInformation() {
|
3153
|
3371
|
limit_remark := goodNameM["limit_remark"].(string)
|
3154
|
3372
|
drug.LimitRemark = limit_remark
|
3155
|
3373
|
|
3156
|
|
- drug_alias_wubi := goodNameM["drug_alias_wubi"].(string)
|
3157
|
|
- drug.DrugAliasWubi = drug_alias_wubi
|
3158
|
|
-
|
3159
|
3374
|
drug_control := goodNameM["drug_control"].(string)
|
3160
|
3375
|
|
3161
|
3376
|
var drugControl = "开药控制"
|
|
@@ -3196,123 +3411,6 @@ func (this *StockManagerApiController) AddDrugInformation() {
|
3196
|
3411
|
}
|
3197
|
3412
|
drug.DrugControl = drug_control_id
|
3198
|
3413
|
|
3199
|
|
- drug_category := goodNameM["drug_category"].(string)
|
3200
|
|
-
|
3201
|
|
- var drugCategory = "药品类别"
|
3202
|
|
- var drug_category_id int64
|
3203
|
|
-
|
3204
|
|
- drugCategoryConfig, _ := service.GetDrugDataConfig(0, drugCategory)
|
3205
|
|
-
|
3206
|
|
- if len(drug_category) != 0 {
|
3207
|
|
- _, drugcategoryerrcodes := service.IsExistDicConfig(drugCategoryConfig.ID, drug_category, orgId)
|
3208
|
|
- if drugcategoryerrcodes == gorm.ErrRecordNotFound {
|
3209
|
|
- drugCategoryConfigSix, _ := service.GetLastDicConfig(drugCategoryConfig.ID, orgId)
|
3210
|
|
- dataconfig := models.DictDataconfig{
|
3211
|
|
- ParentId: drugCategoryConfig.ID,
|
3212
|
|
- Module: "system",
|
3213
|
|
- OrgId: orgId,
|
3214
|
|
- Name: drug_category,
|
3215
|
|
- FieldName: "",
|
3216
|
|
- Value: drugCategoryConfigSix.Value + 1,
|
3217
|
|
- CreatedTime: "",
|
3218
|
|
- UpdatedTime: "",
|
3219
|
|
- CreateUserId: adminUser.AdminUser.Id,
|
3220
|
|
- Status: 1,
|
3221
|
|
- Remark: "",
|
3222
|
|
- DeleteIdSystem: 0,
|
3223
|
|
- Title: "",
|
3224
|
|
- Content: "",
|
3225
|
|
- Order: 0,
|
3226
|
|
- Code: "",
|
3227
|
|
- }
|
3228
|
|
- service.CreatedDicConfig(&dataconfig)
|
3229
|
|
- }
|
3230
|
|
- }
|
3231
|
|
-
|
3232
|
|
- drugCategoryList, _ := service.GetParentDataConfig(drugCategoryConfig.ID, orgId)
|
3233
|
|
- fmt.Println("drugCategoryList", drugCategoryList)
|
3234
|
|
- for _, it := range drugCategoryList {
|
3235
|
|
- if drug_category == it.Name {
|
3236
|
|
- drug_category_id = int64(it.Value)
|
3237
|
|
- }
|
3238
|
|
- }
|
3239
|
|
-
|
3240
|
|
- drug.DrugCategory = drug_category_id
|
3241
|
|
-
|
3242
|
|
- drug_dose := goodNameM["drug_dose"].(string)
|
3243
|
|
-
|
3244
|
|
- if len(drug_dose) == 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
|
|
- drugDoses, _ := strconv.ParseFloat(drug_dose, 64)
|
3258
|
|
- drug.DrugDose = drugDoses
|
3259
|
|
-
|
3260
|
|
- var units = "单位"
|
3261
|
|
- var unit_id int64
|
3262
|
|
- drugDoseUnit := goodNameM["drug_dose_unit"].(string)
|
3263
|
|
-
|
3264
|
|
- if len(drugDoseUnit) == 0 {
|
3265
|
|
- err_log := models.ExportErrLog{
|
3266
|
|
- LogType: 4,
|
3267
|
|
- UserOrgId: this.GetAdminUserInfo().CurrentOrgId,
|
3268
|
|
- ErrMsg: "第" + strconv.Itoa(index+2) + "行" + "的剂量不能为空",
|
3269
|
|
- Status: 1,
|
3270
|
|
- CreateTime: time.Now().Unix(),
|
3271
|
|
- UpdateTime: time.Now().Unix(),
|
3272
|
|
- ExportTime: time.Now().Unix(),
|
3273
|
|
- }
|
3274
|
|
- service.CreateExportErrLog(&err_log)
|
3275
|
|
- continue
|
3276
|
|
- }
|
3277
|
|
-
|
3278
|
|
- dataConfig, _ := service.GetDataConfigIsExist(0, units)
|
3279
|
|
- if len(drugDoseUnit) != 0 {
|
3280
|
|
- _, errcodedataconfig := service.GetChildeConfigIsExist(dataConfig.ID, drugDoseUnit, orgId)
|
3281
|
|
- if errcodedataconfig == gorm.ErrRecordNotFound {
|
3282
|
|
- childConfig, _ := service.GetLastChildeConfig(dataConfig.ID, orgId)
|
3283
|
|
- dataconfig := models.Dataconfig{
|
3284
|
|
- ParentId: dataConfig.ID,
|
3285
|
|
- Module: "hemodialysis",
|
3286
|
|
- OrgId: orgId,
|
3287
|
|
- Name: drugDoseUnit,
|
3288
|
|
- FieldName: "",
|
3289
|
|
- Value: childConfig.Value + 1,
|
3290
|
|
- CreatedTime: "",
|
3291
|
|
- UpdatedTime: "",
|
3292
|
|
- CreateUserId: adminUser.AdminUser.Id,
|
3293
|
|
- Status: 1,
|
3294
|
|
- Remark: "",
|
3295
|
|
- DeleteIdSystem: 0,
|
3296
|
|
- Title: "",
|
3297
|
|
- Content: "",
|
3298
|
|
- Order: 0,
|
3299
|
|
- Code: "",
|
3300
|
|
- FieldType: 0,
|
3301
|
|
- }
|
3302
|
|
- service.CreateDataConfig(&dataconfig)
|
3303
|
|
- }
|
3304
|
|
- }
|
3305
|
|
- list, _ := service.FindAllDataConfigList(orgId, dataConfig.ID)
|
3306
|
|
- for _, it := range list {
|
3307
|
|
- if drugDoseUnit == it.Name {
|
3308
|
|
- unit_id = int64(it.Value)
|
3309
|
|
- }
|
3310
|
|
- }
|
3311
|
|
- drug.DrugDoseUnit = unit_id
|
3312
|
|
-
|
3313
|
|
- lmt_used_flags := int64(goodNameM["lmt_used_flag"].(float64))
|
3314
|
|
-
|
3315
|
|
- drug.LmtUsedFlag = lmt_used_flags
|
3316
|
3414
|
drugList = append(drugList, &drug)
|
3317
|
3415
|
}
|
3318
|
3416
|
|
|
@@ -3365,10 +3463,17 @@ func (this *StockManagerApiController) AddDrugInformation() {
|
3365
|
3463
|
DrugDose: item.DrugDose,
|
3366
|
3464
|
DrugDoseUnit: item.DrugDoseUnit,
|
3367
|
3465
|
LmtUsedFlag: item.LmtUsedFlag,
|
|
3466
|
+ Dosage: item.Dosage,
|
|
3467
|
+ Unval: item.Unval,
|
|
3468
|
+ PackingUnit: item.PackingUnit,
|
|
3469
|
+ PackingPrice: item.PackingPrice,
|
|
3470
|
+ DrugDay: item.DrugDay,
|
|
3471
|
+ DeliveryWay: item.DeliveryWay,
|
|
3472
|
+ ExecutionFrequency: item.ExecutionFrequency,
|
3368
|
3473
|
}
|
3369
|
3474
|
|
3370
|
3475
|
//查询同种药品同种规格是否存在
|
3371
|
|
- _, drugerror := service.IsExistDrugByName(item.DrugName, item.DrugSpec, orgId)
|
|
3476
|
+ _, drugerror := service.IsExistDrugByNameOne(item.DrugName, item.Dosage, item.MaxUnit, item.Unval, item.MinUnit, item.PackingUnit, orgId)
|
3372
|
3477
|
|
3373
|
3478
|
if drugerror == gorm.ErrRecordNotFound {
|
3374
|
3479
|
service.CreateDrugsInfomation(&goodInfo)
|