index.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. import { getDettlementList, dettlementDedail } from './service';
  2. import history from '../../utils/history';
  3. import { reportCmPV_YL } from '../../utils/cloudMonitorHelper';
  4. Component({
  5. data: {
  6. hospitalDistrictId: '',
  7. list: [] // 出院结算列表
  8. },
  9. didMount() {
  10. // 获取参数住院IDhospitalDistrictId
  11. const optionsValue = JSON.parse(JSON.stringify(this.$page.data.query));
  12. const {
  13. hospitalDistrictId
  14. } = optionsValue;
  15. this.setData({
  16. hospitalDistrictId
  17. }, () => {
  18. // 获取住院人列表
  19. this.settlementList();
  20. });
  21. /* 服务预警,出院结算 */
  22. reportCmPV_YL({
  23. title: '出院结算'
  24. });
  25. },
  26. methods: {
  27. getAuthCodeFn() {
  28. return new Promise(resolve => {
  29. my.getAuthCode({
  30. scopes: 'auth_user',
  31. success: res => {
  32. resolve(res.authCode);
  33. }
  34. });
  35. });
  36. },
  37. async settlementFn(e) {
  38. const {
  39. item
  40. } = e.target.dataset;
  41. const {
  42. hospitalDistrictId
  43. } = this.data;
  44. const {
  45. inpatientId
  46. } = item;
  47. if (item.status === 'INPATIENT') {
  48. history.push({
  49. query: {
  50. inpatientId,
  51. hospitalDistrictId,
  52. color: '#000',
  53. backBtnColor: '#000',
  54. background: '#fff'
  55. },
  56. title: '出院结算',
  57. pageType: 'discharge-settlement-detail'
  58. });
  59. } else {
  60. // 出院跳转成功页
  61. try {
  62. const authCode = await this.getAuthCodeFn();
  63. const details = await dettlementDedail({
  64. inpatientId,
  65. authCode
  66. });
  67. let settlementType = '';
  68. if (!details.medicareAble) {
  69. // 不支持医保
  70. if (Number(details.refundAmount) !== 0 || Number(details.repayAmount) !== 0) {
  71. // repayAmount应补缴金额需要唤起支付功能.refundAmount应退款金额
  72. if (item === 'repayAmount') {
  73. // 自费补交
  74. settlementType = 'notSupportMedicalSupplementary';
  75. } else {
  76. // 有退款
  77. settlementType = 'notSupportMedicalRefund';
  78. }
  79. }
  80. } else {
  81. // 支持医保
  82. settlementType = 'supportMedicalPreSettlement';
  83. }
  84. history.push({
  85. query: {
  86. settlementType,
  87. inpatientId
  88. },
  89. title: '出院结算',
  90. pageType: 'discharge-settlement'
  91. });
  92. } catch (error) {
  93. console.log(error, 'error');
  94. }
  95. } // my.navigateTo({
  96. // url: `/pages/discharge-settlement-detail/index?inpatientId=${inpatientId}`
  97. // });
  98. },
  99. async settlementList() {
  100. const {
  101. hospitalDistrictId
  102. } = this.data;
  103. const list = await getDettlementList({
  104. hospitalDistrictId
  105. });
  106. this.setData({
  107. list
  108. }); // try {
  109. // const resultList = await getDettlementList({ hospitalDistrictId });
  110. // if (Array.isArray(resultList)) {
  111. // // if (resultList.length === 0) {
  112. // // this.setData({ showScroll: false });
  113. // // }
  114. // const lists = resultList.map((item) => {
  115. // const arr = [];
  116. // Object.keys(item).forEach((items) => {
  117. // if (getContent[items]) {
  118. // arr.push({ label: getContent[items], value: item[items], changeFontSize: (items === 'refundAmount' || items === 'depositBalance') });
  119. // }
  120. // });
  121. // return { obj: arr, status: item.status, inpatientName: item.inpatientName, inpatientId: item.inpatientId };
  122. // });
  123. // this.setData({ list: [...list, ...lists] });
  124. // }
  125. // } catch (error) {
  126. // console.log(error, 'error');
  127. // }
  128. }
  129. }
  130. });