detailStatistics.vue 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. <template>
  2. <div>
  3. <div style="display: flex;justify-content: space-between;margin-bottom:10px;">
  4. <div>
  5. <el-select size="small" v-model="item_type" placeholder="请选择"
  6. style="width:150px;margin-left:10px;" @change="changeItem">
  7. <el-option
  8. label="全部"
  9. value="0">
  10. </el-option>
  11. <el-option
  12. v-for="(item,index) in items"
  13. :key="index"
  14. :label="item.name"
  15. :value="item.id">
  16. </el-option>
  17. </el-select>
  18. <el-input
  19. size="small"
  20. style="width: 150px"
  21. v-model="keywords"
  22. class="filter-item"
  23. placeholder="请输入项目名称"
  24. />
  25. <el-button
  26. size="small"
  27. style="margin: 0 10px"
  28. class="filter-item"
  29. type="primary"
  30. @click="searchAction"
  31. >搜索
  32. </el-button>
  33. <el-date-picker
  34. v-model="chargeDate"
  35. type="daterange"
  36. value-format="yyyy-MM-dd"
  37. range-separator="至"
  38. start-placeholder="开始日期"
  39. @change="changeDate"
  40. end-placeholder="结束日期">
  41. </el-date-picker>
  42. <el-button type="primary" size="small" @click="toPrint">打印</el-button>
  43. </div>
  44. <div>
  45. </div>
  46. </div>
  47. <el-table :data="tableData" border :row-style="{ color: '#303133' }" ref="table"
  48. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  49. max-height="600"
  50. show-summary
  51. v-loading="detail_loading"
  52. highlight-current-row>
  53. <el-table-column type="index" label="序号" width="60px" align="center">
  54. <template slot-scope="scope">
  55. {{scope.row.index}}
  56. </template>
  57. </el-table-column>
  58. <el-table-column align="center" label="处方日期">
  59. <template slot-scope="scope">{{getTime(scope.row.record_date)}}</template>
  60. </el-table-column>
  61. <el-table-column align="center" label="费用编码">
  62. <template slot-scope="scope">
  63. {{scope.row.number}}
  64. </template>
  65. </el-table-column>
  66. <el-table-column align="center" label="项目名称">
  67. <template slot-scope="scope">
  68. <span v-if="scope.row.advice_id > 0">{{scope.row.advice.advice_name}}</span>
  69. <span v-if="scope.row.project_id > 0">
  70. <span v-if="scope.row.project.type == 2">{{scope.row.project.project.project_name}}</span>
  71. <span v-if="scope.row.project.type == 3">{{scope.row.project.good_info.good_name}}</span>
  72. </span>
  73. </template>
  74. </el-table-column>
  75. <el-table-column align="center" label="规格">
  76. <template slot-scope="scope">
  77. <span v-if="scope.row.advice_id > 0">{{scope.row.advice.drug.dose}}{{scope.row.advice.drug.dose_unit}}*{{scope.row.advice.drug.min_number}}{{scope.row.advice.drug.min_unit}}/{{scope.row.advice.drug.max_unit}}</span>
  78. <span v-if="scope.row.project_id > 0">
  79. <span v-if="scope.row.project.type == 2">{{scope.row.project.project.project_name}}</span>
  80. <span v-if="scope.row.project.type == 3">{{scope.row.project.good_info.specification_name}}</span>
  81. </span>
  82. </template>
  83. </el-table-column>
  84. <el-table-column align="center" label="数量">
  85. <template slot-scope="scope">
  86. {{scope.row.cnt}}
  87. </template>
  88. </el-table-column>
  89. <el-table-column align="center" label="单位">
  90. <template slot-scope="scope">
  91. <span v-if="scope.row.advice_id > 0">{{scope.row.advice.prescribing_number_unit}}</span>
  92. <span v-if="scope.row.project_id > 0">
  93. <span v-if="scope.row.project.type == 2">{{scope.row.project.project.unit}}</span>
  94. <span v-if="scope.row.project.type == 3">{{scope.row.project.good_info.packing_unit}}</span>
  95. </span>
  96. </template>
  97. </el-table-column>
  98. <el-table-column align="center" label="单价">
  99. <template slot-scope="scope">
  100. {{scope.row.pric}}
  101. </template>
  102. </el-table-column>
  103. <el-table-column align="center" label="金额" prop="total_price">
  104. <template slot-scope="scope">
  105. <div>
  106. {{scope.row.total_price}}
  107. </div>
  108. </template>
  109. </el-table-column>
  110. </el-table>
  111. <div style="display:flex;justify-content: space-around;">
  112. <div>总费用:{{getAllPice()}}</div>
  113. <div>个人支付:
  114. <span v-if="his_patient.balance_accounts_type == 2"></span> {{getAllPice()}}
  115. <span v-if="his_patient.balance_accounts_type != 2"></span> {{getActPay()}}
  116. </div>
  117. <div>基金支付记账:{{getFundPaySumamt()}}</div>
  118. <div>补充医疗支付记账:{{getHifesPay()}}</div>
  119. <div>救助支付金额:{{getMafPay()}}</div>
  120. </div>
  121. </div>
  122. <!-- </div> -->
  123. </template>
  124. <script>
  125. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  126. import { getHisSummaryDetailList } from '@/api/his/his_tools'
  127. const moment = require('moment')
  128. import { uParseTime } from '@/utils/tools'
  129. export default {
  130. components: {
  131. BreadCrumb
  132. },
  133. props: {
  134. patient_id: {
  135. type: Number,
  136. default: 0
  137. }
  138. },
  139. data() {
  140. return {
  141. detail_loading: false,
  142. tempArr: [],
  143. pos: 0,
  144. search_input: '',
  145. sameRowArr: [],
  146. keywords: '',
  147. tableData: [],
  148. chargeDate: [moment(new Date()).add('year', 0).format('YYYY-MM-DD'), moment(new Date()).add('year', 0).format('YYYY-MM-DD')],
  149. item_type: '0',
  150. items: [
  151. { id: 1, name: '药品' },
  152. { id: 2, name: '项目' },
  153. { id: 3, name: '耗材' },
  154. ],
  155. list:[],
  156. his_patient:{},
  157. id:0,
  158. }
  159. },
  160. methods: {
  161. getTime(val) {
  162. if(val <= 0){
  163. return ""
  164. }
  165. if(val == ""){
  166. return ""
  167. }else {
  168. return uParseTime(val, '{y}-{m}-{d}')
  169. }
  170. },
  171. searchAction(){
  172. this.getHisSummaryDetailList()
  173. },
  174. changeDate() {
  175. this.getHisSummaryDetailList()
  176. },
  177. changeItem(id) {
  178. this.id = id
  179. this.getHisSummaryDetailList()
  180. },
  181. getHisSummaryDetailList() {
  182. let start_time = this.chargeDate[0]
  183. let end_time = this.chargeDate[1]
  184. let params = {
  185. patient_id:this.patient_id,
  186. start_time: start_time,
  187. end_time: end_time,
  188. type: this.item_type,
  189. keyword: this.keywords
  190. }
  191. getHisSummaryDetailList(params).then(response=>{
  192. if(response.data.state == 1){
  193. var list = response.data.data.list
  194. this.his_patient = response.data.data.his_patient
  195. this.list = list
  196. this.tableData = []
  197. for(let i=0;i<list.length;i++){
  198. for(let j=0;j<list[i].orders.length;j++){
  199. for(let z=0;z<list[i].orders[j].order_info.length;z++){
  200. list[i].orders[j].order_info[z].record_date = list[i].orders[j].settle_accounts_date
  201. list[i].orders[j].order_info[z].number = list[i].orders[j].number
  202. this.tableData.push(list[i].orders[j].order_info[z])
  203. }
  204. }
  205. }
  206. var obj = {index:"合计",total_price:0,record_date:"0"}
  207. for(let i=0;i<this.tableData.length;i++){
  208. this.tableData[i].index = i+1
  209. this.tableData[i].total_price = 0
  210. this.tableData[i].total_price = (this.tableData[i].cnt * this.tableData[i].pric).toFixed(2)
  211. obj.total_price += (this.tableData[i].cnt * this.tableData[i].pric)
  212. }
  213. obj.total_price = (obj.total_price).toFixed(2)
  214. // this.tableData.push(obj)cccc
  215. // console.log("tabledata23233232233232",this.tableData)
  216. var new_arr = []
  217. if(this.keywords!=""){
  218. for(let i=0;i<this.tableData.length;i++){
  219. if(this.tableData[i].index!="合计"){
  220. if(this.tableData[i].advice_id > 0){
  221. if(this.tableData[i].advice.advice_name.indexOf(this.keywords) > -1){
  222. new_arr.push(this.tableData[i])
  223. }
  224. }
  225. if(this.tableData[i].project_id >0){
  226. if(this.tableData[i].project.type == 2){
  227. if(this.tableData[i].project.project.project_name.indexOf(this.keywords) > -1){
  228. new_arr.push(this.tableData[i])
  229. }
  230. }
  231. if(this.tableData[i].project.type == 3){
  232. if(this.tableData[i].project.good_info.good_name.indexOf(this.keywords)> - 1){
  233. new_arr.push(this.tableData[i])
  234. }
  235. }
  236. }
  237. }
  238. }
  239. var objs = {index:"合计",total_price:0,record_date:"0"}
  240. objs.total_price = this.getPrice(new_arr)
  241. // new_arr.push(objs)
  242. this.tableData = new_arr
  243. }
  244. if(this.id == 1){
  245. var obj = {index:"合计",total_price:0,record_date:"0"}
  246. var new_arr = []
  247. for(let i=0;i<this.tableData.length;i++){
  248. if(this.tableData[i].index!="合计"){
  249. if(this.tableData[i].advice_id > 0){
  250. new_arr.push(this.tableData[i])
  251. }
  252. }
  253. }
  254. this.tableData = []
  255. obj.total_price = this.getPrice(new_arr)
  256. // new_arr.push(obj)
  257. this.tableData = new_arr
  258. }
  259. if(this.id == 2){
  260. var obj = {index:"合计",total_price:0,record_date:"0"}
  261. var new_arr = []
  262. for(let i=0;i<this.tableData.length;i++){
  263. if(this.tableData[i].index!="合计"){
  264. if(this.tableData[i].project_id > 0){
  265. if(this.tableData[i].project.type ==2){
  266. new_arr.push(this.tableData[i])
  267. }
  268. }
  269. }
  270. }
  271. console.log("项目new_arr",new_arr)
  272. this.tableData = []
  273. obj.total_price = this.getPrice(new_arr)
  274. // console.log("ar3233223232",new_arr)
  275. // new_arr.push(obj)
  276. this.tableData = new_arr
  277. }
  278. if(this.id == 3){
  279. var new_arr = []
  280. var obj = {index:"合计",total_price:0,record_date:"0"}
  281. for(let i=0;i<this.tableData.length;i++){
  282. if(this.tableData[i].index!="合计"){
  283. if(this.tableData[i].project_id > 0){
  284. if(this.tableData[i].project.type == 3){
  285. new_arr.push(this.tableData[i])
  286. }
  287. }
  288. }
  289. }
  290. this.tableData = []
  291. obj.total_price = this.getPrice(new_arr)
  292. // new_arr.push(obj)
  293. // console.log("new_arr2332323232",new_arr)
  294. this.tableData = new_arr
  295. }
  296. }
  297. })
  298. },
  299. getAllPice(){
  300. // console.log("表哥233323232323223",this.tableData)
  301. var total_price = 0
  302. for(let i=0;i<this.tableData.length;i++){
  303. if(this.tableData[i].index =="合计"){
  304. total_price = this.tableData[i].total_price
  305. }
  306. }
  307. return total_price
  308. },
  309. getActPay(){
  310. // console.log("list2332323232323232",this.list)
  311. var act_pay = 0
  312. for(let i=0;i<this.list.length;i++){
  313. for(let j=0;j<this.list[i].orders.length;j++){
  314. act_pay +=this.list[i].orders[j].acct_pay
  315. }
  316. }
  317. return act_pay
  318. },
  319. getFundPaySumamt(){
  320. var fund_pay_sumamt = 0
  321. for(let i=0;i<this.list.length;i++){
  322. for(let j=0;j<this.list[i].orders.length;j++){
  323. fund_pay_sumamt +=this.list[i].orders[j].fund_pay_sumamt
  324. }
  325. }
  326. return fund_pay_sumamt
  327. },
  328. getHifesPay(){
  329. var hifes_pay = 0
  330. for(let i=0;i<this.list.length;i++){
  331. for(let j=0;j<this.list[i].orders.length;j++){
  332. hifes_pay +=this.list[i].orders[j].hifes_pay
  333. }
  334. }
  335. return hifes_pay
  336. },
  337. getMafPay(){
  338. var maf_pay = 0
  339. for(let i=0;i<this.list.length;i++){
  340. for(let j=0;j<this.list[i].orders.length;j++){
  341. maf_pay +=this.list[i].orders[j].maf_pay
  342. }
  343. }
  344. return maf_pay
  345. },
  346. toPrint(){
  347. this.$router.push({path:"/hisTool/detailPrint?patient_id="+this.patient_id+"&start_time="+this.chargeDate[0]+"&end_time="+this.chargeDate[1]+"&type="+this.item_type +"&keyword="+this.keywords+"&id="+this.id+"&balance_accounts_type="+this.his_patient.balance_accounts_type})
  348. },
  349. getPrice(val){
  350. var total_price = 0
  351. for(let i=0;i<val.length;i++){
  352. total_price += val[i].cnt * val[i].pric
  353. }
  354. return total_price.toFixed(2)
  355. }
  356. },
  357. created() {
  358. this.getHisSummaryDetailList()
  359. },
  360. watch:{
  361. "patient_id":function(){
  362. this.patient_id = this.patient_id
  363. this.getHisSummaryDetailList()
  364. }
  365. }
  366. }
  367. </script>