drugs.vue 53KB

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