drugs.vue 57KB

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