|
@@ -56,10 +56,33 @@
|
56
|
56
|
</div>
|
57
|
57
|
<div>
|
58
|
58
|
<el-button type="primary" @click="openForm(0)">新增</el-button>
|
|
59
|
+ <!-- <el-button type="primary" @click="BatchDelete()" v-if="$store.getters.xt_user.org_id == 9504 || $store.getters.xt_user.org_id == 10028" >批量备案</el-button>
|
|
60
|
+ <el-button type="primary" v-if="$store.getters.xt_user.org_id != 9504 && $store.getters.xt_user.org_id != 10028" @click="GDYBBatchPutOnRecord()">批量备案</el-button> -->
|
|
61
|
+ </div>
|
|
62
|
+
|
|
63
|
+ </div>
|
|
64
|
+ <div style="display:flex; align-items:center;margin-bottom:10px;">
|
59
|
65
|
<el-button type="primary" @click="BatchDelete()" v-if="$store.getters.xt_user.org_id == 9504 || $store.getters.xt_user.org_id == 10028" >批量备案</el-button>
|
60
|
66
|
<el-button type="primary" v-if="$store.getters.xt_user.org_id != 9504 && $store.getters.xt_user.org_id != 10028" @click="GDYBBatchPutOnRecord()">批量备案</el-button>
|
|
67
|
+ <!-- <el-link target="_blank" href="https://kuyi.shengws.com/drug_template.xlsx" :underline="false"
|
|
68
|
+ style="margin-left:15px">
|
|
69
|
+ <el-button
|
|
70
|
+ class="filter-item"
|
|
71
|
+ type="primary"
|
|
72
|
+ size="small"
|
|
73
|
+ >下载模版
|
|
74
|
+ </el-button>
|
|
75
|
+ </el-link>
|
|
76
|
+ <upload-excel :on-success='handleSuccessTwo'></upload-excel>
|
|
77
|
+ <el-button
|
|
78
|
+ style="margin-left:10px;"
|
|
79
|
+ @click="generateLog()"
|
|
80
|
+ class="filter-item"
|
|
81
|
+ type="primary"
|
|
82
|
+ size="small"
|
|
83
|
+ >下载日志
|
|
84
|
+ </el-button> -->
|
61
|
85
|
</div>
|
62
|
|
- </div>
|
63
|
86
|
<el-table :data="list" border style="width: 100%" :row-style="{ color: '#303133' }"
|
64
|
87
|
:header-cell-style="{backgroundColor: 'rgb(245, 247, 250)', color: '#606266'}"
|
65
|
88
|
@selection-change="handleSelectionChange">
|
|
@@ -176,7 +199,43 @@
|
176
|
199
|
:total="total"
|
177
|
200
|
>
|
178
|
201
|
</el-pagination>
|
|
202
|
+
|
179
|
203
|
|
|
204
|
+ <el-dialog
|
|
205
|
+ title="提示"
|
|
206
|
+ :visible.sync="dialogVisible"
|
|
207
|
+ width="40%"
|
|
208
|
+ >
|
|
209
|
+ <span>您提交的文档不是系统标准导入模板,请检查您的文档或重新 </span>
|
|
210
|
+ <span slot="footer" class="dialog-footer">
|
|
211
|
+ <el-button @click="dialogVisible = false">取 消</el-button>
|
|
212
|
+ <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
|
|
213
|
+ </span>
|
|
214
|
+ </el-dialog>
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+ <el-dialog
|
|
218
|
+ title="提示"
|
|
219
|
+ :visible.sync="exportLogVisible"
|
|
220
|
+ width="40%"
|
|
221
|
+ >
|
|
222
|
+
|
|
223
|
+ <div v-for="(item,index) in logs" :key="index">
|
|
224
|
+ <span> {{ item.export_time | parseTime('{y}-{m}-{d} {h}:{i}:{s}')}}</span>
|
|
225
|
+ <br/>
|
|
226
|
+ <br/>
|
|
227
|
+ <span>{{getContent(item)}}</span>
|
|
228
|
+ <span >点击</span>
|
|
229
|
+ <span style="color:blue" @click="generateTxt(item)">查看详情</span>
|
|
230
|
+ <br/>
|
|
231
|
+ <br/>
|
|
232
|
+ </div>
|
|
233
|
+
|
|
234
|
+ <span slot="footer" class="dialog-footer">
|
|
235
|
+ <el-button @click="exportLogVisible = false">取 消</el-button>
|
|
236
|
+ <el-button type="primary" @click="exportLogVisible = false">确 定</el-button>
|
|
237
|
+ </span>
|
|
238
|
+ </el-dialog>
|
180
|
239
|
</div>
|
181
|
240
|
</template>
|
182
|
241
|
|
|
@@ -185,8 +244,8 @@
|
185
|
244
|
import selfPayment from './selfPayment'
|
186
|
245
|
import maintain from './maintain'
|
187
|
246
|
import addDrugs from './addDrugs'
|
188
|
|
- import { GetAllManufacturer } from '@/api/stock'
|
189
|
|
- import { getDataConfig } from "@/utils/data";
|
|
247
|
+ import { GetAllManufacturer,postDrugInformation } from '@/api/stock'
|
|
248
|
+ import { getDataConfig,getDictionaryDataConfig } from "@/utils/data";
|
190
|
249
|
import { uParseTime } from '@/utils/tools'
|
191
|
250
|
import {
|
192
|
251
|
createBaseDrugLib,
|
|
@@ -198,11 +257,14 @@
|
198
|
257
|
deleteDurg
|
199
|
258
|
} from '@/api/data'
|
200
|
259
|
import {GetAllConfig } from "@/api/stock";
|
|
260
|
+ import { generateLog } from '@/api/config'
|
|
261
|
+ import UploadExcel from '@/xt_pages/components/UploadExcel'
|
201
|
262
|
export default {
|
202
|
263
|
components: {
|
203
|
264
|
selfPayment,
|
204
|
265
|
maintain,
|
205
|
|
- addDrugs
|
|
266
|
+ addDrugs,
|
|
267
|
+ UploadExcel
|
206
|
268
|
},
|
207
|
269
|
data() {
|
208
|
270
|
return {
|
|
@@ -341,6 +403,9 @@
|
341
|
403
|
|
342
|
404
|
dealer:[],
|
343
|
405
|
selectDrug:[],
|
|
406
|
+ dialogVisible:false,
|
|
407
|
+ exportLogVisible:false,
|
|
408
|
+ logs:[]
|
344
|
409
|
}
|
345
|
410
|
},
|
346
|
411
|
methods: {
|
|
@@ -661,7 +726,7 @@
|
661
|
726
|
} else {
|
662
|
727
|
this.total = response.data.data.total
|
663
|
728
|
this.list = []
|
664
|
|
- console.log("333333333",response.data.data.list)
|
|
729
|
+
|
665
|
730
|
for (let i = 0; i < response.data.data.list.length; i++) {
|
666
|
731
|
this.list.push(response.data.data.list[i])
|
667
|
732
|
}
|
|
@@ -838,6 +903,317 @@
|
838
|
903
|
})
|
839
|
904
|
});
|
840
|
905
|
},
|
|
906
|
+
|
|
907
|
+ handleSuccessTwo({ results, header }) {
|
|
908
|
+ console.log("hhhhhhhh",results)
|
|
909
|
+ if (header != undefined && header.length > 0) {
|
|
910
|
+
|
|
911
|
+ var isHasDrugName = header.includes('*药品名称')
|
|
912
|
+
|
|
913
|
+ var isHasDrugAlias = header.includes('*药品别名')
|
|
914
|
+
|
|
915
|
+ var isHasDrugSpec = header.includes('*药品规格')
|
|
916
|
+
|
|
917
|
+ var isHasDrugType = header.includes('*药品类型')
|
|
918
|
+
|
|
919
|
+ var isHasDrugStockLimit = header.includes('*库存警戒')
|
|
920
|
+
|
|
921
|
+ var isHasDrugOriginPlace= header.includes('*产地')
|
|
922
|
+
|
|
923
|
+ var isHasDrugDosageForm = header.includes('*药品剂型')
|
|
924
|
+
|
|
925
|
+ var isHasMaxUnit= header.includes('*最大单位')
|
|
926
|
+
|
|
927
|
+ var isHasMinUnit= header.includes('*最小单位')
|
|
928
|
+
|
|
929
|
+ var isHasUnitMatrixing= header.includes("*单位换算")
|
|
930
|
+
|
|
931
|
+ var isHasRetailPrice = header.includes('*单零售价')
|
|
932
|
+
|
|
933
|
+ var isHasLastPrice = header.includes('*上次进价')
|
|
934
|
+
|
|
935
|
+ var isHasDrugClassifye = header.includes('*药物分类')
|
|
936
|
+
|
|
937
|
+ var isHasManufacturer = header.includes('*生产厂商')
|
|
938
|
+
|
|
939
|
+ var isHasDealer = header.includes('*经销商')
|
|
940
|
+ if (!(isHasDrugName && isHasDrugAlias && isHasDrugSpec && isHasDrugType && isHasDrugStockLimit && isHasDrugOriginPlace && isHasDrugDosageForm && isHasMaxUnit && isHasMinUnit && isHasUnitMatrixing && isHasRetailPrice && isHasLastPrice && isHasDrugClassifye && isHasManufacturer && isHasDealer)) {
|
|
941
|
+ this.dialogVisible = true
|
|
942
|
+ return
|
|
943
|
+ }
|
|
944
|
+ }else {
|
|
945
|
+ this.dialogVisible = true
|
|
946
|
+ return
|
|
947
|
+ }
|
|
948
|
+
|
|
949
|
+ var tableData = []
|
|
950
|
+ for(let i=0;i<results.length;i++){
|
|
951
|
+ let obj = {"drug_type_id":0,"drug_dosage_form_id":0,"medical_insurance_level_id":0,"drug_classify_id":0,"manufacturer_id":0,"dealer_id":0}
|
|
952
|
+ for (var key in results[i]) {
|
|
953
|
+
|
|
954
|
+ if (results[i]['*药品名称'] === undefined) {
|
|
955
|
+ obj['drug_name'] = ''
|
|
956
|
+ } else {
|
|
957
|
+ if (key == '*药品名称') {
|
|
958
|
+ obj['drug_name'] = results[i][key].replace(/\s/g,"")
|
|
959
|
+ }
|
|
960
|
+ }
|
|
961
|
+
|
|
962
|
+
|
|
963
|
+ if (results[i]['*药品别名'] === undefined) {
|
|
964
|
+ obj['drug_alias'] = ''
|
|
965
|
+ } else {
|
|
966
|
+ if (key == '*药品别名') {
|
|
967
|
+ obj['drug_alias'] = results[i][key].replace(/\s/g,"")
|
|
968
|
+ }
|
|
969
|
+ }
|
|
970
|
+
|
|
971
|
+ if (results[i]['*药品规格'] === undefined) {
|
|
972
|
+ obj['drug_spec'] = ''
|
|
973
|
+ } else {
|
|
974
|
+ if (key == '*药品规格') {
|
|
975
|
+ obj['drug_spec'] = results[i][key].replace(/\s/g,"")
|
|
976
|
+ }
|
|
977
|
+ }
|
|
978
|
+
|
|
979
|
+ if (results[i]['*药品类型'] === undefined) {
|
|
980
|
+ obj['drug_type'] = ''
|
|
981
|
+ } else {
|
|
982
|
+ if (key == '*药品类型') {
|
|
983
|
+ obj['drug_type'] = results[i][key].replace(/\s/g,"")
|
|
984
|
+ }
|
|
985
|
+ }
|
|
986
|
+
|
|
987
|
+
|
|
988
|
+ if (results[i]['*库存警戒'] === undefined) {
|
|
989
|
+ obj['drug_stock_limit'] = ''
|
|
990
|
+ } else {
|
|
991
|
+ if (key == '*库存警戒') {
|
|
992
|
+ obj['drug_stock_limit'] = results[i][key].replace(/\s/g,"")
|
|
993
|
+ }
|
|
994
|
+ }
|
|
995
|
+
|
|
996
|
+ if (results[i]['*产地'] === undefined) {
|
|
997
|
+ obj['drug_origin_place'] = ''
|
|
998
|
+ } else {
|
|
999
|
+ if (key == '*产地') {
|
|
1000
|
+ obj['drug_origin_place'] = results[i][key].replace(/\s/g,"")
|
|
1001
|
+ }
|
|
1002
|
+ }
|
|
1003
|
+
|
|
1004
|
+ if (results[i]['*药品剂型'] === undefined) {
|
|
1005
|
+ obj['drug_dosage_form'] = ''
|
|
1006
|
+ } else {
|
|
1007
|
+ if (key == '*药品剂型') {
|
|
1008
|
+ obj['drug_dosage_form'] = results[i][key].replace(/\s/g,"")
|
|
1009
|
+ }
|
|
1010
|
+ }
|
|
1011
|
+
|
|
1012
|
+
|
|
1013
|
+ if (results[i]['*医保等级'] === undefined) {
|
|
1014
|
+ obj['medical_insurance_level'] = ''
|
|
1015
|
+ } else {
|
|
1016
|
+ if (key == '*医保等级') {
|
|
1017
|
+ obj['medical_insurance_level'] = results[i][key].replace(/\s/g,"")
|
|
1018
|
+ }
|
|
1019
|
+ }
|
|
1020
|
+
|
|
1021
|
+ if (results[i]['*最大单位'] === undefined) {
|
|
1022
|
+ obj['max_unit'] = ''
|
|
1023
|
+ } else {
|
|
1024
|
+ if (key == '*最大单位') {
|
|
1025
|
+ obj['max_unit'] = results[i][key].replace(/\s/g,"")
|
|
1026
|
+ }
|
|
1027
|
+ }
|
|
1028
|
+
|
|
1029
|
+ if (results[i]['*最小单位'] === undefined) {
|
|
1030
|
+ obj['min_unit'] = ''
|
|
1031
|
+ } else {
|
|
1032
|
+ if (key == '*最小单位') {
|
|
1033
|
+ obj['min_unit'] = results[i][key].replace(/\s/g,"")
|
|
1034
|
+ }
|
|
1035
|
+ }
|
|
1036
|
+
|
|
1037
|
+
|
|
1038
|
+ if (results[i]['*单位换算'] === undefined) {
|
|
1039
|
+ obj['unit_matrixing'] = ''
|
|
1040
|
+ } else {
|
|
1041
|
+ if (key == '*单位换算') {
|
|
1042
|
+ obj['unit_matrixing'] = results[i][key].replace(/\s/g,"")
|
|
1043
|
+ }
|
|
1044
|
+ }
|
|
1045
|
+
|
|
1046
|
+ if (results[i]['*单零售价'] === undefined) {
|
|
1047
|
+ obj['retail_price'] = ''
|
|
1048
|
+ } else {
|
|
1049
|
+ if (key == '*单零售价') {
|
|
1050
|
+ obj['retail_price'] = results[i][key].replace(/\s/g,"")
|
|
1051
|
+ }
|
|
1052
|
+ }
|
|
1053
|
+
|
|
1054
|
+
|
|
1055
|
+ if (results[i]['*上次进价'] === undefined) {
|
|
1056
|
+ obj['last_price'] = ''
|
|
1057
|
+ } else {
|
|
1058
|
+ if (key == '*上次进价') {
|
|
1059
|
+ obj['last_price'] = results[i][key].replace(/\s/g,"")
|
|
1060
|
+ }
|
|
1061
|
+ }
|
|
1062
|
+
|
|
1063
|
+ if (results[i]['*药物分类'] === undefined) {
|
|
1064
|
+ obj['drug_classify'] = ''
|
|
1065
|
+ } else {
|
|
1066
|
+ if (key == '*药物分类') {
|
|
1067
|
+ obj['drug_classify'] = results[i][key].replace(/\s/g,"")
|
|
1068
|
+ }
|
|
1069
|
+ }
|
|
1070
|
+
|
|
1071
|
+
|
|
1072
|
+ if (results[i]['*生产厂商'] === undefined) {
|
|
1073
|
+ obj['manufacturer'] = ''
|
|
1074
|
+ } else {
|
|
1075
|
+ if (key == '*生产厂商') {
|
|
1076
|
+ obj['manufacturer'] = results[i][key].replace(/\s/g,"")
|
|
1077
|
+ }
|
|
1078
|
+ }
|
|
1079
|
+
|
|
1080
|
+ if (results[i]['*经销商'] === undefined) {
|
|
1081
|
+ obj['dealer'] = ''
|
|
1082
|
+ } else {
|
|
1083
|
+ if (key == '*经销商') {
|
|
1084
|
+ obj['dealer'] = results[i][key].replace(/\s/g,"")
|
|
1085
|
+ }
|
|
1086
|
+
|
|
1087
|
+ }
|
|
1088
|
+ }
|
|
1089
|
+ tableData.push(obj)
|
|
1090
|
+ console.log("表哥2222",tableData)
|
|
1091
|
+
|
|
1092
|
+ var drugType = this.getDictionaryDataConfig('system','drug_type')
|
|
1093
|
+
|
|
1094
|
+
|
|
1095
|
+ var drugDosageForm = this.getDictionaryDataConfig('system','drug_dosage_form')
|
|
1096
|
+
|
|
1097
|
+ var medicalInsuranceLevel = this.getDictionaryDataConfig('system','medical_insurance_level')
|
|
1098
|
+
|
|
1099
|
+
|
|
1100
|
+ var drugClassify = this.getDictionaryDataConfig('system','drug_classify')
|
|
1101
|
+
|
|
1102
|
+
|
|
1103
|
+ var goodUnit = this.$store.getters.good_unit
|
|
1104
|
+
|
|
1105
|
+
|
|
1106
|
+ for(let i=0;i<tableData.length;i++){
|
|
1107
|
+ for(let j=0;j<drugType.length;j++){
|
|
1108
|
+ if(tableData[i].drug_type == drugType[j].name){
|
|
1109
|
+ tableData[i].drug_type_id = drugType[j].id
|
|
1110
|
+ }
|
|
1111
|
+ }
|
|
1112
|
+
|
|
1113
|
+ for(let j=0;j<drugDosageForm.length;j++){
|
|
1114
|
+ if(tableData[i].drug_dosage_form == drugDosageForm[j].name){
|
|
1115
|
+ tableData[i].drug_dosage_form_id = drugDosageForm[j].id
|
|
1116
|
+ }
|
|
1117
|
+ }
|
|
1118
|
+
|
|
1119
|
+ for(let j=0;j<medicalInsuranceLevel.length;j++){
|
|
1120
|
+ if(tableData[i].medical_insurance_level == medicalInsuranceLevel[j].name){
|
|
1121
|
+ tableData[i].medical_insurance_level_id = medicalInsuranceLevel[j].id
|
|
1122
|
+ }
|
|
1123
|
+ }
|
|
1124
|
+
|
|
1125
|
+ for(let j=0;j<drugClassify.length;j++){
|
|
1126
|
+ if(tableData[i].drug_classify == drugClassify[j].name){
|
|
1127
|
+ tableData[i].drug_classify_id = drugClassify[j].id
|
|
1128
|
+ }
|
|
1129
|
+ }
|
|
1130
|
+
|
|
1131
|
+ console.log("生产",this.manufacturers)
|
|
1132
|
+ for(let j=0;j<this.manufacturers.length;j++){
|
|
1133
|
+ if(tableData[i].manufacturer == this.manufacturers[j].manufacturer_name){
|
|
1134
|
+ tableData[i].manufacturer_id = this.manufacturers[j].id
|
|
1135
|
+ }
|
|
1136
|
+ }
|
|
1137
|
+ console.log("经销商",this.dealer)
|
|
1138
|
+ for(let j=0;j<this.dealer.length;j++){
|
|
1139
|
+ if(tableData[i].dealer == this.dealer[j].dealer_name){
|
|
1140
|
+ tableData[i].dealer_id = this.dealer[j].id
|
|
1141
|
+ }
|
|
1142
|
+ }
|
|
1143
|
+
|
|
1144
|
+ }
|
|
1145
|
+ }
|
|
1146
|
+ for(let i=0;i<tableData.length;i++){
|
|
1147
|
+ tableData[i].retail_price = parseInt(tableData[i].retail_price)
|
|
1148
|
+ tableData[i].last_price = parseInt(tableData[i].last_price)
|
|
1149
|
+ }
|
|
1150
|
+
|
|
1151
|
+ let params = {
|
|
1152
|
+ 'drugs':tableData
|
|
1153
|
+ }
|
|
1154
|
+ console.log("params2222",params)
|
|
1155
|
+ postDrugInformation(params).then(response=>{
|
|
1156
|
+ if(response.data.state == 1){
|
|
1157
|
+ var msg = response.data.data.msg
|
|
1158
|
+ this.$message.success("导入成功!")
|
|
1159
|
+ }else{
|
|
1160
|
+ this.$message.error("导入失败")
|
|
1161
|
+ }
|
|
1162
|
+ })
|
|
1163
|
+ },
|
|
1164
|
+ generateTxt: function(log) {
|
|
1165
|
+ var content = ''
|
|
1166
|
+ var errlog = log.err_logs
|
|
1167
|
+ content = this.getContent(log)
|
|
1168
|
+ for (let i = 0; i < errlog.length; i++) {
|
|
1169
|
+ if (content.length == 0) {
|
|
1170
|
+ content = errlog[i].err_msg
|
|
1171
|
+ } else {
|
|
1172
|
+ content = content + '\n' + errlog[i].err_msg
|
|
1173
|
+ }
|
|
1174
|
+ }
|
|
1175
|
+
|
|
1176
|
+ var url = new Blob(['\ufeff' + content], { type: 'text/txt,charset=UTF-8' })
|
|
1177
|
+ if (typeof url === 'object' && url instanceof Blob) {
|
|
1178
|
+ url = URL.createObjectURL(url) // 创建blob地址
|
|
1179
|
+ }
|
|
1180
|
+ const aLink = document.createElement('a')
|
|
1181
|
+ aLink.href = url
|
|
1182
|
+ aLink.download = this.timestampToTime(log.export_time) + '患者导入日志' + '.txt'
|
|
1183
|
+ aLink.click()
|
|
1184
|
+
|
|
1185
|
+ },
|
|
1186
|
+ getContent(log) {
|
|
1187
|
+ return '您导入的文档共' + log.total_num + '条患者数据' + ',' + '已成功导入' + log.success_num + '条,导入失败' + log.fail_num + '条,'
|
|
1188
|
+ },
|
|
1189
|
+ timestampToTime(timestamp) {
|
|
1190
|
+ var date = new Date(timestamp * 1000)//时间戳为10位需*1000,时间戳为13位的话不需乘1000
|
|
1191
|
+ var Y = date.getFullYear() + '年'
|
|
1192
|
+ var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '月'
|
|
1193
|
+ var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + '日 '
|
|
1194
|
+ var h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) + '时'
|
|
1195
|
+ var m = (date.getMinutes() < 10 ? '0' + (date.getMinutes()) : date.getMinutes()) + '分'
|
|
1196
|
+ var s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds()) + '秒'
|
|
1197
|
+ return Y + M + D + h + m + s
|
|
1198
|
+ },
|
|
1199
|
+ generateLog() {
|
|
1200
|
+ let params = {
|
|
1201
|
+ 'log_type': 4
|
|
1202
|
+ }
|
|
1203
|
+ generateLog(params).then(
|
|
1204
|
+ response => {
|
|
1205
|
+ if (response.data.state === 1) {
|
|
1206
|
+ this.logs = response.data.data.logs
|
|
1207
|
+ this.exportLogVisible = true
|
|
1208
|
+ } else {
|
|
1209
|
+ this.$message.error(response.data.msg)
|
|
1210
|
+ }
|
|
1211
|
+ }
|
|
1212
|
+ )
|
|
1213
|
+ },
|
|
1214
|
+ getDictionaryDataConfig(module,filed_name){
|
|
1215
|
+ return getDictionaryDataConfig(module,filed_name)
|
|
1216
|
+ },
|
841
|
1217
|
},
|
842
|
1218
|
created() {
|
843
|
1219
|
this.getList()
|