transferPage.vue 8.0 KB

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