index.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. $(function () {
  2. new Vue({
  3. el: "#main",
  4. data: {
  5. YiYuan: {
  6. hosName: '',
  7. hospitalId: ''
  8. },
  9. YiYuanArr: [],
  10. KeShi: {
  11. deptName: '',
  12. hosDeptId: ''
  13. },
  14. KeShiArr: [],
  15. YiSheng: {
  16. doctorName: '',
  17. doctorSn: ''
  18. },
  19. YiShengArr: [],
  20. },
  21. mounted() {
  22. $("#myCarousel").carousel('cycle');
  23. this.getYiYuan();
  24. //从缓存获取前一个页面缓存的信息
  25. var dateInfo = window.localStorage.getItem("dateInfo"),
  26. numberInfo = window.localStorage.getItem("numberInfo"),
  27. patientInfo = window.sessionStorage.getItem("oauthInfo");
  28. if (patientInfo) {
  29. patientInfo = JSON.parse(patientInfo);
  30. this.patientInfo = patientInfo;
  31. }
  32. if (numberInfo) {
  33. numberInfo = JSON.parse(numberInfo);
  34. this.numberInfo = numberInfo;
  35. }
  36. },
  37. methods: {
  38. setYiYuan(value) {
  39. console.log(value);
  40. this.YiYuan.hosName = value.hosName;
  41. this.YiYuan.hospitalId = value.hospitalId;
  42. var vm = this;
  43. var params = {
  44. pageIndex: 1,
  45. pageSize: 99,
  46. hospitalId: this.YiYuan.hospitalId
  47. }
  48. appointmentAPI.querySimpleHosDeptList(params).then(function (res) {
  49. console.log(res);
  50. if (res.successFlg && res.obj.Code == "10000") {
  51. vm.KeShiArr = res.obj.Result;
  52. vm.KeShi.deptName = '';
  53. vm.KeShi.hosDeptId = '';
  54. vm.YiShengArr = [];
  55. vm.YiSheng.doctorName = '';
  56. vm.YiSheng.doctorUid = '';
  57. }
  58. }).catch(function (err) {
  59. consolel.log(err)
  60. })
  61. },
  62. setKeShi(value) {
  63. console.log(value);
  64. if (!this.YiYuan.hospitalId) {
  65. toastr.warning('请先选择医院')
  66. return
  67. }
  68. this.KeShi.deptName = value.deptName;
  69. this.KeShi.hosDeptId = value.hosDeptId;
  70. //查询医生总数
  71. var vm = this;
  72. var params = {
  73. pageIndex: 1,
  74. pageSize: 99,
  75. hospitalId: vm.YiYuan.hospitalId,
  76. hosDeptId: vm.KeShi.hosDeptId
  77. }
  78. appointmentAPI.querySimpleDoctorList(params).then(function (res) {
  79. console.log(res);
  80. if (res.successFlg && res.obj.Code == "10000") {
  81. if (!res.obj.Result) {
  82. res.obj.Message && toastr.warning(res.obj.Message)
  83. } else {
  84. vm.YiShengArr = res.obj.Result;
  85. vm.YiSheng.doctorName = '';
  86. vm.YiSheng.doctorUid = '';
  87. }
  88. //获取医生排班数据
  89. }
  90. })
  91. },
  92. setYiSheng(value) {
  93. console.log(value);
  94. if (!this.KeShi.hosDeptId) {
  95. toastr.warning('请先选择科室')
  96. return
  97. }
  98. this.YiSheng.doctorName = value.doctorName;
  99. this.YiSheng.doctorSn = value.doctorSn;
  100. },
  101. goMyJiuZhen() {
  102. window.location.href = '../../mineJiuZhen/html/mineJiuZhen.html'
  103. },
  104. getYiYuan() {
  105. var params = {
  106. pageIndex: 1,
  107. pageSize: 99,
  108. provinceCode: 360000,
  109. cityCode: 361100
  110. },
  111. vm = this;
  112. appointmentAPI.querySimpleHospitalList(params).then(function (res) {
  113. console.log(res);
  114. if (res.successFlg && res.obj.Code == "10000") {
  115. vm.YiYuanArr = res.obj.Result;
  116. }
  117. }).catch(function (err) {
  118. console.error(err)
  119. })
  120. },
  121. save() {
  122. if (!this.YiYuan.hospitalId) {
  123. toastr.warning('请选择医院')
  124. return
  125. } else if (!this.KeShi.hosDeptId) {
  126. toastr.warning('请选择科室')
  127. return
  128. } else if (!this.YiSheng.doctorSn) {
  129. toastr.warning('请选择医生')
  130. return
  131. }
  132. window.location.href = "../../appointment/html/select-time.html?doctorSn="+Base64.encode(this.YiSheng.doctorSn);
  133. }
  134. }
  135. })
  136. })