drugCode.vue 28KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896
  1. <template>
  2. <div>
  3. <div style="display: flex;margin-bottom:10px;">
  4. <div class="cell clearfix" style="flex: 1;">
  5. <span>发药时间:</span>
  6. <el-date-picker
  7. size="small"
  8. v-model="start_time"
  9. prefix-icon="el-icon-date"
  10. :editable="false"
  11. style="width: 150px;"
  12. type="date"
  13. placeholder="选择日期时间"
  14. align="right"
  15. format="yyyy-MM-dd"
  16. value-format="yyyy-MM-dd"
  17. @change="changeStartTime"
  18. ></el-date-picker>
  19. -
  20. <el-date-picker
  21. @change="changeEndTime"
  22. size="small"
  23. v-model="end_time"
  24. prefix-icon="el-icon-date"
  25. :editable="false"
  26. style="width: 150px;margin-right:10px;"
  27. type="date"
  28. placeholder="选择日期时间"
  29. align="right"
  30. format="yyyy-MM-dd"
  31. value-format="yyyy-MM-dd"
  32. ></el-date-picker>
  33. <div style="width:150px;display: inline-block;">
  34. <el-input style="width: 150px"
  35. v-model="keywords" @input="searchAction"
  36. @keyup.enter.native="searchAction"
  37. class="filter-item" placeholder="请输入患者姓名"
  38. />
  39. </div>
  40. </div>
  41. <div style="flex: 1;">
  42. <el-button type="primary" @click="batchUpload()">批量上传</el-button>
  43. <el-button type="primary" @click="query()">查询</el-button>
  44. <el-button type="primary" @click="exportdata()">导出</el-button>
  45. </div>
  46. </div>
  47. <div style="display: flex;margin-bottom:10px;">
  48. <div>上传状态:
  49. <el-select size="small" v-model="is_sale" placeholder="请选择" style="width:100px;" @change="changeStock">
  50. <el-option
  51. v-for="item,index in items"
  52. :key="index"
  53. :label="item.name"
  54. :value="item.id">
  55. </el-option>
  56. </el-select>
  57. </div>&nbsp;&nbsp;
  58. <div>结算状态:
  59. <el-select size="small" v-model="is_settle" placeholder="请选择" style="width:100px;" @change="changeSettle">
  60. <el-option
  61. v-for="item,index in settle_items"
  62. :key="index"
  63. :label="item.name"
  64. :value="item.id">
  65. </el-option>
  66. </el-select>
  67. </div>&nbsp;&nbsp;
  68. <div>是否有溯源码:
  69. <el-select size="small" v-model="is_code" placeholder="请选择" style="width:100px;" @change="changeCode">
  70. <el-option
  71. v-for="item,index in code_items"
  72. :key="index"
  73. :label="item.name"
  74. :value="item.id">
  75. </el-option>
  76. </el-select>
  77. </div>&nbsp;&nbsp;
  78. <div>数据来源:
  79. <el-select size="small" v-model="is_type" placeholder="请选择" style="width:100px;" @change="changeType">
  80. <el-option
  81. v-for="item,index in advice_items"
  82. :key="index"
  83. :label="item.name"
  84. :value="item.id">
  85. </el-option>
  86. </el-select>
  87. </div>&nbsp;&nbsp;
  88. </div>
  89. <el-table v-loading="isloading" :data="tableData" border :row-style="{ color: '#303133' }" ref="table2"
  90. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  91. max-height="800"
  92. @select="selectCostInfo"
  93. @selection-change="changeCostInfoTableData"
  94. @select-all="changeAllCostInfoTableData"
  95. highlight-current-row>
  96. <el-table-column
  97. align="center"
  98. type="selection"
  99. width="55"
  100. ></el-table-column>
  101. <el-table-column align="center" prop="name" label="患者姓名">
  102. <template slot-scope="scope">{{ getPatientName(scope.row.patient_id) }}</template>
  103. </el-table-column>
  104. <el-table-column align="center" prop="name" label="处方日期">
  105. <template slot-scope="scope">{{is_type == 3 ? getTime(scope.row.record_date): getTime(scope.row.advice_date) }}</template>
  106. </el-table-column>
  107. <el-table-column align="center" prop="name" label="药品名称">
  108. <template slot-scope="scope">{{ is_type == 3 ? scope.row.good_info.good_name :scope.row.advice_name }}</template>
  109. </el-table-column>
  110. <el-table-column align="center" prop="name" label="规格">
  111. <template slot-scope="scope">{{is_type == 3 ? scope.row.good_info.specification_name : getDrugSpec(scope.row.drug_id) }}</template>
  112. </el-table-column>
  113. <el-table-column align="center" prop="name" label="开药总量">
  114. <template slot-scope="scope">{{ is_type == 3 ? scope.row.count : scope.row.prescribing_number }}{{
  115. is_type == 3 ? scope.row.unit :scope.row.prescribing_number_unit
  116. }}
  117. </template>
  118. </el-table-column>
  119. <el-table-column align="center" prop="name" label="药品追溯码">
  120. <template slot-scope="scope">
  121. <div @click="getDrugCode(scope.row.id,scope.row.DataSources,scope.row.drug_code,scope.$index)">
  122. <el-input style="width: 100;" v-model="scope.row.drug_code"></el-input>
  123. </div>
  124. </template>
  125. </el-table-column>
  126. <el-table-column align="center" prop="name" label="上传状态">
  127. <template slot-scope="scope">
  128. <div v-if="scope.row.is_upload == 1">已上传</div>
  129. <div v-if="scope.row.is_upload == 2 || scope.row.is_upload == 0">未上传</div>
  130. </template>
  131. </el-table-column>
  132. <el-table-column align="center" prop="name" label="发药状态" v-if="is_type == 1">
  133. <template slot-scope="scope">
  134. <div v-if="scope.row.is_medicine == 1">已发药</div>
  135. <div v-if="scope.row.is_medicine == 2 || scope.row.is_medicine == 0">未发药</div>
  136. </template>
  137. </el-table-column>
  138. <el-table-column align="center" prop="name" label="结算状态" v-if="is_type == 1">
  139. <template slot-scope="scope">
  140. <div v-if="scope.row.pre.order_status == 2">已结算</div>
  141. <div v-if="scope.row.pre.order_status != 2">未结算</div>
  142. </template>
  143. </el-table-column>
  144. <el-table-column align="center" prop="name" label="操作" width="200">
  145. <template slot-scope="scope">
  146. <div>
  147. <el-button v-if="scope.row.is_upload == 1" type="primary" @click="revokeDrugCode(scope.row)">撤销
  148. </el-button>
  149. <el-button type="primary" v-if="scope.row.is_upload == 0" @click="toUpload(scope.row)">上传</el-button>
  150. <el-button v-if="faShow == true" type="primary" @click="toFaYao(scope.row)">发药</el-button>
  151. </div>
  152. </template>
  153. </el-table-column>
  154. </el-table>
  155. <el-pagination
  156. @size-change="handleSizeChange"
  157. @current-change="handleCurrentChange"
  158. :page-size="10"
  159. :page-sizes="[10, 20, 50, 100,500,1000,2000]"
  160. background
  161. layout="total, sizes, prev, pager, next, jumper"
  162. style="margin-top:20px;float: right"
  163. :total="total"
  164. ></el-pagination>
  165. <el-dialog
  166. title="药品追溯码"
  167. :visible.sync="dialogVisibleOne"
  168. width="40%">
  169. <span>
  170. <el-input
  171. @keyup.native="changeText"
  172. type="textarea"
  173. placeholder="请输入内容"
  174. v-model="textarea"
  175. :rows="10"
  176. >
  177. </el-input>
  178. </span>
  179. <span slot="footer" class="dialog-footer">
  180. <el-button @click="dialogVisibleOne = false">取 消</el-button>
  181. <el-button type="primary" @click="saveTextArea()">确 定</el-button>
  182. </span>
  183. </el-dialog>
  184. </div>
  185. </template>
  186. <script>
  187. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  188. import {getHisDrugCodeQueryList, getPatientDrugCode} from '../../api/new_stock/stock'
  189. import {getDictionaryDataConfig} from "@/utils/data";
  190. import {uParseTime} from '@/utils/tools'
  191. import {changeDrugCode} from "@/api/pharmacy";
  192. import axios from 'axios'
  193. const moment = require('moment')
  194. export default {
  195. components: {
  196. BreadCrumb
  197. },
  198. data() {
  199. return {
  200. isloading:false,
  201. drugTypeList: [{id: 0, name: "全部"}],
  202. start_time: new Date(new Date().getFullYear(), new Date().getMonth(), 1).toLocaleDateString('en-CA'),
  203. end_time: new Date(new Date().getFullYear(), new Date().getMonth() + 1, 0).toLocaleDateString('en-CA'),
  204. is_settle:"0",
  205. is_code:"0",
  206. tableData: [],
  207. change_type: "3",
  208. selection: [],
  209. page: 1,
  210. limit: 10,
  211. value: 0,
  212. keywords:"",
  213. is_sale: "0",
  214. is_type:"1",
  215. items: [
  216. {id: "0", name: '全部'},
  217. {id: "1", name: '已上传'},
  218. {id: "2", name: '未上传'},
  219. ],
  220. code_items:[
  221. {id: "0", name: '全部'},
  222. {id: "2", name: '有溯源码'},
  223. {id: "1", name: '无溯源码'},
  224. ],
  225. settle_items: [
  226. {id: "0", name: '全部'},
  227. {id: "2", name: '已结算'},
  228. {id: "1", name: '未结算'},
  229. ],
  230. advice_items:[
  231. {id:"1",name:"HIS系统药品"},
  232. {id:"2",name:"血透系统"},
  233. {id:"3",name:"HIS系统耗材"},
  234. ],
  235. patientList: [],
  236. drugList: [],
  237. dialogVisibleOne: false,
  238. id: 0,
  239. is_source: 0,
  240. drug_code: 0,
  241. currentRow: {},
  242. currentIndex: 0,
  243. is_drug_open: "2",
  244. textarea: '',
  245. total: 0,
  246. faShow: false,
  247. is_open: false,
  248. }
  249. },
  250. methods: {
  251. searchAction() {
  252. this.page = 1
  253. this.getlist()
  254. },
  255. toUpload(row) {
  256. if(this.is_type == 3){
  257. if (row.drug_code.length == 0) {
  258. this.$message.error("追溯码不能为空");
  259. return
  260. }
  261. let ids = row.id
  262. var that = this;
  263. let params = {
  264. id: ids,
  265. admin_user_id: this.$store.getters.xt_user.user.id,
  266. is_type:this.is_type,
  267. };
  268. axios.get('http://127.0.0.1:9532/test/net', {}).then(function (response) {
  269. if (response.data.state == 0) {
  270. // that.$message.error(response.data.data.msg);
  271. that.$confirm("请检查医保程序是否有打开", "提示", {
  272. confirmButtonText: "确 定",
  273. cancelButtonText: "取 消",
  274. type: "warning",
  275. }).then(() => {
  276. })
  277. .catch(() => {
  278. });
  279. return false
  280. } else {
  281. //有打开则调用接口
  282. axios.get('http://127.0.0.1:9532/api/changedrug/six', {params: params}).then(function (response) {
  283. if (response.data.state == 0) {
  284. that.$message.error(response.data.data.msg);
  285. return false
  286. } else {
  287. if (response.data.data.failed_code == -10) {
  288. that.$confirm(response.data.data.msg, '医保错误信息', {
  289. confirmButtonText: '确 定',
  290. type: 'warning'
  291. }).then(() => {
  292. }).catch(() => {
  293. })
  294. } else {
  295. that.getlist()
  296. }
  297. }
  298. }).catch(function (error) {
  299. })
  300. }
  301. }).catch(function (error) {
  302. that.$confirm("请检查医保程序是否有打开", "提示", {
  303. confirmButtonText: "确 定",
  304. cancelButtonText: "取 消",
  305. type: "warning",
  306. }).then(() => {
  307. })
  308. .catch(() => {
  309. });
  310. })
  311. }else {
  312. if (row.drug_code.length == 0) {
  313. this.$message.error("追溯码不能为空");
  314. return
  315. }
  316. let ids = row.id
  317. var that = this;
  318. let params = {
  319. id: ids,
  320. admin_user_id: this.$store.getters.xt_user.user.id,
  321. is_type:this.is_type,
  322. };
  323. axios.get('http://127.0.0.1:9532/test/net', {}).then(function (response) {
  324. if (response.data.state == 0) {
  325. // that.$message.error(response.data.data.msg);
  326. that.$confirm("请检查医保程序是否有打开", "提示", {
  327. confirmButtonText: "确 定",
  328. cancelButtonText: "取 消",
  329. type: "warning",
  330. }).then(() => {
  331. })
  332. .catch(() => {
  333. });
  334. return false
  335. } else {
  336. //有打开则调用接口
  337. axios.get('http://127.0.0.1:9532/api/changedrug/five', {params: params}).then(function (response) {
  338. if (response.data.state == 0) {
  339. that.$message.error(response.data.data.msg);
  340. return false
  341. } else {
  342. if (response.data.data.failed_code == -10) {
  343. that.$confirm(response.data.data.msg, '医保错误信息', {
  344. confirmButtonText: '确 定',
  345. type: 'warning'
  346. }).then(() => {
  347. }).catch(() => {
  348. })
  349. } else {
  350. that.getlist()
  351. }
  352. }
  353. }).catch(function (error) {
  354. })
  355. }
  356. }).catch(function (error) {
  357. that.$confirm("请检查医保程序是否有打开", "提示", {
  358. confirmButtonText: "确 定",
  359. cancelButtonText: "取 消",
  360. type: "warning",
  361. }).then(() => {
  362. })
  363. .catch(() => {
  364. });
  365. })
  366. }
  367. },
  368. revokeDrugCode(row) {
  369. let ids = row.id
  370. var that = this;
  371. let params = {
  372. id: ids,
  373. admin_user_id: this.$store.getters.xt_user.user.id,
  374. is_type:this.is_type,
  375. };
  376. axios.get('http://127.0.0.1:9532/test/net', {}).then(function (response) {
  377. if (response.data.state == 0) {
  378. // that.$message.error(response.data.data.msg);
  379. that.$confirm("请检查医保程序是否有打开", "提示", {
  380. confirmButtonText: "确 定",
  381. cancelButtonText: "取 消",
  382. type: "warning",
  383. }).then(() => {
  384. })
  385. .catch(() => {
  386. });
  387. return false
  388. } else {
  389. axios.get('http://127.0.0.1:9532/api/delete_xs_bg_three', {params: params}).then(function (response) {
  390. if (response.data.state == 0) {
  391. that.$message.error(response.data.data.msg);
  392. return false
  393. } else {
  394. if (response.data.data.failed_code == -10) {
  395. that.$confirm(response.data.data.msg, '医保错误信息', {
  396. confirmButtonText: '确 定',
  397. type: 'warning'
  398. }).then(() => {
  399. }).catch(() => {
  400. })
  401. } else {
  402. that.getlist()
  403. }
  404. }
  405. }).catch(function (error) {
  406. })
  407. }
  408. }).catch(function (error) {
  409. that.$confirm("请检查医保程序是否有打开", "提示", {
  410. confirmButtonText: "确 定",
  411. cancelButtonText: "取 消",
  412. type: "warning",
  413. }).then(() => {
  414. })
  415. .catch(() => {
  416. });
  417. })
  418. },
  419. changeText(event) {
  420. // 检查是否为特定的按键,例如回车键,来确认扫码枪输入完成
  421. if (event.key === 'Enter') {
  422. var textarea = ""
  423. textarea += this.textarea + ","
  424. this.textarea = textarea
  425. }
  426. },
  427. changeType(val){
  428. this.is_type =val
  429. this.getlist()
  430. },
  431. getDrugCode(id, DataSources, DrugCode, index) {
  432. this.id = id
  433. this.textarea = DrugCode
  434. this.currentIndex = index
  435. this.dialogVisibleOne = true
  436. },
  437. saveTextArea() {
  438. var params = {
  439. id: this.id,
  440. data_source: 1,
  441. drug_code: this.textarea,
  442. }
  443. console.log("paramss", params)
  444. if(this.is_type == 1){
  445. changeDrugCode(params).then(response => {
  446. if (response.data.state == 1) {
  447. this.$message.success("保存成功!")
  448. for (let i = 0; i < this.tableData.length; i++) {
  449. if (this.currentIndex == i) {
  450. this.tableData[i].drug_code = this.textarea
  451. }
  452. }
  453. this.dialogVisibleOne = false
  454. }
  455. })
  456. }
  457. if(this.is_type == 3){
  458. var params = {
  459. id: this.id,
  460. data_source: 2,
  461. drug_code: this.textarea,
  462. }
  463. changeDrugCode(params).then(response=>{
  464. this.$message.success("保存成功!")
  465. for (let i = 0; i < this.tableData.length; i++) {
  466. if (this.currentIndex == i) {
  467. this.tableData[i].drug_code = this.textarea
  468. }
  469. }
  470. this.dialogVisibleOne = false
  471. })
  472. }
  473. if(this.is_type == 3){
  474. var params = {
  475. id: this.id,
  476. data_source: 3,
  477. drug_code: this.textarea,
  478. }
  479. changeDrugCode(params).then(response=>{
  480. this.$message.success("保存成功!")
  481. for (let i = 0; i < this.tableData.length; i++) {
  482. if (this.currentIndex == i) {
  483. this.tableData[i].drug_code = this.textarea
  484. }
  485. }
  486. this.dialogVisibleOne = false
  487. })
  488. }
  489. },
  490. getPatientName(id) {
  491. var name = ""
  492. for (let i = 0; i < this.patientList.length; i++) {
  493. if (id == this.patientList[i].id) {
  494. name = this.patientList[i].name
  495. }
  496. }
  497. return name
  498. },
  499. getTime(val) {
  500. if (val < 0) {
  501. return ""
  502. }
  503. if (val == "") {
  504. return ""
  505. } else {
  506. return uParseTime(val, '{y}-{m}-{d}')
  507. }
  508. },
  509. getDrugName(drug_id) {
  510. var drug_name = ""
  511. for (let i = 0; i < this.drugList.length; i++) {
  512. if (drug_id == this.drugList[i].id) {
  513. drug_name = this.drugList[i].drug_name
  514. }
  515. }
  516. return drug_name
  517. },
  518. getDrugSpec(drug_id) {
  519. var specification_name = ""
  520. for (let i = 0; i < this.drugList.length; i++) {
  521. if (drug_id == this.drugList[i].id) {
  522. specification_name = this.drugList[i].specification_name
  523. }
  524. }
  525. return specification_name
  526. },
  527. handleSizeChange(val) {
  528. this.limit = val
  529. this.getlist()
  530. },
  531. handleCurrentChange(val) {
  532. this.page = val
  533. this.getlist()
  534. },
  535. selectCostInfo(selection, row) {
  536. this.selection = selection
  537. },
  538. changeCostInfoTableData(val) {
  539. this.selection = val
  540. }, changeAllCostInfoTableData(selection) {
  541. this.selection = selection
  542. },
  543. delete() {
  544. },
  545. exportdata() {
  546. console.log("hahahahh", this.tableData)
  547. if (this.tableData != null && this.tableData.length > 0) {
  548. for (let i = 0; i < this.tableData.length; i++) {
  549. this.tableData[i].patient_name = this.getPatientName(this.tableData[i].patient_id)
  550. this.tableData[i].advice_date_str = this.getTime(this.tableData[i].advice_date)
  551. if (this.tableData[i].is_upload == 1) {
  552. this.tableData[i].is_upload_name = "已上传"
  553. }
  554. if (this.tableData[i].is_upload == 2 || this.tableData[i].is_upload == 0) {
  555. this.tableData[i].is_upload_name = "未上传"
  556. }
  557. if (this.tableData[i].is_medicine == 1) {
  558. this.tableData[i].is_medicine_name = "已发药"
  559. }
  560. if (this.tableData[i].is_medicine == 2 || this.tableData[i].is_medicine == 0) {
  561. this.tableData[i].is_medicine_name = "未发药"
  562. }
  563. this.tableData[i].specification_name = this.getDrugSpec(this.tableData[i].drug_id)
  564. this.tableData[i].prescribing_numbers = ""
  565. this.tableData[i].prescribing_numbers = this.tableData[i].prescribing_number + this.tableData[i].prescribing_number_unit
  566. }
  567. }
  568. import('@/vendor/Export2Excel').then(excel => {
  569. const tHeader = ['患者姓名', '处方日期', '药品名称', '规格', '开药总量', '药品追溯码', '上传状态', '发药状态']
  570. const filterVal = ['patient_name', 'advice_date_str', 'advice_name', 'specification_name', 'prescribing_numbers', 'drug_code', 'is_upload_name', 'is_medicine_name']
  571. const data = this.formatJson(filterVal, this.tableData)
  572. excel.export_json_to_excel({
  573. header: tHeader,
  574. data,
  575. filename: '药品追溯'
  576. })
  577. })
  578. }, formatJson(filterVal, jsonData) {
  579. return jsonData.map(v => filterVal.map(j => v[j]))
  580. }, isWithinOneMonth(start_time, end_time) {
  581. // 将字符串或其他格式的时间转为 Date 对象
  582. const startDate = new Date(start_time);
  583. const endDate = new Date(end_time);
  584. // 如果起始时间晚于结束时间,直接返回 false
  585. if (startDate > endDate) {
  586. return false;
  587. }
  588. // 获取起始时间加上一个月后的日期
  589. const oneMonthLater = new Date(startDate);
  590. oneMonthLater.setMonth(oneMonthLater.getMonth() + 1);
  591. // 判断结束时间是否在一个月内
  592. return endDate <= oneMonthLater;
  593. }, batchUpload() {
  594. if(this.is_type == 3){
  595. var that = this
  596. let ids = ""
  597. for (var i = 0; i < this.selection.length; i++){
  598. if (ids.length == 0){
  599. ids = this.selection[i].id
  600. }else{
  601. ids = ids + "," + this.selection[i].id
  602. }
  603. }
  604. if(ids.length == 0 ){
  605. this.$message.error("请勾选需要上传的数据");
  606. return
  607. }
  608. let params = {
  609. id: ids,
  610. admin_user_id: this.$store.getters.xt_user.user.id,
  611. is_type:this.is_type
  612. };
  613. axios.get('http://127.0.0.1:9532/test/net', {}).then(function (response) {
  614. if (response.data.state == 0) {
  615. // that.$message.error(response.data.data.msg);
  616. that.$confirm("请检查医保程序是否有打开", "提示", {
  617. confirmButtonText: "确 定",
  618. cancelButtonText: "取 消",
  619. type: "warning",
  620. }).then(() => {
  621. })
  622. .catch(() => {
  623. });
  624. return false
  625. } else {
  626. that.isloading = true
  627. //有打开则调用接口
  628. axios.get('http://127.0.0.1:9532/api/changedrug/six', {params: params}).then(function (response) {
  629. if (response.data.state == 0) {
  630. that.isloading = false
  631. that.$message.error(response.data.data.msg);
  632. return false
  633. } else {
  634. that.isloading = false
  635. if (response.data.data.failed_code == -10) {
  636. that.$confirm(response.data.data.msg, '医保错误信息', {
  637. confirmButtonText: '确 定',
  638. type: 'warning'
  639. }).then(() => {
  640. }).catch(() => {
  641. })
  642. } else {
  643. that.getlist()
  644. }
  645. }
  646. }).catch(function (error) {
  647. that.isloading = false
  648. })
  649. }
  650. }).catch(function (error) {
  651. that.$confirm("请检查医保程序是否有打开", "提示", {
  652. confirmButtonText: "确 定",
  653. cancelButtonText: "取 消",
  654. type: "warning",
  655. }).then(() => {
  656. })
  657. .catch(() => {
  658. });
  659. })
  660. }else{
  661. var that = this
  662. let ids = ""
  663. for (var i = 0; i < this.selection.length; i++){
  664. if (ids.length == 0){
  665. ids = this.selection[i].id
  666. }else{
  667. ids = ids + "," + this.selection[i].id
  668. }
  669. }
  670. if(ids.length == 0 ){
  671. this.$message.error("请勾选需要上传的数据");
  672. return
  673. }
  674. let params = {
  675. id: ids,
  676. admin_user_id: this.$store.getters.xt_user.user.id,
  677. is_type:this.is_type
  678. };
  679. axios.get('http://127.0.0.1:9532/test/net', {}).then(function (response) {
  680. if (response.data.state == 0) {
  681. // that.$message.error(response.data.data.msg);
  682. that.$confirm("请检查医保程序是否有打开", "提示", {
  683. confirmButtonText: "确 定",
  684. cancelButtonText: "取 消",
  685. type: "warning",
  686. }).then(() => {
  687. })
  688. .catch(() => {
  689. });
  690. return false
  691. } else {
  692. that.isloading = true
  693. //有打开则调用接口
  694. axios.get('http://127.0.0.1:9532/api/changedrug/five', {params: params}).then(function (response) {
  695. if (response.data.state == 0) {
  696. that.isloading = false
  697. that.$message.error(response.data.data.msg);
  698. return false
  699. } else {
  700. that.isloading = false
  701. if (response.data.data.failed_code == -10) {
  702. that.$confirm(response.data.data.msg, '医保错误信息', {
  703. confirmButtonText: '确 定',
  704. type: 'warning'
  705. }).then(() => {
  706. }).catch(() => {
  707. })
  708. } else {
  709. that.getlist()
  710. }
  711. }
  712. }).catch(function (error) {
  713. that.isloading = false
  714. })
  715. }
  716. }).catch(function (error) {
  717. that.$confirm("请检查医保程序是否有打开", "提示", {
  718. confirmButtonText: "确 定",
  719. cancelButtonText: "取 消",
  720. type: "warning",
  721. }).then(() => {
  722. })
  723. .catch(() => {
  724. });
  725. })
  726. }
  727. }, query() {
  728. this.getlist()
  729. },
  730. getDrugType(id) {
  731. var name = "";
  732. for (let i = 0; i < this.drugTypeList.length; i++) {
  733. if (this.drugTypeList[i].id == id) {
  734. name = this.drugTypeList[i].name;
  735. }
  736. }
  737. return name;
  738. },
  739. getTime(val) {
  740. if (val == "" || val == undefined) {
  741. return ""
  742. } else {
  743. return uParseTime(val, '{y}-{m}-{d}')
  744. }
  745. },
  746. getlist() {
  747. this.tableData = []
  748. let params = {
  749. start_time: this.start_time,
  750. end_time: this.end_time,
  751. page: this.page,
  752. limit: this.limit,
  753. is_sale: this.is_sale,
  754. is_settle:this.is_settle,
  755. is_code:this.is_code,
  756. keywords:this.keywords,
  757. is_type:parseInt(this.is_type),
  758. }
  759. getHisDrugCodeQueryList(params).then(response => {
  760. if (response.data.state == 0) {
  761. this.$message.error(response.data.msg)
  762. return false
  763. } else {
  764. if(this.is_type != 3){
  765. this.tableData = response.data.data.list
  766. }else{
  767. this.tableData = response.data.data.project_list
  768. }
  769. this.total = response.data.data.total
  770. this.drugList = response.data.data.drug
  771. this.patientList = response.data.data.patients
  772. this.is_open = response.data.data.codeConfig.is_open
  773. }
  774. })
  775. },changeCode(val){
  776. this.is_code = val
  777. this.getlist()
  778. },changeSettle(val){
  779. this.is_settle = val
  780. this.getlist()
  781. },
  782. changeStock(val) {
  783. this.is_sale = val
  784. this.getlist()
  785. },
  786. changeStartTime(val) {
  787. this.start_time = val
  788. },
  789. changeEndTime(val) {
  790. this.end_time = val
  791. },
  792. toFaYao(row) {
  793. // if (this.is_open == 1) {
  794. // if (row.drug_code == '') {
  795. // this.$message.error("药品追溯码不能为空!")
  796. // return
  797. // }
  798. // }
  799. var params = {
  800. drug_id: row.drug_id,
  801. patient_id: row.patient_id,
  802. advice_date: row.advice_date,
  803. }
  804. getPatientDrugCode(params).then(response => {
  805. if (response.data.state == 1) {
  806. this.$message.success("发药成功!")
  807. this.getlist()
  808. }
  809. })
  810. }
  811. },
  812. created() {
  813. var drugTypeList = getDictionaryDataConfig("system", "drug_type");
  814. this.drugTypeList.push(...drugTypeList);
  815. this.getlist()
  816. }
  817. }
  818. </script>