transferPage.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <view class="container">
  3. <view class="content"> </view>
  4. </view>
  5. </template>
  6. <script lang="ts" setup>
  7. import { useOnLoad } from '@/hook';
  8. import {
  9. useSetMenuList,
  10. useLoadViewMenu,
  11. useIsToAuthPage,
  12. useGetDefaultMember,
  13. } from '@kasite/uni-app-base';
  14. import { GetRoomId, GetMemberChatList } from '@kasite/uni-app-base/service/base';
  15. import { common, menuClick } from '@/utils';
  16. import { menu } from '@/config';
  17. const app = getApp();
  18. const main = async (options: any = {}) => {
  19. let menuList = common.isEmpty(uni.getStorageSync('menuList'))
  20. ? await useSetMenuList(menu)
  21. : uni.getStorageSync('menuList');
  22. let skipWay = 'redirectTo'; // 跳转方式 默认关闭当前页面跳转
  23. let url = ''; // 页面地址
  24. /**
  25. * 用于判断特定页面跳转是否需要查询就诊人
  26. * 为true时 memberId为必须条件 前端才可反向查询当前人的数据
  27. */
  28. let isQueryMember = false;
  29. /**
  30. * 跳转特定页面需要查询就诊人时 且当前特定页面需要就诊卡或住院号 1:就诊卡 14 住院号
  31. * 当当前页面为一定有卡号或住院号的 一定要传卡号 cardNo
  32. */
  33. let cardType;
  34. let queryBean; // 跳转特定页面需要一些特定参数
  35. // 二维码扫码跳转进入
  36. if (options.q) {
  37. let url_q = decodeURIComponent(options.q);
  38. url_q.replace(/([^?&=]+)=([^&]+)/g, (_, k, v) => (options[k] = v));
  39. // 基层预约挂号支付
  40. if (url_q && url_q?.split('?')[1]?.split('=')[0] == 'OrderId') {
  41. options.type = 'pay';
  42. options.orderId = url_q?.split('?')[1]?.split('=')[1];
  43. }
  44. }
  45. if (common.isNotEmpty(options.type)) {
  46. if (options.type == 0) {
  47. skipWay = 'reLaunch';
  48. /** 首页 **/
  49. url = `/pages/st1/business/tabbar/homePage/homePage`;
  50. options.isViewMenu && (await useLoadViewMenu());
  51. } else if (options.type == 1) {
  52. skipWay = 'reLaunch';
  53. /** 互联网医院 **/
  54. url = `/pages/st1/business/tabbar/netHosIndex/netHosIndex`;
  55. } else if (options.type == 2) {
  56. skipWay = 'reLaunch';
  57. /** 消息中心 **/
  58. url = `/pages/st1/business/tabbar/MsgContent/MsgContent`;
  59. } else if (options.type == 3) {
  60. skipWay = 'reLaunch';
  61. /** 个人中心 **/
  62. url = `/pages/st1/business/tabbar/personalCenter/personalCenter`;
  63. } else if (options.type == 4) {
  64. /** 订单详情页 **/
  65. url = `/pagesPatient/st1/business/pay/payState/payState?orderId=${options.orderId}`;
  66. } else if (options.type == 5) {
  67. /** AI到诊回调科室排班页 **/
  68. let queryBean = {
  69. DeptCode: options.deptCode,
  70. DeptName: decodeURIComponent(options.deptName),
  71. };
  72. url = `/pagesPatient/st1/business/yygh/yyghDoctorList/yyghDoctorList?queryBean=${JSON.stringify(
  73. queryBean
  74. )}`;
  75. } else if (options.type == 'satisfactionQuestions') {
  76. // CRM随访满意度问卷
  77. url = `/pagesAdmin/satisfaction/satisfactionQuestions/satisfactionQuestions?subjectId=${options.subjectId}`;
  78. } else if (options.type == 'articleDetail') {
  79. // CRM文章详情
  80. url = `/pagesAdmin/article/business/article/detail/detail?id=${options.articleId}&msgId=${options.msgId}`;
  81. } else if (options.type == 'fuchat') {
  82. // HCRM-我的随访
  83. const chatData = await this.getMemberChatList(options);
  84. if (!chatData) return;
  85. app.globalData.currentUser = { memberId: chatData.MemberId };
  86. url = `/pagesCrm/st1/business/myFollowUp/followUpList/followUpList?type=${chatData.Type}&roomId=${chatData.Id}&deptName=${chatData.DeptName}&doctorSn=${chatData.Doctorsn}`;
  87. } else if (options.type == 'fuvisit') {
  88. // HCRM-我的随访
  89. const roomIdData = await this.getRoomId(options);
  90. options.roomId = roomIdData.RoomId;
  91. const chatData = await this.getMemberChatList(options);
  92. if (!chatData) return;
  93. app.globalData.currentUser = { memberId: chatData.MemberId };
  94. url = `/pagesCrm/st1/business/myFollowUp/followUpList/followUpList?type=${chatData.Type}&roomId=${chatData.Id}&deptName=${chatData.DeptName}&doctorSn=${chatData.Doctorsn}`;
  95. } else if (options.type == 'article') {
  96. // 点击分享的链接跳转文章详情页面
  97. url = `/pagesAdmin/teamYy/st1/business/disease/articlenInfo/articlenInfo?heaId=${ata.heaId}`;
  98. } else if (options.type == 'pay') {
  99. /** 订单支付页 **/
  100. url = `/pagesPatient/st1/business/pay/payMent/payMent?orderId=${options.orderId}`;
  101. } else if (options.type == 'myddc') {
  102. // 满意度调查
  103. let subjectId = options.subjectId;
  104. let taskId = options.taskId;
  105. url = `/pagesAdmin/satisfaction/business/satisfactionQuestions/satisfactionQuestions?subjectId=${subjectId}&taskId=${taskId}`;
  106. } else if (options.type == 'overduePerson') {
  107. let overdueOptions = common.isJSON(uni.getStorageSync('overdueOptions'))
  108. ? JSON.parse(uni.getStorageSync('overdueOptions'))
  109. : uni.getStorageSync('overdueOptions');
  110. const options = overdueOptions.options;
  111. if (overdueOptions.route.indexOf('yyghClinicMsg') != -1) {
  112. app.globalData.queryBean = overdueOptions.options.queryBean;
  113. }
  114. overdueOptions.options.queryBean = common.isJSON(overdueOptions.options.queryBean)
  115. ? overdueOptions.options.queryBean
  116. : JSON.stringify(overdueOptions.options.queryBean);
  117. const queryString = Object.keys(options)
  118. .map((key) => `${key}=${options[key]}`)
  119. .join('&');
  120. url = `/${overdueOptions.route}?${queryString}`;
  121. await checkAuthAndDefaultMember(url);
  122. uni.setStorageSync('overdueOptions', '');
  123. } else {
  124. // 不等于前面特定页面时 走菜单获取 type值为菜单名称
  125. const childArray = this.getAllChildren(menuList.map((item) => item.Children));
  126. let menuItem = childArray.filter((item) => item.MenuName == options.type);
  127. // 判断当前过滤的菜单名称列表不为空时,走定义的菜单跳转
  128. if (common.isNotEmpty(menuItem)) {
  129. menuItem = menuItem[0];
  130. menuClick(menuItem, this, skipWay);
  131. return;
  132. }
  133. }
  134. }
  135. if (common.isEmpty(url)) {
  136. common.showModal(`<<${options.type}>>跳转地址为空,请联系管理员`, () => {
  137. common.goToUrl(`/pages/st1/business/tabbar/homePage/homePage`, {
  138. skipWay: 'reLaunch',
  139. });
  140. });
  141. return;
  142. }
  143. common.goToUrl(url, {
  144. skipWay: skipWay,
  145. });
  146. };
  147. /** HCRM-我的随访-获取房间ID */
  148. const getRoomId = async (data) => {
  149. let params = {
  150. Doctorsn: data.doctorsn,
  151. MemberId: data.memberId,
  152. };
  153. let { resp, resData } = await GetRoomId(params);
  154. if (common.isNotEmpty(resp)) {
  155. return resp[0];
  156. }
  157. return null;
  158. };
  159. /** HCRM-我的随访-获取会话列表 */
  160. const getMemberChatList = async (data) => {
  161. const params = {
  162. MemberId: data.memberId,
  163. RoomId: data.roomId,
  164. ChatType: '0',
  165. };
  166. const { resp, resData } = await GetMemberChatList(params);
  167. if (common.isNotEmpty(resp[0])) {
  168. return resp[0];
  169. } else {
  170. common.showModal('未查询到记录');
  171. return null;
  172. }
  173. };
  174. /** 判断公众号授权和默认就诊人 */
  175. const checkAuthAndDefaultMember = async (url) => {
  176. /**跳转到挂号页面 需要判断就诊人 和公众号授权*/
  177. if (useIsToAuthPage()) {
  178. return;
  179. }
  180. // 获取当前设置的患者信息 判断是否可以无卡预约 取不同的值允许无卡预约或者默认就诊人信息 否者获取就诊卡信息,如当前默认就诊人无就诊卡,跳转选卡界面
  181. let lastOperatorResp = await useGetDefaultMember({
  182. cardType: '1',
  183. url: url,
  184. isKeepPage: true,
  185. pageType: 'doctorYygh', //个性化预约挂号
  186. });
  187. // 判断返回的炒作人为null 代表跳转选择界面了
  188. if (lastOperatorResp === null) return;
  189. if (common.isEmpty(lastOperatorResp)) {
  190. app.globalData.toUrl = url; //保存添加成功后跳转地址
  191. app.globalData.cardType = app.globalData.withoutCard ? '' : '1'; //保存添加成功,要查询的默认人信息
  192. url = `/pagesPersonal/st1/business/patientManagement/addMember/addMember`;
  193. }
  194. };
  195. /** 菜单数组处理 */
  196. const getAllChildren = (arr) => {
  197. return arr.flatMap((item) => {
  198. if (Array.isArray(item)) {
  199. return this.getAllChildren(item);
  200. } else if (item.Children) {
  201. return [item, ...this.getAllChildren(item.Children)];
  202. } else {
  203. return [item];
  204. }
  205. });
  206. };
  207. useOnLoad((options) => {
  208. uni.showLoading();
  209. main(options);
  210. });
  211. </script>
  212. <style lang="scss" scoped></style>