detailStatistics.vue 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. <template>
  2. <div>
  3. <div
  4. style="display: flex; justify-content: space-between; margin-bottom: 10px"
  5. >
  6. <div>
  7. <el-select
  8. size="small"
  9. v-model="item_type"
  10. placeholder="请选择"
  11. style="width: 150px; margin-left: 10px"
  12. @change="changeItem"
  13. >
  14. <el-option label="全部" value=0> </el-option>
  15. <el-option
  16. v-for="(item, index) in items"
  17. :key="index"
  18. :label="item.name"
  19. :value="item.id"
  20. >
  21. </el-option>
  22. </el-select>
  23. <el-input
  24. size="small"
  25. style="width: 150px"
  26. v-model="keywords"
  27. class="filter-item"
  28. placeholder="请输入项目名称"
  29. />
  30. <el-button
  31. size="small"
  32. style="margin: 0 10px"
  33. class="filter-item"
  34. type="primary"
  35. @click="searchAction"
  36. >搜索
  37. </el-button>
  38. <el-date-picker
  39. v-model="chargeDate"
  40. type="daterange"
  41. value-format="yyyy-MM-dd"
  42. range-separator="至"
  43. start-placeholder="开始日期"
  44. @change="changeDate"
  45. end-placeholder="结束日期"
  46. >
  47. </el-date-picker>
  48. <el-button type="primary" size="small" @click="toPrint">打印</el-button>
  49. </div>
  50. <div></div>
  51. </div>
  52. <el-table
  53. :data="tableData"
  54. border
  55. :row-style="{ color: '#303133' }"
  56. ref="table"
  57. :header-cell-style="{
  58. backgroundColor: 'rgb(245, 247, 250)',
  59. color: '#606266',
  60. }"
  61. max-height="600"
  62. show-summary
  63. v-loading="detail_loading"
  64. highlight-current-row
  65. >
  66. <el-table-column type="index" label="序号" width="60px" align="center">
  67. <template slot-scope="scope">
  68. {{ scope.row.index }}
  69. </template>
  70. </el-table-column>
  71. <el-table-column align="center" label="处方日期">
  72. <template slot-scope="scope">{{
  73. getTime(scope.row.record_date)
  74. }}</template>
  75. </el-table-column>
  76. <el-table-column align="center" label="费用编码">
  77. <template slot-scope="scope">
  78. {{ scope.row.number }}
  79. </template>
  80. </el-table-column>
  81. <el-table-column align="center" label="项目名称">
  82. <template slot-scope="scope">
  83. <span v-if="scope.row.advice_id > 0">{{
  84. scope.row.advice.advice_name
  85. }}</span>
  86. <span v-if="scope.row.project_id > 0">
  87. <span v-if="scope.row.project.type == 2">{{
  88. scope.row.project.project.project_name
  89. }}</span>
  90. <span v-if="scope.row.project.type == 3">{{
  91. scope.row.project.good_info.good_name
  92. }}</span>
  93. </span>
  94. </template>
  95. </el-table-column>
  96. <el-table-column align="center" label="规格">
  97. <template slot-scope="scope">
  98. <span v-if="scope.row.advice_id > 0"
  99. >{{ scope.row.advice.drug.dose
  100. }}{{ scope.row.advice.drug.dose_unit }}*{{
  101. scope.row.advice.drug.min_number
  102. }}{{ scope.row.advice.drug.min_unit }}/{{
  103. scope.row.advice.drug.max_unit
  104. }}</span
  105. >
  106. <span v-if="scope.row.project_id > 0">
  107. <span v-if="scope.row.project.type == 2">{{
  108. scope.row.project.project.project_name
  109. }}</span>
  110. <span v-if="scope.row.project.type == 3">{{
  111. scope.row.project.good_info.specification_name
  112. }}</span>
  113. </span>
  114. </template>
  115. </el-table-column>
  116. <el-table-column align="center" label="数量">
  117. <template slot-scope="scope">
  118. {{ scope.row.cnt }}
  119. </template>
  120. </el-table-column>
  121. <el-table-column align="center" label="单位">
  122. <template slot-scope="scope">
  123. <span v-if="scope.row.advice_id > 0">{{
  124. scope.row.advice.prescribing_number_unit
  125. }}</span>
  126. <span v-if="scope.row.project_id > 0">
  127. <span v-if="scope.row.project.type == 2">{{
  128. scope.row.project.project.unit
  129. }}</span>
  130. <span v-if="scope.row.project.type == 3">{{
  131. scope.row.project.good_info.packing_unit
  132. }}</span>
  133. </span>
  134. </template>
  135. </el-table-column>
  136. <el-table-column align="center" label="单价">
  137. <template slot-scope="scope">
  138. {{ scope.row.pric }}
  139. </template>
  140. </el-table-column>
  141. <el-table-column align="center" label="金额" prop="total_price">
  142. <template slot-scope="scope">
  143. <div>
  144. {{ scope.row.total_price }}
  145. </div>
  146. </template>
  147. </el-table-column>
  148. <el-table-column align="center" prop="name" label="备注">
  149. <template slot-scope="scope">
  150. <div>
  151. <span v-if="scope.row.advice_id > 0">{{
  152. scope.row.advice.remark
  153. }}</span>
  154. <span v-if="scope.row.project_id > 0">
  155. <span v-if="scope.row.project.type == 2">{{
  156. scope.row.project.remark
  157. }}</span>
  158. <span v-if="scope.row.project.type == 3">{{
  159. scope.row.project.remark
  160. }}</span>
  161. </span>
  162. </div>
  163. </template>
  164. </el-table-column>
  165. </el-table>
  166. <div style="display: flex; justify-content: space-around; margin-top: 25px">
  167. <div>总费用:{{ getAllPice() }}</div>
  168. <div>
  169. 个人支付:
  170. <span v-if="his_patient.balance_accounts_type == 2">{{ getAllPice() }}</span>
  171. <span v-if="his_patient.balance_accounts_type != 2">{{ getActPay() }}</span>
  172. </div>
  173. <div>基金支付记账:{{ getFundPaySumamt() }}</div>
  174. <div>补充医疗支付记账:{{ getHifesPay() }}</div>
  175. <div>救助支付金额:{{ getMafPay() }}</div>
  176. </div>
  177. </div>
  178. <!-- </div> -->
  179. </template>
  180. <script>
  181. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  182. import { getHisSummaryDetailList } from "@/api/his/his_tools";
  183. const moment = require("moment");
  184. import { uParseTime } from "@/utils/tools";
  185. export default {
  186. components: {
  187. BreadCrumb,
  188. },
  189. props: {
  190. patient_id: {
  191. type: Number,
  192. default: 0,
  193. },
  194. },
  195. data() {
  196. return {
  197. detail_loading: false,
  198. tempArr: [],
  199. pos: 0,
  200. search_input: "",
  201. sameRowArr: [],
  202. keywords: "",
  203. tableData: [],
  204. chargeDate: [
  205. moment(new Date()).add("year", 0).format("YYYY-MM-DD"),
  206. moment(new Date()).add("year", 0).format("YYYY-MM-DD"),
  207. ],
  208. item_type: "0",
  209. items: [
  210. { id: 1, name: "药品" },
  211. { id: 2, name: "项目" },
  212. { id: 3, name: "耗材" },
  213. ],
  214. list: [],
  215. his_patient: {},
  216. id: 0,
  217. start_time: "",
  218. end_time: "",
  219. org_id:0,
  220. };
  221. },
  222. methods: {
  223. getTime(val) {
  224. if (val <= 0) {
  225. return "";
  226. }
  227. if (val == "") {
  228. return "";
  229. } else {
  230. return uParseTime(val, "{y}-{m}-{d}");
  231. }
  232. },
  233. searchAction() {
  234. let table_id = this.$store.getters.pagedata.list.table_id;
  235. if (table_id == undefined) {
  236. this.$store.commit("SET_PAGEDATA", {
  237. table_id: 0,
  238. type_id: this.id,
  239. keywords: this.keywords,
  240. start_time: this.chargeDate[0],
  241. end_time: this.chargeDate[1],
  242. patient_id: this.patient_id,
  243. });
  244. } else {
  245. this.$store.commit("SET_PAGEDATA", {
  246. table_id: table_id,
  247. type_id: this.id,
  248. keywords: this.keywords,
  249. start_time: this.chargeDate[0],
  250. end_time: this.chargeDate[1],
  251. patient_id: this.patient_id,
  252. });
  253. }
  254. this.getHisSummaryDetailList();
  255. },
  256. changeDate() {
  257. this.start_time = this.chargeDate[0];
  258. this.end_time = this.chargeDate[1];
  259. this.getHisSummaryDetailList();
  260. },
  261. changeItem(id) {
  262. this.id = id;
  263. let table_id = this.$store.getters.pagedata.list.table_id;
  264. if (table_id == undefined) {
  265. this.$store.commit("SET_PAGEDATA", {
  266. table_id: 0,
  267. type_id: this.id,
  268. keywords: this.keywords,
  269. start_time: this.chargeDate[0],
  270. end_time: this.chargeDate[1],
  271. patient_id: this.patient_id,
  272. });
  273. } else {
  274. this.$store.commit("SET_PAGEDATA", {
  275. table_id: table_id,
  276. type_id: this.id,
  277. keywords: this.keywords,
  278. start_time: this.chargeDate[0],
  279. end_time: this.chargeDate[1],
  280. patient_id: this.patient_id,
  281. });
  282. }
  283. this.getHisSummaryDetailList();
  284. },
  285. getHisSummaryDetailList() {
  286. let start_time = this.chargeDate[0];
  287. let end_time = this.chargeDate[1];
  288. let params = {
  289. patient_id: this.patient_id,
  290. start_time: start_time,
  291. end_time: end_time,
  292. type: this.item_type,
  293. keyword: this.keywords,
  294. };
  295. getHisSummaryDetailList(params).then((response) => {
  296. if (response.data.state == 1) {
  297. var list = response.data.data.list;
  298. this.his_patient = response.data.data.his_patient;
  299. this.list = list;
  300. this.tableData = [];
  301. for (let i = 0; i < list.length; i++) {
  302. for (let j = 0; j < list[i].orders.length; j++) {
  303. for (let z = 0; z < list[i].orders[j].order_info.length; z++) {
  304. list[i].orders[j].order_info[z].record_date =
  305. list[i].orders[j].settle_accounts_date;
  306. list[i].orders[j].order_info[z].number =
  307. list[i].orders[j].number;
  308. this.tableData.push(list[i].orders[j].order_info[z]);
  309. }
  310. }
  311. }
  312. var obj = { index: "合计", total_price: 0, record_date: "0" };
  313. for (let i = 0; i < this.tableData.length; i++) {
  314. this.tableData[i].index = i + 1;
  315. this.tableData[i].total_price = 0;
  316. this.tableData[i].total_price = (
  317. this.tableData[i].cnt * this.tableData[i].pric
  318. ).toFixed(2);
  319. obj.total_price += this.tableData[i].cnt * this.tableData[i].pric;
  320. }
  321. obj.total_price = obj.total_price.toFixed(2);
  322. var new_arr = [];
  323. let list_1 = this.$store.getters.pagedata.list;
  324. if (list_1.keywords == undefined) {
  325. this.keywords = "";
  326. } else {
  327. this.keywords = list_1.keywords;
  328. }
  329. this.id = list_1.type_id;
  330. this.item_type = this.id
  331. if (this.keywords != "") {
  332. for (let i = 0; i < this.tableData.length; i++) {
  333. if (this.tableData[i].index != "合计") {
  334. if (this.tableData[i].advice_id > 0) {
  335. if (
  336. this.tableData[i].advice.advice_name.indexOf(
  337. this.keywords
  338. ) > -1
  339. ) {
  340. new_arr.push(this.tableData[i]);
  341. }
  342. }
  343. if (this.tableData[i].project_id > 0) {
  344. if (this.tableData[i].project.type == 2) {
  345. if (
  346. this.tableData[i].project.project.project_name.indexOf(
  347. this.keywords
  348. ) > -1
  349. ) {
  350. new_arr.push(this.tableData[i]);
  351. }
  352. }
  353. if (this.tableData[i].project.type == 3) {
  354. if (
  355. this.tableData[i].project.good_info.good_name.indexOf(
  356. this.keywords
  357. ) > -1
  358. ) {
  359. new_arr.push(this.tableData[i]);
  360. }
  361. }
  362. }
  363. }
  364. }
  365. var objs = { index: "合计", total_price: 0, record_date: "0" };
  366. objs.total_price = this.getPrice(new_arr);
  367. this.tableData = new_arr;
  368. }
  369. if (this.id == 1) {
  370. var obj = { index: "合计", total_price: 0, record_date: "0" };
  371. var new_arr = [];
  372. for (let i = 0; i < this.tableData.length; i++) {
  373. if (this.tableData[i].index != "合计") {
  374. if (this.tableData[i].advice_id > 0) {
  375. new_arr.push(this.tableData[i]);
  376. }
  377. }
  378. }
  379. this.tableData = [];
  380. obj.total_price = this.getPrice(new_arr);
  381. this.tableData = new_arr;
  382. }
  383. if (this.id == 2) {
  384. var obj = { index: "合计", total_price: 0, record_date: "0" };
  385. var new_arr = [];
  386. for (let i = 0; i < this.tableData.length; i++) {
  387. if (this.tableData[i].index != "合计") {
  388. if (this.tableData[i].project_id > 0) {
  389. if (this.tableData[i].project.type == 2) {
  390. new_arr.push(this.tableData[i]);
  391. }
  392. }
  393. }
  394. }
  395. this.tableData = [];
  396. obj.total_price = this.getPrice(new_arr);
  397. this.tableData = new_arr;
  398. }
  399. if (this.id == 3) {
  400. var new_arr = [];
  401. var obj = { index: "合计", total_price: 0, record_date: "0" };
  402. for (let i = 0; i < this.tableData.length; i++) {
  403. if (this.tableData[i].index != "合计") {
  404. if (this.tableData[i].project_id > 0) {
  405. if (this.tableData[i].project.type == 3) {
  406. new_arr.push(this.tableData[i]);
  407. }
  408. }
  409. }
  410. }
  411. this.tableData = [];
  412. obj.total_price = this.getPrice(new_arr);
  413. this.tableData = new_arr;
  414. }
  415. }
  416. });
  417. },
  418. getAllPice() {
  419. var total_price = 0;
  420. for (let i = 0; i < this.tableData.length; i++) {
  421. total_price += this.tableData[i].pric * this.tableData[i].cnt;
  422. }
  423. return total_price.toFixed(2);
  424. },
  425. getActPay() {
  426. var act_pay = 0;
  427. for (let i = 0; i < this.list.length; i++) {
  428. for (let j = 0; j < this.list[i].orders.length; j++) {
  429. act_pay += this.list[i].orders[j].acct_pay;
  430. }
  431. }
  432. return act_pay.toFixed(2)
  433. },
  434. getFundPaySumamt() {
  435. var fund_pay_sumamt = 0;
  436. for (let i = 0; i < this.list.length; i++) {
  437. for (let j = 0; j < this.list[i].orders.length; j++) {
  438. fund_pay_sumamt += this.list[i].orders[j].fund_pay_sumamt;
  439. }
  440. }
  441. return fund_pay_sumamt;
  442. },
  443. getHifesPay() {
  444. var hifes_pay = 0;
  445. for (let i = 0; i < this.list.length; i++) {
  446. for (let j = 0; j < this.list[i].orders.length; j++) {
  447. hifes_pay += this.list[i].orders[j].hifes_pay;
  448. }
  449. }
  450. return hifes_pay;
  451. },
  452. getMafPay() {
  453. var maf_pay = 0;
  454. for (let i = 0; i < this.list.length; i++) {
  455. for (let j = 0; j < this.list[i].orders.length; j++) {
  456. maf_pay += this.list[i].orders[j].maf_pay;
  457. }
  458. }
  459. return maf_pay;
  460. },
  461. toPrint() {
  462. this.$router.push({
  463. path:
  464. "/hisTool/detailPrint?patient_id=" +
  465. this.patient_id +
  466. "&start_time=" +
  467. this.start_time +
  468. "&end_time=" +
  469. this.end_time +
  470. "&type=" +
  471. this.item_type +
  472. "&keyword=" +
  473. this.keywords +
  474. "&id=" +
  475. this.id +
  476. "&balance_accounts_type=" +
  477. this.his_patient.balance_accounts_type,
  478. });
  479. // ======打印时将查询参数保存至store中======
  480. // table_id: 左栏表格下标
  481. // type_id: 下拉框id
  482. // keywords: 输入框
  483. // start_time: this.chargeDate[0],
  484. // end_time: this.chargeDate[1],
  485. // patient_id:this.patient_id
  486. let table_id = this.$store.getters.pagedata.list.table_id;
  487. if (table_id == undefined) {
  488. this.$store.commit("SET_PAGEDATA", {
  489. table_id: 0,
  490. type_id: this.id,
  491. keywords: this.keywords,
  492. start_time: this.chargeDate[0],
  493. end_time: this.chargeDate[1],
  494. patient_id: this.patient_id,
  495. });
  496. } else {
  497. this.$store.commit("SET_PAGEDATA", {
  498. table_id: table_id,
  499. type_id: this.id,
  500. keywords: this.keywords,
  501. start_time: this.chargeDate[0],
  502. end_time: this.chargeDate[1],
  503. patient_id: this.patient_id,
  504. });
  505. }
  506. },
  507. getPrice(val) {
  508. var total_price = 0;
  509. for (let i = 0; i < val.length; i++) {
  510. total_price += val[i].cnt * val[i].pric;
  511. }
  512. return total_price.toFixed(2);
  513. },
  514. },
  515. created() {
  516. this.org_id = this.$store.getters.xt_user.org.id;
  517. console.log("org_id233232323232",this.org_id)
  518. this.start_time = this.chargeDate[0];
  519. this.end_time = this.chargeDate[1];
  520. this.getHisSummaryDetailList();
  521. },
  522. watch: {
  523. patient_id: function () {
  524. this.patient_id = this.patient_id;
  525. this.getHisSummaryDetailList();
  526. },
  527. },
  528. };
  529. </script>