Elizabeth's proactive approach involves introducing urinal toilet attachment , an ingenious concept that optimizes space and functionality.

drugs.vue 54KB

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