index.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. import { getInpatientNotice, getHospitalizationInfo } from './service';
  2. import history from '../../utils/history';
  3. import { reportApi } from '../../utils/cloudMonitorHelper';
  4. Component({
  5. data: {
  6. hospitalizationInfo: {},
  7. inpatientNotice: '',
  8. inpatientId: '',
  9. showOtherButton: false
  10. },
  11. didMount() {
  12. const {
  13. inpatientId,
  14. showOtherButton
  15. } = JSON.parse(JSON.stringify(this.$page.data.query));
  16. console.log(showOtherButton);
  17. this.setData({
  18. inpatientId,
  19. showOtherButton: showOtherButton === 'true'
  20. }, () => {
  21. // 获取住院详情信息
  22. this.getHospitalizationInfo();
  23. }); // 获取入院须知内容
  24. this.getInpatientNoticeInfo();
  25. /* 服务办结,入院登记成功 */
  26. reportApi('入院登记成功');
  27. },
  28. methods: {
  29. /**
  30. * 获取入院须知内容
  31. */
  32. async getInpatientNoticeInfo() {
  33. const inpatientNoticeResult = await getInpatientNotice();
  34. this.setData({
  35. inpatientNotice: inpatientNoticeResult.inpatientNotice || ''
  36. });
  37. },
  38. /**
  39. * 获取住院详情信息
  40. */
  41. async getHospitalizationInfo() {
  42. const {
  43. inpatientId
  44. } = this.data;
  45. const hospitalizationInfo = await getHospitalizationInfo({
  46. inpatientId
  47. });
  48. this.setData({
  49. hospitalizationInfo
  50. });
  51. },
  52. /**
  53. * 完成,跳转至入院登记页面
  54. */
  55. onFinish() {
  56. history.push({
  57. title: '入院登记',
  58. pageType: 'admission-record'
  59. });
  60. },
  61. /**
  62. * 缴纳金额
  63. */
  64. onPremiumReceived() {
  65. history.push({
  66. query: {
  67. inpatientId: this.data.inpatientId
  68. },
  69. title: '押金缴纳',
  70. pageType: 'deposit'
  71. });
  72. }
  73. }
  74. });