drugs.vue 58KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726
  1. <template>
  2. <div class="page_drugs">
  3. <div style="display:flex;justify-content: space-between;width:100%;margin-bottom:20px;">
  4. <div class="cell clearfix" style="margin-bottom:0;">
  5. <el-input style="width: 180px;margin-right:10px;" @keyup.enter.native='searchAction'
  6. class="filter-item" v-model="keywords"/>
  7. <el-button style="margin-right:10px;" class="filter-item" type="primary" icon="el-icon-search"
  8. @click="searchAction">搜索
  9. </el-button>
  10. <label class="title"><span class="name">生产厂商</span> : </label>
  11. <el-select v-model="manufacturer" style="width:140px;margin-right:10px;" placeholder="请选择" @change="changeManufacture">
  12. <el-option
  13. v-for="item in manufacturers"
  14. :key="item.id"
  15. :label="item.manufacturer_name"
  16. :value="item.id">
  17. </el-option>
  18. </el-select>
  19. <label class="title"><span class="name">是否备案</span> : </label>
  20. <el-select v-model="is_charge" style="width:140px;margin-right:10px;" placeholder="请选择" @change="changeCharge">
  21. <el-option
  22. v-for="item in options"
  23. :key="item.value"
  24. :label="item.label"
  25. :value="item.value">
  26. </el-option>
  27. </el-select>
  28. <span style="color: #909399;font-size:14px;">是否停用 : &nbsp;</span>
  29. <el-select v-model="is_use" style="width:140px;margin-right:10px;" placeholder="请选择" @change="changeRecord">
  30. <el-option
  31. v-for="item in optionsOne"
  32. :key="item.value"
  33. :label="item.label"
  34. :value="item.value">
  35. </el-option>
  36. </el-select>
  37. </div>
  38. <div>
  39. <el-button type="primary" @click="openForm(0)">新增</el-button>
  40. </div>
  41. </div>
  42. <div style="display:flex; align-items:center;margin-bottom:10px;">
  43. <!--<el-button type="primary" size="small" @click="BatchDelete()" v-if="$store.getters.xt_user.org_id == 9504 || this.$store.getters.xt_user.org_id == 10138 || $store.getters.xt_user.org_id == 10028" >批量备案</el-button>-->
  44. <el-button type="primary" size="small" @click="GDYBBatchPutOnRecord()">批量备案</el-button>
  45. <el-link target="_blank" href="https://kuyi.shengws.com/drugsTemplateOne.xlsx" :underline="false"
  46. style="margin-left:15px">
  47. <el-button
  48. class="filter-item"
  49. type="primary"
  50. size="small"
  51. >下载模版
  52. </el-button>
  53. </el-link>
  54. <upload-excel :on-success='handleSuccessTwo'></upload-excel>
  55. <el-button
  56. style="margin-left:10px;"
  57. @click="generateLog()"
  58. class="filter-item"
  59. type="primary"
  60. size="small"
  61. >下载日志
  62. </el-button>
  63. <el-button
  64. style="margin-left:10px;"
  65. @click="exportList()"
  66. class="filter-item"
  67. type="primary"
  68. size="small"
  69. >点击导出
  70. </el-button>
  71. <el-button
  72. style="margin-left:10px;"
  73. @click="jiaoBen()"
  74. class="filter-item"
  75. type="primary"
  76. size="small"
  77. >脚本
  78. </el-button>
  79. </div>
  80. <el-table :data="list" border style="width: 100%" :row-style="{ color: '#303133' }"
  81. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)', color: '#606266'}"
  82. @selection-change="handleSelectionChange">
  83. <el-table-column
  84. align="center"
  85. type="selection"
  86. width="55"
  87. ></el-table-column>
  88. <el-table-column type="index" label="序号" width="60px" align="center"></el-table-column>
  89. <el-table-column prop="date" label="药品名称" align="center" >
  90. <template slot-scope="scope">
  91. <div>{{scope.row.drug_name}}</div>
  92. </template>
  93. </el-table-column>
  94. <el-table-column prop="date" label="单位&规格" align="center">
  95. <template slot-scope="scope">
  96. <div>
  97. <span>{{scope.row.dose}}{{scope.row.dose_unit}}&nbsp;* &nbsp;</span>{{scope.row.min_number}}{{scope.row.min_unit}}/{{scope.row.max_unit}}
  98. </div>
  99. </template>
  100. </el-table-column>
  101. <el-table-column prop="date" label="进货价" width="100" align="center">
  102. <template slot-scope="scope">
  103. <div>{{scope.row.last_price}}</div>
  104. </template>
  105. </el-table-column>
  106. <el-table-column label="拆零零售价" width="100" align="center">
  107. <template slot-scope="scope">
  108. <div>{{scope.row.min_price}}</div>
  109. </template>
  110. </el-table-column>
  111. <el-table-column label="包装零售价" width="100" align="center">
  112. <template slot-scope="scope">
  113. <div>{{scope.row.retail_price}}</div>
  114. </template>
  115. </el-table-column>
  116. <el-table-column prop="date" label="国家编码" width="100" align="center">
  117. <template slot-scope="scope">
  118. <div>{{scope.row.medical_insurance_number}}</div>
  119. </template>
  120. </el-table-column>
  121. <el-table-column prop="date" label="批准文号" width="100" align="center">
  122. <template slot-scope="scope">
  123. <div>{{scope.row.number}}</div>
  124. </template>
  125. </el-table-column>
  126. <el-table-column prop="date" label="药品本位码" width="100" align="center">
  127. <template slot-scope="scope">
  128. <div>{{scope.row.code}}</div>
  129. </template>
  130. </el-table-column>
  131. <el-table-column prop="date" label="生产厂商" align="center" width="100">
  132. <template slot-scope="scope">
  133. <div>{{getName(scope.row.manufacturer)}}</div>
  134. </template>
  135. </el-table-column>
  136. <el-table-column prop="date" label="经销商" align="center" width="100">
  137. <template slot-scope="scope">
  138. <div>{{getDealer(scope.row.dealer)}}</div>
  139. </template>
  140. </el-table-column>
  141. <el-table-column prop="date" label="备案日期" align="center" width="100">
  142. <template slot-scope="scope">
  143. <span>{{getTime(scope.row.record_date)}}</span>
  144. </template>
  145. </el-table-column>
  146. <!-- <el-table-column prop="date" label="药品备注" align="center" width="100">
  147. <template slot-scope="scope">
  148. <div>{{scope.row.drug_remark}}</div>
  149. </template>
  150. </el-table-column> -->
  151. <el-table-column label="状态" width="60" align="center">
  152. <template slot-scope="scope">
  153. <div>{{scope.row.drug_status.indexOf('停用') == -1 ? '启用':'停用' }}</div>
  154. </template>
  155. </el-table-column>
  156. <el-table-column prop="date" label="操作" width="280" align="center" fixed="right">
  157. <template slot-scope="scope">
  158. <el-button @click="openForm(scope.row.id)" type="primary" size="small">编辑</el-button>
  159. <el-button type="danger" size="small" @click="deleteDurg(scope.row.id,scope.$index)">删除</el-button>
  160. <!--<el-button type="primary" size="small" icon="el-icon-refresh-left" @click="toReturn(scope.row.id,scope.row.is_mark)" v-if="$store.getters.xt_user.org_id == 9504 || $store.getters.xt_user.org_id == 10028 || $store.getters.xt_user.org_id == 10138" >-->
  161. <!--<span v-if="scope.row.is_mark == 0">备案</span>-->
  162. <!--<span v-if="scope.row.is_mark == 1">撤消</span>-->
  163. <!--</el-button>-->
  164. <el-button type="primary" size="small" icon="el-icon-refresh-left">
  165. <span @click="putOnRecord(scope.row.id)" >目录对照</span>
  166. <span @click="putOnUnRecord(scope.row.id)" >撤消对照</span>
  167. </el-button>
  168. </template>
  169. </el-table-column>
  170. </el-table>
  171. <self-payment ref='selfPayment'></self-payment>
  172. <add-drugs ref='addDrugs'
  173. :titles="title"
  174. :formValue="formValue"
  175. :isCreated="isCreated"
  176. :manufacturers="manufacturers"
  177. v-on:dialog-comfirm="goodInfoDialogComfirm"
  178. v-on:dialog-cancle="goodInfoDialogCancle"
  179. ></add-drugs>
  180. <!-- <maintain ref='maintain'></maintain> -->
  181. <el-pagination
  182. @size-change="handleSizeChange"
  183. @current-change="handleCurrentChange"
  184. :page-sizes="[10, 50, 100,500,1000]"
  185. :page-size="10"
  186. background
  187. align="right"
  188. style="margin-top:20px;"
  189. layout="total, sizes, prev, pager, next, jumper"
  190. :total="total"
  191. >
  192. </el-pagination>
  193. <el-dialog
  194. title="提示"
  195. :visible.sync="dialogVisible"
  196. width="40%"
  197. >
  198. <span>您提交的文档不是系统标准导入模板,请检查您的文档或重新 </span>
  199. <span slot="footer" class="dialog-footer">
  200. <el-button @click="dialogVisible = false">取 消</el-button>
  201. <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
  202. </span>
  203. </el-dialog>
  204. <el-dialog
  205. title="提示"
  206. :visible.sync="exportLogVisible"
  207. width="40%"
  208. >
  209. <div v-for="(item,index) in logs" :key="index">
  210. <span> {{ item.export_time | parseTime('{y}-{m}-{d} {h}:{i}:{s}')}}</span>
  211. <br/>
  212. <br/>
  213. <span>{{getContent(item)}}</span>
  214. <span >点击</span>
  215. <span style="color:blue" @click="generateTxt(item)">查看详情</span>
  216. <br/>
  217. <br/>
  218. </div>
  219. <span slot="footer" class="dialog-footer">
  220. <el-button @click="exportLogVisible = false">取 消</el-button>
  221. <el-button type="primary" @click="exportLogVisible = false">确 定</el-button>
  222. </span>
  223. </el-dialog>
  224. </div>
  225. </template>
  226. <script>
  227. import axios from 'axios'
  228. import selfPayment from './selfPayment'
  229. import maintain from './maintain'
  230. import addDrugs from './addDrugs'
  231. import { GetAllManufacturer,postDrugInformation,getInitializtion,updateBaseDrugLibByUserOrgId } from '@/api/stock'
  232. import { getDataConfig,getDictionaryDataConfig } from "@/utils/data";
  233. import { uParseTime } from '@/utils/tools'
  234. import {
  235. createBaseDrugLib,
  236. createDrugUnitSafeguard,
  237. createMedicineInsurancePercent,
  238. editBaseDrugLib,
  239. getBaseDrugLib,
  240. getBaseDrugLibList,
  241. deleteDurg
  242. } from '@/api/data'
  243. import {GetAllConfig } from "@/api/stock";
  244. import { generateLog } from '@/api/config'
  245. import UploadExcel from '@/xt_pages/components/UploadExcel'
  246. export default {
  247. components: {
  248. selfPayment,
  249. maintain,
  250. addDrugs,
  251. UploadExcel
  252. },
  253. data() {
  254. return {
  255. page: 0,
  256. limit: 10,
  257. keywords: '',
  258. is_use: '',
  259. is_charge: '',
  260. manufacturer:'',
  261. is_record:"",
  262. is_inject: '',
  263. list: [],
  264. isCreated: 1,
  265. manufacturers: [],
  266. title: '',
  267. formValue: {
  268. drug_name: '',//药品名称
  269. pinyin: '',//拼音
  270. wubi: '',//五笔输入法
  271. drug_alias: '',//药品别名
  272. drug_alias_pinyin: '',//别名拼音
  273. drug_alias_wubi: '',//别名五笔
  274. drug_category: '',//药品类别
  275. drug_spec: '',//药品规格
  276. drug_type: '',//药品类型
  277. drug_stock_limit: '',//库存警戒
  278. drug_origin_place: '',//产地
  279. drug_dosage_form: '',//药品剂型
  280. medical_insurance_level: '',//医保等级
  281. max_unit: '',//最大单位
  282. min_unit: '',//最小单位
  283. unit_matrixing: '',//单位换算
  284. retail_price: '',//零售价
  285. last_price: '',//上次进价
  286. drug_control: '',//开药控制
  287. number: '',//批准文号
  288. drug_classify: '',//药物分类
  289. drug_dose: '',//药品剂量
  290. drug_dose_unit: '',
  291. medical_insurance_number: '',//医保编号
  292. provinces_code:'',//省编码
  293. manufacturer: '', //生产产商
  294. pharmacology_category: '',//药理分类
  295. statistics_category: '',//统计分类
  296. code: '',//本位码
  297. is_special_diseases: '',//是否特病目录
  298. is_record: '',//是否备案
  299. agent: '',// 代理商
  300. drug_status: '',// 状态
  301. limit_remark: '',//药品追溯码
  302. delivery_way: '',//默认给药途径
  303. execution_frequency: '',//默认执行频率
  304. single_dose: '',//默认单次用量
  305. prescribing_number: '',//默认开药数量
  306. label: '',//标签
  307. sort: '',//收费项目排序
  308. is_use_doctor_advice: '',//是否常用医嘱
  309. is_default: '',//是否默认
  310. is_charge_predict: '',//是否收费预估项
  311. is_statistics_work: '',//是否统计工作量
  312. is_charge_use: '',//是否收费常用项
  313. drug_code: '',
  314. hosp_appr_flag:'',
  315. lmt_used_flag:'',
  316. dose_unit:'',
  317. min_price:'',
  318. drug_day:"",//默认开药天数,
  319. total:"",
  320. is_user:"",
  321. bbx01:"",
  322. bby01:"",
  323. is_show:"",
  324. },
  325. tempFormValue: {
  326. drug_name: '',//药品名称
  327. pinyin: '',//拼音
  328. wubi: '',//五笔输入法
  329. drug_alias: '',//药品别名
  330. drug_alias_pinyin: '',//别名拼音
  331. drug_alias_wubi: '',//别名五笔
  332. drug_category: '',//药品类别
  333. drug_spec: '',//药品规格
  334. drug_type: '',//药品类型
  335. drug_stock_limit: '',//库存警戒
  336. drug_origin_place: '',//产地
  337. drug_dosage_form: '',//药品剂型
  338. medical_insurance_level: '',//医保等级
  339. max_unit: '',//最大单位
  340. min_unit: '',//最小单位
  341. unit_matrixing: '',//单位换算
  342. retail_price: '',//零售价
  343. last_price: '',//上次进价
  344. drug_control: '',//开药控制
  345. number: '',//批准文号
  346. drug_classify: '',//药物分类
  347. drug_dose: '',//药品剂量
  348. drug_dose_unit: '',
  349. medical_insurance_number: '',//医保编号
  350. provinces_code:"",
  351. manufacturer: '', //生产产商
  352. pharmacology_category: '',//药理分类
  353. statistics_category: '',//统计分类
  354. code: '',//本位码
  355. is_special_diseases: '',//是否特病目录
  356. is_record: '',//是否备案
  357. agent: '',// 代理商
  358. drug_status: '',// 状态
  359. limit_remark: '',//限制说明
  360. delivery_way: '',//默认给药途径
  361. execution_frequency: '',//默认执行频率
  362. single_dose: '',//默认单次用量
  363. prescribing_number: '',//默认开药数量
  364. label: '',//标签
  365. sort: '',//收费项目排序
  366. is_use_doctor_advice: '',//是否常用医嘱
  367. is_default: '',//是否默认
  368. is_charge_predict: '',//是否收费预估项
  369. is_statistics_work: '',//是否统计工作量
  370. is_zero_flag: '',//是否拆零
  371. is_charge_use: '',//是否收费常用项
  372. drug_code: '',
  373. social_security_directory_code:'',
  374. is_mark:'',
  375. prescription_mark:'',
  376. hosp_appr_flag:'',
  377. lmt_used_flag:'',
  378. dosage:'', //剂量
  379. unval:'',//拆零
  380. packing_unit:"",//包装单位
  381. packing_price:"",//包装零售价
  382. drug_day:"",//默认开药天数
  383. total:"",
  384. is_user:"",
  385. bbx01:"",
  386. bby01:"",
  387. },
  388. current_id: 0,
  389. search_input: '',
  390. total:0,
  391. options: [
  392. {
  393. value: '0',
  394. label: '全部'
  395. }, {
  396. value: '1',
  397. label: '已备案'
  398. }, {
  399. value: '2',
  400. label: '未备案'
  401. }],
  402. optionsOne: [
  403. {
  404. value: '0',
  405. label: '全部'
  406. }, {
  407. value: '1',
  408. label: '是'
  409. }, {
  410. value: '2',
  411. label: '否'
  412. }],
  413. value: '',
  414. dealer:[],
  415. selectDrug:[],
  416. dialogVisible:false,
  417. exportLogVisible:false,
  418. logs:[],
  419. drugTypeList:[],
  420. drugCategoryList:[],
  421. drugDosageFormList:[],
  422. medicalInsuranceLevelList:[],
  423. drugControlList:[],
  424. drugClassifyList:[],
  425. statisticsCategoryList:[],
  426. pharmacologyCategoryList:[],
  427. }
  428. },
  429. methods: {
  430. GDYBBatchPutOnRecord(){
  431. var that = this;
  432. var ids = [];
  433. var idMap = {};
  434. for (const index in this.selectDrug) {
  435. ids.push(this.selectDrug[index].id);
  436. idMap[this.selectDrug[index].id] = this.selectDrug[index].id;
  437. }
  438. let params = {
  439. ids:ids.join(','),
  440. record_type: 1,
  441. admin_user_id:this.$store.getters.xt_user.user.id
  442. };
  443. axios.get('http://127.0.0.1:9532/api/checkcode/get',{params:params}).then(function(response) {
  444. if (response.data.state == 0) {
  445. that.$message.error(response.data.data.msg);
  446. return false
  447. } else {
  448. if(response.data.data.failed_code == -10){
  449. // that.$message.error(response.data.data.msg)
  450. that.$confirm(response.data.data.msg, '医保错误信息', {
  451. confirmButtonText: '确 定',
  452. type: 'warning'
  453. }).then(() => {
  454. }).catch(() => {
  455. })
  456. }else{
  457. }
  458. }
  459. }).catch(function(error) {
  460. })
  461. },
  462. handleSizeChange(val) {
  463. this.limit = val;
  464. this.getList()
  465. },
  466. handleCurrentChange(val) {
  467. this.page = val;
  468. this.getList()
  469. },
  470. changeInject(val) {
  471. this.getList()
  472. },
  473. changeCharge(val) {
  474. this.getList()
  475. },
  476. changeUser(val) {
  477. this.getList()
  478. },
  479. changeManufacture(){
  480. this.getList()
  481. },
  482. changeRecord(){
  483. this.getList()
  484. },
  485. getName(id) {
  486. if(id == 0){
  487. return ''
  488. }else{
  489. for (let i = 0; i < this.manufacturers.length; i++) {
  490. if (this.manufacturers[i].id == id) {
  491. return this.manufacturers[i].manufacturer_name
  492. }
  493. }
  494. return ''
  495. }
  496. },
  497. getDealer(id){
  498. if (id == 0) {
  499. return ""
  500. }else{
  501. var name = "";
  502. for(let i=0;i<this.dealer.length;i++){
  503. if(this.dealer[i].id == id){
  504. name = this.dealer[i].dealer_name
  505. }
  506. }
  507. return name
  508. }
  509. },
  510. goodInfoDialogComfirm: function(val) {
  511. //修改自备药
  512. var untit = "";
  513. var untis = getDataConfig('hemodialysis','units');
  514. for(let i=0;i<untis.length;i++){
  515. if(val.min_unit == untis[i].id){
  516. untit = untis[i].name
  517. }
  518. }
  519. if (val.id > 0) {
  520. //修改
  521. val['id'] = this.current_id;
  522. val.min_number = parseInt(val.min_number)
  523. console.log("Val323323232",val)
  524. editBaseDrugLib(val,untit).then(response => {
  525. if (response.data.state == 0) {
  526. this.$message.error(response.data.msg);
  527. return false
  528. } else {
  529. this.$refs.addDrugs.hide();
  530. this.getList();
  531. this.$message.success('修改成功')
  532. }
  533. })
  534. } else if (val.id == 0) {
  535. //新增
  536. createBaseDrugLib(val).then(response => {
  537. if (response.data.state == 0) {
  538. this.$message.error(response.data.msg);
  539. return false
  540. } else {
  541. this.$refs.addDrugs.hide();
  542. this.getList();
  543. this.$message.success('新增成功')
  544. }
  545. })
  546. }
  547. },
  548. goodInfoDialogCancle: function() {
  549. this.$refs.addDrugs.hide()
  550. },
  551. getAllManufacturer: function() {
  552. this.manufacturers = [];
  553. GetAllManufacturer().then(response => {
  554. if (response.data.state == 0) {
  555. this.$message.error(response.data.msg);
  556. return false
  557. } else {
  558. var obj = {id:0,manufacturer_name:"全部"};
  559. this.manufacturers.push(obj);
  560. for (let i = 0; i < response.data.data.manufacturer.length; i++) {
  561. this.manufacturers.push(response.data.data.manufacturer[i])
  562. }
  563. }
  564. })
  565. },
  566. searchAction() {
  567. this.getList()
  568. },
  569. clickSelfPayment(drug_id) {
  570. this.$refs.selfPayment.show(drug_id, 1)
  571. },
  572. clickMainTain() {
  573. // this.$refs.maintain.show();
  574. },
  575. openForm(id) {
  576. this.current_id = id;
  577. this.getAllManufacturer();
  578. if (id > 0) {
  579. let params = {
  580. id: this.current_id
  581. };
  582. getBaseDrugLib(params).then(response => {
  583. if (response.data.state == 0) {
  584. this.$message.error(response.data.msg);
  585. return false
  586. } else {
  587. console.log("药品详情",response.data.data.drug)
  588. for (let key in response.data.data.drug) {
  589. this.formValue[key] = response.data.data.drug[key]
  590. }
  591. if(this.formValue.is_special_diseases <= 0){
  592. this.formValue.is_special_diseases = ''
  593. } else{
  594. this.formValue.is_special_diseases = this.formValue.is_special_diseases.toString()
  595. }
  596. if(this.formValue.is_record <= 0){
  597. this.formValue.is_record = ''
  598. } else{
  599. this.formValue.is_record = this.formValue.is_record.toString()
  600. }
  601. if(this.formValue.is_use_doctor_advice <= 0){
  602. this.formValue.is_use_doctor_advice = ''
  603. } else{
  604. this.formValue.is_use_doctor_advice = this.formValue.is_use_doctor_advice.toString()
  605. }
  606. if(this.formValue.is_default <= 0){
  607. this.formValue.is_default = ''
  608. } else{
  609. this.formValue.is_default = this.formValue.is_default.toString()
  610. }
  611. if(this.formValue.is_user <= 0){
  612. this.formValue.is_user = ''
  613. } else{
  614. this.formValue.is_user = this.formValue.is_user.toString()
  615. }
  616. if(this.formValue.is_charge_predict <= 0){
  617. this.formValue.is_charge_predict = ''
  618. } else{
  619. this.formValue.is_charge_predict = this.formValue.is_charge_predict.toString()
  620. }
  621. if(this.formValue.is_statistics_work <= 0){
  622. this.formValue.is_statistics_work = ''
  623. } else{
  624. this.formValue.is_statistics_work = this.formValue.is_statistics_work.toString()
  625. }
  626. if(this.formValue.is_zero_flag <= 0){
  627. this.formValue.is_zero_flag = ''
  628. } else{
  629. this.formValue.is_zero_flag = this.formValue.is_zero_flag.toString()
  630. }
  631. if(this.formValue.is_charge_use <= 0){
  632. this.formValue.is_charge_use = ''
  633. } else{
  634. this.formValue.is_charge_use = this.formValue.is_charge_use.toString()
  635. }
  636. if(this.formValue.prescription_mark<=0){
  637. this.formValue.prescription_mark = ''
  638. }else{
  639. this.formValue.prescription_mark = this.formValue.prescription_mark.toString()
  640. }
  641. this.formValue.record_date = this.getTime(this.formValue.record_date);
  642. if(this.formValue.drug_category == 0){
  643. this.formValue.drug_category = ""
  644. }
  645. if(this.formValue.drug_control == 0){
  646. this.formValue.drug_control = ""
  647. }
  648. if(this.formValue.pharmacology_category == 0){
  649. this.formValue.pharmacology_category = ""
  650. }
  651. if(this.formValue.statistics_category == 0){
  652. this.formValue.statistics_category = ""
  653. }
  654. if(this.formValue.pinyin == 0){
  655. this.formValue.pinyin = ""
  656. }
  657. if(this.formValue.wubi == 0){
  658. this.formValue.wubi = ""
  659. }
  660. if(this.formValue.last_price == 0){
  661. this.formValue.last_price = ""
  662. }
  663. if(this.formValue.retail_price == 0){
  664. this.formValue.retail_price = ""
  665. }
  666. if(this.formValue.social_security_directory_code == 0){
  667. this.formValue.social_security_directory_code = ""
  668. }
  669. if(this.formValue.is_mark == 0){
  670. this.formValue.is_mark = ""
  671. }
  672. if(this.formValue.prescription_mark == 0){
  673. this.formValue.prescription_mark = ""
  674. }
  675. if(this.formValue.hosp_appr_flag == 0){
  676. this.formValue.hosp_appr_flag = ""
  677. }
  678. if(this.formValue.drug_classify == 0){
  679. this.formValue.drug_classify = ""
  680. }
  681. if(this.formValue.is_project<=0){
  682. this.formValue.is_project = ''
  683. }else{
  684. this.formValue.is_project = this.formValue.is_project.toString()
  685. }
  686. if(this.formValue.is_show<=0){
  687. this.formValue.is_show = ''
  688. }else{
  689. this.formValue.is_show = this.formValue.is_show.toString()
  690. }
  691. if(this.formValue.is_self_drug <=0){
  692. this.formValue.is_self_drug = ""
  693. }else{
  694. this.formValue.is_self_drug = this.formValue.is_self_drug.toString()
  695. }
  696. this.$refs.addDrugs.show(id, this.formValue)
  697. }
  698. })
  699. } else {
  700. for (let key in this.tempFormValue) {
  701. this.formValue[key] = this.tempFormValue[key]
  702. }
  703. this.$refs.addDrugs.show(0, this.formValue)
  704. }
  705. },
  706. deleteDurg(id,index){
  707. this.$confirm('确认删除吗?', '删除', {
  708. confirmButtonText: '确 定',
  709. cancelButtonText: '取 消',
  710. type: 'warning'
  711. }).then(() => {
  712. const params = {
  713. id:id,
  714. };
  715. deleteDurg(params).then(response => {
  716. if (response.data.state == 1) {
  717. var msg = response.data.data.msg;
  718. this.list.splice(index, 1);
  719. this.$message.success("删除成功")
  720. } else {
  721. this.$message.error("药品已经出库不能删除")
  722. }
  723. })
  724. })
  725. .catch(() => {
  726. })
  727. },
  728. getList() {
  729. let params = {
  730. page: this.page,
  731. limit: this.limit,
  732. keyword: this.keywords,
  733. is_use: this.is_use,
  734. is_charge: this.is_charge,
  735. is_inject: this.is_inject,
  736. manufacturer:this.manufacturer,
  737. is_record:this.is_record
  738. };
  739. getBaseDrugLibList(params).then(response => {
  740. if (response.data.state == 0) {
  741. this.$message.error(response.data.msg);
  742. return false
  743. } else {
  744. this.total = response.data.data.total;
  745. this.list = [];
  746. for (let i = 0; i < response.data.data.list.length; i++) {
  747. this.list.push(response.data.data.list[i])
  748. }
  749. console.log("数据库字典",this.list)
  750. }
  751. })
  752. },
  753. getDataConfig(module, filed_name){
  754. return getDataConfig(module, filed_name)
  755. },
  756. putOnUnRecord(id){
  757. var that = this;
  758. let params = {
  759. ids:id.toString(),
  760. record_type: 1,
  761. admin_user_id:this.$store.getters.xt_user.user.id
  762. };
  763. axios.get('http://127.0.0.1:9532/api/uncheckcode/get',{params:params}).then(function(response) {
  764. if (response.data.state == 0) {
  765. that.$message.error(response.data.data.msg);
  766. return false
  767. } else {
  768. if(response.data.data.failed_code == -10){
  769. // that.$message.error(response.data.data.msg)
  770. that.$confirm(response.data.data.msg, '医保错误信息', {
  771. confirmButtonText: '确 定',
  772. type: 'warning'
  773. }).then(() => {
  774. }).catch(() => {
  775. })
  776. }else{
  777. // for (let i = 0; i < that.tableData.length; i++) {
  778. // if (that.tableData[i].id == that.currentObject.id) {
  779. // that.tableData[i].record.is_cancel == 1
  780. // }
  781. // }
  782. }
  783. }
  784. }).catch(function(error) {
  785. })
  786. },
  787. putOnRecord(id){
  788. var that = this;
  789. let params = {
  790. ids:id.toString(),
  791. record_type: 1,
  792. admin_user_id:this.$store.getters.xt_user.user.id
  793. };
  794. axios.get('http://127.0.0.1:9532/api/checkcode/get',{params:params}).then(function(response) {
  795. if (response.data.state == 0) {
  796. that.$message.error(response.data.data.msg);
  797. return false
  798. } else {
  799. if(response.data.data.failed_code == -10){
  800. // that.$message.error(response.data.data.msg)
  801. that.$confirm(response.data.data.msg, '医保错误信息', {
  802. confirmButtonText: '确 定',
  803. type: 'warning'
  804. }).then(() => {
  805. }).catch(() => {
  806. })
  807. }else{
  808. }
  809. }
  810. }).catch(function(error) {
  811. })
  812. },
  813. // toRecord(){
  814. // var that = this
  815. // axios.get('http://127.0.0.1:9532/sz/api/drug/get').then(function(response) {
  816. // if (response.data.state == 0) {
  817. // that.$message.error(response.data.msg)
  818. // return false
  819. // } else {
  820. // that.$message({ message: '备案成功', type: 'success' })
  821. // that.getList()
  822. // }
  823. // }).catch(function(error) {
  824. // })
  825. // },
  826. toReturn(id,isMark){
  827. var that = this;
  828. let params = {
  829. 'id':id,
  830. 'type_id':1,
  831. 'is_mark':isMark,
  832. 'admin_user_id':this.$store.getters.xt_user.user.id
  833. };
  834. axios.get('http://127.0.0.1:9532/sz/api/revocation/get',{params:params}).then(function(response) {
  835. if (response.data.state == 0) {
  836. that.$message.error(response.data.data.msg);
  837. return false
  838. } else {
  839. if(response.data.data.msg == ""){
  840. that.$message.success("备案成功!");
  841. that.getList()
  842. }
  843. if(response.data.data.msg!=""){
  844. that.$message.error(response.data.data.msg);
  845. that.getList()
  846. }
  847. }
  848. }).catch(function(error) {
  849. })
  850. },
  851. GetAllConfig(){
  852. GetAllConfig().then(response => {
  853. if (response.data.state == 0) {
  854. this.$message.error(response.data.msg);
  855. return false;
  856. } else {
  857. this.dealer = response.data.data.dealer;
  858. }
  859. });
  860. },
  861. getTime(val) {
  862. if(val < 0){
  863. return ""
  864. }
  865. if(val == ""){
  866. return ""
  867. }else {
  868. return uParseTime(val, '{y}-{m}-{d}')
  869. }
  870. },
  871. handleSelectionChange(val){
  872. this.selectDrug = val
  873. },
  874. BatchDelete() {
  875. if (this.selectDrug.length == 0) {
  876. this.$message.error("请选择要备案的信息");
  877. return false;
  878. }
  879. this.$confirm(
  880. "确认要备案所选记录吗? <br>",
  881. "备案提示",
  882. {
  883. dangerouslyUseHTMLString: true,
  884. confirmButtonText: "确定",
  885. cancelButtonText: "取消",
  886. type: "warning"
  887. }
  888. ).then(() => {
  889. var ids = [];
  890. var idMap = {};
  891. for (const index in this.selectDrug) {
  892. ids.push(this.selectDrug[index].id);
  893. idMap[this.selectDrug[index].id] = this.selectDrug[index].id;
  894. }
  895. var idss = ids.join(',');
  896. let params = {
  897. ids:idss,
  898. admin_user_id:this.$store.getters.xt_user.user.id
  899. };
  900. var that = this;
  901. axios.get('http://127.0.0.1:9532/sz/api/drug/get',{ params: params }).then(function(response) {
  902. if (response.data.state == 0) {
  903. that.$message.error(response.data.data.msg);
  904. return false
  905. } else {
  906. if(response.data.data.msg == ""){
  907. that.$message.success("备案成功!");
  908. that.getList()
  909. }
  910. if(response.data.data.msg!=""){
  911. that.$message.error(response.data.data.msg);
  912. that.getList()
  913. }
  914. }
  915. }).catch(function(error) {
  916. })
  917. });
  918. },
  919. handleSuccessTwo({ results, header }) {
  920. if (header != undefined && header.length > 0) {
  921. var isHasDrugName = header.includes('*药品名称');
  922. console.log("isHasDrugName",isHasDrugName)
  923. var isHasDosage = header.includes('*剂量')
  924. console.log("isHasDosage",isHasDosage)
  925. var isHasMaxUnit= header.includes('*剂量单位');
  926. console.log("isHasMaxUnit",isHasMaxUnit)
  927. var isHasUnval = header.includes('*拆零');
  928. console.log("isHasUnval",isHasUnval)
  929. var isHasMinUnit= header.includes('*拆零单位');
  930. console.log("isHasMinUnit",isHasMinUnit)
  931. var isHasPackingUnit = header.includes('*包装单位')
  932. console.log("isHasPackingUnit",isHasPackingUnit)
  933. var isHasDrugType = header.includes('*药品类型');
  934. console.log("isHasDrugType",isHasDrugType)
  935. var isHasDrugStockLimit = header.includes('*库存警戒');
  936. console.log("isHasDrugStockLimit",isHasDrugStockLimit)
  937. var isHasDrugOriginPlace= header.includes('*产地');
  938. console.log("isHasDrugOriginPlace",isHasDrugOriginPlace)
  939. var isHasDrugDosageForm = header.includes('*药品剂型');
  940. console.log("isHasDrugDosageForm",isHasDrugDosageForm)
  941. var isHasRetailPrice = header.includes('*拆零零售价');
  942. console.log("isHasRetailPrice",isHasRetailPrice)
  943. var isHasPackingPrice= header.includes('*包装零售价');
  944. console.log("isHasLastPrice",isHasPackingPrice)
  945. var isHasLastPrice = header.includes('*进货价');
  946. console.log("进货价",isHasLastPrice)
  947. var isHasDrugClassifye = header.includes('*药物分类');
  948. console.log("isHasDrugClassifye",isHasDrugClassifye)
  949. var isHasManufacturer = header.includes('*生产厂商');
  950. console.log("isHasManufacturer",isHasManufacturer)
  951. var isHasDrugDose = header.includes('*默认单次用量');
  952. console.log("isHasDrugDose",isHasDrugDose)
  953. var isDrugDoseUnit = header.includes('*默认单次用量单位');
  954. console.log("isDrugDoseUnit",isDrugDoseUnit)
  955. if (!(isHasDrugName && isHasDosage && isHasMaxUnit && isHasUnval && isHasMinUnit && isHasPackingUnit && isHasDrugType && isHasDrugStockLimit && isHasDrugOriginPlace &&
  956. isHasDrugDosageForm && isHasRetailPrice && isHasPackingPrice && isHasLastPrice && isHasDrugClassifye && isHasManufacturer && isHasDrugDose && isDrugDoseUnit)) {
  957. this.dialogVisible = true;
  958. return
  959. }
  960. }else {
  961. this.dialogVisible = true;
  962. return
  963. }
  964. var tableData = [];
  965. for(let i=1;i<results.length;i++){
  966. 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,"statistics_category_id":0,"drug_control_id":0,"pharmacology_category_id":0,"drug_category_id":0,"prescribing_number":"","prescribing_number_unit":"","drug_day":"","delivery_way":"","execution_frequency":""};
  967. for (var key in results[i]) {
  968. if (results[i]['*药品名称'] === undefined) {
  969. obj['drug_name'] = ''
  970. } else {
  971. if (key == '*药品名称') {
  972. obj['drug_name'] = results[i][key].replace(/\s/g,"")
  973. }
  974. }
  975. if (results[i]['*剂量'] === undefined) {
  976. obj['dose'] = ''
  977. } else {
  978. if (key == '*剂量') {
  979. obj['dose'] = results[i][key].replace(/\s/g,"")
  980. }
  981. }
  982. if (results[i]['*剂量单位'] === undefined) {
  983. obj['dose_unit'] = ''
  984. } else {
  985. if (key == '*剂量单位') {
  986. obj['dose_unit'] = results[i][key].replace(/\s/g,"")
  987. }
  988. }
  989. if (results[i]['*拆零'] === undefined) {
  990. obj['min_number'] = ''
  991. } else {
  992. if (key == '*拆零') {
  993. obj['min_number'] = results[i][key].replace(/\s/g,"")
  994. }
  995. }
  996. if (results[i]['*拆零单位'] === undefined) {
  997. obj['min_unit'] = ''
  998. } else {
  999. if (key == '*拆零单位') {
  1000. obj['min_unit'] = results[i][key].replace(/\s/g,"")
  1001. }
  1002. }
  1003. if (results[i]['*包装单位'] === undefined) {
  1004. obj['max_unit'] = ''
  1005. } else {
  1006. if (key == '*包装单位') {
  1007. obj['max_unit'] = results[i][key].replace(/\s/g,"")
  1008. }
  1009. }
  1010. if (results[i]['*药品类型'] === undefined) {
  1011. obj['drug_type'] = ''
  1012. } else {
  1013. if (key == '*药品类型') {
  1014. obj['drug_type'] = results[i][key].replace(/\s/g,"")
  1015. }
  1016. }
  1017. if (results[i]['*库存警戒'] === undefined) {
  1018. obj['drug_stock_limit'] = ''
  1019. } else {
  1020. if (key == '*库存警戒') {
  1021. obj['drug_stock_limit'] = results[i][key].replace(/\s/g,"")
  1022. }
  1023. }
  1024. if (results[i]['*产地'] === undefined) {
  1025. obj['drug_origin_place'] = ''
  1026. } else {
  1027. if (key == '*产地') {
  1028. obj['drug_origin_place'] = results[i][key].replace(/\s/g,"")
  1029. }
  1030. }
  1031. if (results[i]['*药品剂型'] === undefined) {
  1032. obj['drug_dosage_form'] = ''
  1033. } else {
  1034. if (key == '*药品剂型') {
  1035. obj['drug_dosage_form'] = results[i][key].replace(/\s/g,"")
  1036. }
  1037. }
  1038. if (results[i]['*拆零零售价'] === undefined) {
  1039. obj['min_price'] = ''
  1040. } else {
  1041. if (key == '*拆零零售价') {
  1042. obj['min_price'] = results[i][key].replace(/\s/g,"")
  1043. }
  1044. }
  1045. if (results[i]['*包装零售价'] === undefined) {
  1046. obj['retail_price'] = ''
  1047. } else {
  1048. if (key == '*包装零售价') {
  1049. obj['retail_price'] = results[i][key].replace(/\s/g,"")
  1050. }
  1051. }
  1052. if (results[i]['*包装零售价'] === undefined) {
  1053. obj['packing_price'] = ''
  1054. } else {
  1055. if (key == '*包装零售价') {
  1056. obj['packing_price'] = results[i][key].replace(/\s/g,"")
  1057. }
  1058. }
  1059. if (results[i]['*进货价'] === undefined) {
  1060. obj['last_price'] = ''
  1061. } else {
  1062. if (key == '*进货价') {
  1063. obj['last_price'] = results[i][key].replace(/\s/g,"")
  1064. }
  1065. }
  1066. if (results[i]['*药物分类'] === undefined) {
  1067. obj['drug_classify'] = ''
  1068. } else {
  1069. if (key == '*药物分类') {
  1070. obj['drug_classify'] = results[i][key].replace(/\s/g,"")
  1071. }
  1072. }
  1073. if (results[i]['*默认单次用量'] === undefined) {
  1074. obj['drug_dose'] = ''
  1075. } else {
  1076. if (key == '*默认单次用量') {
  1077. obj['drug_dose'] = results[i][key].replace(/\s/g,"")
  1078. }
  1079. }
  1080. if (results[i]['*默认单次用量单位'] === undefined) {
  1081. obj['drug_dose_unit'] = ''
  1082. } else {
  1083. if (key == '*默认单次用量单位') {
  1084. obj['drug_dose_unit'] = results[i][key].replace(/\s/g,"")
  1085. }
  1086. }
  1087. if (results[i]['*生产厂商'] === undefined) {
  1088. obj['manufacturer'] = ''
  1089. } else {
  1090. if (key == '*生产厂商') {
  1091. obj['manufacturer'] = results[i][key].replace(/\s/g,"")
  1092. }
  1093. }
  1094. if (results[i]['经销商'] === undefined) {
  1095. obj['dealer'] = ''
  1096. } else {
  1097. if (key == '经销商') {
  1098. obj['dealer'] = results[i][key].replace(/\s/g,"")
  1099. }
  1100. }
  1101. if (results[i]['*默认给药途径'] === undefined) {
  1102. obj['delivery_way'] = ''
  1103. } else {
  1104. if (key == '*默认给药途径') {
  1105. obj['delivery_way'] = results[i][key].replace(/\s/g,"")
  1106. }
  1107. }
  1108. if (results[i]['*默认执行频率'] === undefined) {
  1109. obj['execution_frequency'] = ''
  1110. } else {
  1111. if (key == '*默认执行频率') {
  1112. obj['execution_frequency'] = results[i][key].replace(/\s/g,"")
  1113. }
  1114. }
  1115. if (results[i]['*默认开药数量'] === undefined) {
  1116. obj['prescribing_number'] = ''
  1117. } else {
  1118. if (key == '*默认开药数量') {
  1119. obj['prescribing_number'] = parseInt(results[i][key].replace(/\s/g,""))
  1120. }
  1121. }
  1122. if (results[i]['*默认开药数量单位'] === undefined) {
  1123. obj['prescribing_number_unit'] = ''
  1124. } else {
  1125. if (key == '*默认开药数量单位') {
  1126. obj['prescribing_number_unit'] = results[i][key].replace(/\s/g,"")
  1127. }
  1128. }
  1129. if (results[i]['*默认开药天数'] === undefined) {
  1130. obj['drug_day'] = ''
  1131. } else {
  1132. if (key == '*默认开药天数') {
  1133. obj['drug_day'] = results[i][key].replace(/\s/g,"")
  1134. }
  1135. }
  1136. if (results[i]['限制性用药'] === undefined) {
  1137. obj['lmt_used_flag'] = ''
  1138. } else {
  1139. if (key == '限制性用药') {
  1140. obj['lmt_used_flag'] = results[i][key].replace(/\s/g,"")
  1141. }
  1142. }
  1143. if (results[i]['药品别名'] === undefined) {
  1144. obj['drug_alias'] = ''
  1145. } else {
  1146. if (key == '药品别名') {
  1147. obj['drug_alias'] = results[i][key].replace(/\s/g,"")
  1148. }
  1149. }
  1150. if (results[i]['药品类别'] === undefined) {
  1151. obj['drug_category'] = ''
  1152. } else {
  1153. if (key == '药品类别') {
  1154. obj['drug_category'] = results[i][key].replace(/\s/g,"")
  1155. }
  1156. }
  1157. if (results[i]['开药控制'] === undefined) {
  1158. obj['drug_control'] = ''
  1159. } else {
  1160. if (key == '开药控制') {
  1161. obj['drug_control'] = results[i][key].replace(/\s/g,"")
  1162. }
  1163. }
  1164. if (results[i]['批准文号'] === undefined) {
  1165. obj['number'] = ''
  1166. } else {
  1167. if (key == '批准文号') {
  1168. obj['number'] = results[i][key].replace(/\s/g,"")
  1169. }
  1170. }
  1171. if (results[i]['审批标志'] === undefined) {
  1172. obj['hosp_appr_flag'] = ''
  1173. } else {
  1174. if (key == '审批标志') {
  1175. obj['hosp_appr_flag'] = results[i][key].replace(/\s/g,"")
  1176. }
  1177. }
  1178. if (results[i]['医保编码'] === undefined) {
  1179. obj['medical_insurance_number'] = ''
  1180. } else {
  1181. if (key == '医保编码') {
  1182. obj['medical_insurance_number'] = results[i][key].replace(/\s/g,"")
  1183. }
  1184. }
  1185. if (results[i]['省编码'] === undefined) {
  1186. obj['provinces_code'] = ''
  1187. } else {
  1188. if (key == '省编码') {
  1189. obj['provinces_code'] = results[i][key].replace(/\s/g,"")
  1190. }
  1191. }
  1192. if (results[i]['药理分类'] === undefined) {
  1193. obj['pharmacology_category'] = ''
  1194. } else {
  1195. if (key == '药理分类') {
  1196. obj['pharmacology_category'] = results[i][key].replace(/\s/g,"")
  1197. }
  1198. }
  1199. if (results[i]['统计分类'] === undefined) {
  1200. obj['statistics_category'] = ''
  1201. } else {
  1202. if (key == '统计分类') {
  1203. obj['statistics_category'] = results[i][key].replace(/\s/g,"")
  1204. }
  1205. }
  1206. if (results[i]['本位码'] === undefined) {
  1207. obj['code'] = ''
  1208. } else {
  1209. if (key == '本位码') {
  1210. obj['code'] = results[i][key].replace(/\s/g,"")
  1211. }
  1212. }
  1213. if (results[i]['是否特病目录'] === undefined) {
  1214. obj['is_special_diseases'] = ''
  1215. } else {
  1216. if (key == '是否特病目录') {
  1217. obj['is_special_diseases'] = results[i][key].replace(/\s/g,"")
  1218. }
  1219. }
  1220. if (results[i]['是否备案'] === undefined) {
  1221. obj['is_record'] = ''
  1222. } else {
  1223. if (key == '是否备案') {
  1224. obj['is_record'] = results[i][key].replace(/\s/g,"")
  1225. }
  1226. }
  1227. if (results[i]['处方药标志'] === undefined) {
  1228. obj['prescription_mark'] = ''
  1229. } else {
  1230. if (key == '处方药标志') {
  1231. obj['prescription_mark'] = results[i][key].replace(/\s/g,"")
  1232. }
  1233. }
  1234. if (results[i]['社保目录编码'] === undefined) {
  1235. obj['social_security_directory_code'] = ''
  1236. } else {
  1237. if (key == '社保目录编码') {
  1238. obj['social_security_directory_code'] = results[i][key].replace(/\s/g,"")
  1239. }
  1240. }
  1241. if (results[i]['备案日期'] === undefined) {
  1242. obj['record_date'] = ''
  1243. } else {
  1244. if (key == '备案日期') {
  1245. obj['record_date'] = results[i][key].replace(/\s/g,"")
  1246. }
  1247. }
  1248. if (results[i]['药品备注'] === undefined) {
  1249. obj['drug_remark'] = ''
  1250. } else {
  1251. if (key == '药品备注') {
  1252. obj['drug_remark'] = results[i][key].replace(/\s/g,"")
  1253. }
  1254. }
  1255. if (results[i]['状态'] === undefined) {
  1256. obj['drug_status'] = ''
  1257. } else {
  1258. if (key == '状态') {
  1259. obj['drug_status'] = results[i][key].replace(/\s/g,"")
  1260. }
  1261. }
  1262. if (results[i]['限制说明'] === undefined) {
  1263. obj['limit_remark'] = ''
  1264. } else {
  1265. if (key == '限制说明') {
  1266. obj['limit_remark'] = results[i][key].replace(/\s/g,"")
  1267. }
  1268. }
  1269. }
  1270. var newArr = [];
  1271. tableData.push(obj);
  1272. for(let i=0;i<tableData.length;i++){
  1273. if(tableData[i].is_special_diseases == ""){
  1274. tableData[i].is_special_diseases = 0
  1275. }
  1276. if(tableData[i].is_special_diseases == "是"){
  1277. tableData[i].is_special_diseases = 1
  1278. }
  1279. if(tableData[i].is_special_diseases == "否"){
  1280. tableData[i].is_special_diseases = 2
  1281. }
  1282. if(tableData[i].is_record == ""){
  1283. tableData[i].is_record = 0
  1284. }
  1285. if(tableData[i].is_record == "是"){
  1286. tableData[i].is_record = 1
  1287. }
  1288. if(tableData[i].is_record == "否"){
  1289. tableData[i].is_record = 2
  1290. }
  1291. if(tableData[i].prescription_mark == ""){
  1292. tableData[i].prescription_mark = 0
  1293. }
  1294. if(tableData[i].prescription_mark == "是"){
  1295. tableData[i].prescription_mark =1
  1296. }
  1297. if(tableData[i].prescription_mark == "否"){
  1298. tableData[i].prescription_mark =2
  1299. }
  1300. if(tableData[i].hosp_appr_flag == ""){
  1301. tableData[i].hosp_appr_flag = 0
  1302. }
  1303. if(tableData[i].hosp_appr_flag == "无需审批"){
  1304. tableData[i].hosp_appr_flag = 1
  1305. }
  1306. if(tableData[i].hosp_appr_flag == "审批通过"){
  1307. tableData[i].hosp_appr_flag = 2
  1308. }
  1309. if(tableData[i].hosp_appr_flag == "审批不通过"){
  1310. tableData[i].hosp_appr_flag = 3
  1311. }
  1312. if(tableData[i].lmt_used_flag == ""){
  1313. tableData[i].lmt_used_flag = 0
  1314. }
  1315. if(tableData[i].lmt_used_flag == "否"){
  1316. tableData[i].lmt_used_flag = 0
  1317. }
  1318. if(tableData[i].lmt_used_flag == "是"){
  1319. tableData[i].lmt_used_flag = 1
  1320. }
  1321. }
  1322. }
  1323. for(let i=0;i<tableData.length;i++){
  1324. tableData[i].dose = tableData[i].dose.toString()
  1325. }
  1326. let params = {
  1327. 'drugs':tableData
  1328. };
  1329. console.log("params222222222",params)
  1330. postDrugInformation(params).then(response=>{
  1331. if(response.data.state == 1){
  1332. var msg = response.data.data.msg;
  1333. this.getList();
  1334. this.getAllManufacturer();
  1335. this.GetAllConfig();
  1336. this.$message.success("导入成功!")
  1337. }else{
  1338. this.$message.error("导入失败,请下载日志查看")
  1339. }
  1340. })
  1341. },
  1342. generateTxt: function(log) {
  1343. var content = '';
  1344. var errlog = log.err_logs;
  1345. content = this.getContent(log);
  1346. for (let i = 0; i < errlog.length; i++) {
  1347. if (content.length == 0) {
  1348. content = errlog[i].err_msg
  1349. } else {
  1350. content = content + '\n' + errlog[i].err_msg
  1351. }
  1352. }
  1353. var url = new Blob(['\ufeff' + content], { type: 'text/txt,charset=UTF-8' });
  1354. if (typeof url === 'object' && url instanceof Blob) {
  1355. url = URL.createObjectURL(url) // 创建blob地址
  1356. }
  1357. const aLink = document.createElement('a');
  1358. aLink.href = url;
  1359. aLink.download = this.timestampToTime(log.export_time) + '患者导入日志' + '.txt';
  1360. aLink.click()
  1361. },
  1362. getContent(log) {
  1363. return '您导入的文档共' + log.total_num + '条患者数据' + ',' + '已成功导入' + log.success_num + '条,导入失败' + log.fail_num + '条,'
  1364. },
  1365. timestampToTime(timestamp) {
  1366. var date = new Date(timestamp * 1000);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
  1367. var Y = date.getFullYear() + '年';
  1368. var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '月';
  1369. var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + '日 ';
  1370. var h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) + '时';
  1371. var m = (date.getMinutes() < 10 ? '0' + (date.getMinutes()) : date.getMinutes()) + '分';
  1372. var s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds()) + '秒';
  1373. return Y + M + D + h + m + s
  1374. },
  1375. generateLog() {
  1376. let params = {
  1377. 'log_type': 4
  1378. };
  1379. generateLog(params).then(
  1380. response => {
  1381. if (response.data.state === 1) {
  1382. this.logs = response.data.data.logs;
  1383. this.exportLogVisible = true
  1384. } else {
  1385. this.$message.error(response.data.msg)
  1386. }
  1387. }
  1388. )
  1389. },
  1390. getDictionaryDataConfig(module,filed_name){
  1391. return getDictionaryDataConfig(module,filed_name)
  1392. },
  1393. exportList(){
  1394. import('@/vendor/Export2Excel').then(excel => {
  1395. console.log("this.table",this.list)
  1396. for(let i=0;i<this.list.length;i++){
  1397. for(let j=0;j<this.drugCategoryList.length;j++){
  1398. if(this.list[i].drug_category == this.drugCategoryList[j].value){
  1399. this.list[i].drug_category_name = this.drugCategoryList[j].name
  1400. }
  1401. }
  1402. for(let z=0;z<this.drugDosageFormList.length;z++){
  1403. if(this.list[i].drug_dosage_form == this.drugDosageFormList[z].value){
  1404. this.list[i].drug_dosage_form_name = this.drugDosageFormList[z].name
  1405. }
  1406. }
  1407. for(let h=0;h<this.drugClassifyList.length;h++){
  1408. if(this.list[i].drug_classify == this.drugClassifyList[h].value){
  1409. this.list[i].drug_classify_name = this.drugClassifyList[h].name
  1410. }
  1411. }
  1412. for(let y=0;y<this.manufacturers.length;y++){
  1413. if(this.list[i].manufacturer == this.manufacturers[y].id){
  1414. this.list[i].manufacturer_name = this.manufacturers[y].manufacturer_name
  1415. }
  1416. }
  1417. for(let s=0;s<this.dealer.length;s++){
  1418. if(this.list[i].dealer == this.dealer[s].id){
  1419. this.list[i].dealer_name = this.dealer[s].dealer_name
  1420. }
  1421. }
  1422. for(let b=0;b<this.getDataConfig('hemodialysis','units').length;b++){
  1423. if(this.list[i].drug_dose_unit == this.getDataConfig('hemodialysis','units')[b].id){
  1424. this.list[i].drug_dose_unit_name = this.getDataConfig('hemodialysis','units')[b].name
  1425. }
  1426. }
  1427. this.list[i].specification_name = this.list[i].dose + this.list[i].dose_unit + this.list[i].min_number + this.list[i].min_unit + "/"+this.list[i].max_unit
  1428. if(this.list[i].is_special_diseases == 1 ){
  1429. this.list[i].is_special_diseases_name ="是"
  1430. }
  1431. if(this.list[i].is_special_diseases == 2 ||this.list[i].is_special_diseases == 0 ){
  1432. this.list[i].is_special_diseases_name ="否"
  1433. }
  1434. if(this.list[i].lmt_used_flag == 1 ){
  1435. this.list[i].lmt_used_flag_name ="是"
  1436. }
  1437. if(this.list[i].lmt_used_flag == 2 ||this.list[i].lmt_used_flag == 0 ){
  1438. this.list[i].lmt_used_flag_name ="否"
  1439. }
  1440. }
  1441. const tHeader = ['*药品名称','*药品规格','*剂量','*剂量单位','*拆零','*拆零单位','*包装单位','*药品类型','*库存警戒','*产地','*药品剂型','*拆零零售价','*包装零售价','进货价','*药物分类','*默认单次用量','*默认单次用量单位','*生产厂商','经销商','*默认给药途径','*默认执行频率','*默认开药数量','*默认开药数量单位','*默认开药天数','限制性用药','药品别名','药品类别','开药控制','批准文号','审批标志','医保编码','药理分类','统计分类','本位码','是否特病目录','是否备案','处方药标志','社保目录编码','备案日期','药品备注','状态','限制说明']
  1442. const filterVal = ['drug_name', 'specification_name','dose','dose_unit','min_number','min_unit','max_unit','drug_category_name','drug_stock_limit','drug_origin_place','drug_dosage_form_name','min_price','retail_price','last_price','drug_classify_name','drug_dose','drug_dose_unit_name','manufacturer_name','dealer_name','delivery_way','execution_frequency','prescribing_number','prescribing_number_unit','drug_day','','','','','number','','medical_insurance_number','','','','is_special_diseases_name','','','social_security_directory_code','','','','']
  1443. const data = this.formatJson(filterVal,this.list)
  1444. excel.export_json_to_excel({
  1445. header: tHeader,
  1446. data,
  1447. filename: '药品信息'
  1448. })
  1449. this.downloadLoading = false
  1450. })
  1451. },
  1452. formatJson(filterVal, jsonData) {
  1453. return jsonData.map(v => filterVal.map(j => v[j]))
  1454. },
  1455. getInitializtion(){
  1456. getInitializtion().then(response=>{
  1457. if(response.data.state ==1){
  1458. var drugCategoryList = response.data.data.drugCategoryList
  1459. console.log("药品类型",drugCategoryList)
  1460. this.drugCategoryList = drugCategoryList
  1461. var drugTypeList = response.data.data.drugTypeList
  1462. this.drugTypeList = drugTypeList
  1463. var drugDosageFormList = response.data.data.drugDosageFormList
  1464. console.log("药品剂型",drugDosageFormList)
  1465. this.drugDosageFormList = drugDosageFormList
  1466. var medicalInsuranceLevelList = response.data.data.medicalInsuranceLevelList
  1467. console.log("医保登记",medicalInsuranceLevelList)
  1468. this.medicalInsuranceLevelList = medicalInsuranceLevelList
  1469. var drugControlList = response.data.data.drugControlList
  1470. console.log("开药控制",drugControlList)
  1471. this.drugControlList = drugControlList
  1472. var drugClassifyList = response.data.data.drugClassifyList
  1473. console.log("药物分类",drugClassifyList)
  1474. this.drugClassifyList = drugClassifyList
  1475. var statisticsCategoryList = response.data.data.statisticsCategoryList
  1476. console.log("统计分类",statisticsCategoryList)
  1477. this.statisticsCategoryList = statisticsCategoryList
  1478. var pharmacologyCategoryList = response.data.data.pharmacologyCategoryList
  1479. console.log("药理分类",pharmacologyCategoryList)
  1480. this.pharmacologyCategoryList = pharmacologyCategoryList
  1481. }
  1482. })
  1483. },
  1484. jiaoBen(){
  1485. updateBaseDrugLibByUserOrgId().then(response=>{
  1486. })
  1487. }
  1488. },
  1489. created() {
  1490. this.getList();
  1491. this.getAllManufacturer();
  1492. this.GetAllConfig()
  1493. this.getInitializtion()
  1494. }
  1495. }
  1496. </script>