App.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <router-view/>
  3. <soctet-dialog v-if="socketErrDialog"/>
  4. <progress-bar/>
  5. <JsDialogComp/>
  6. </template>
  7. <script setup lang="jsx">
  8. import {setCallback, socketErrDialog} from "@/utils/websocket";
  9. import {ElMessageBox, ElNotification} from "element-plus";
  10. import sleep from "@/utils/sleep";
  11. import SoctetDialog from "@/components/xiao-chan/websocket/SoctetDialog.vue";
  12. import router from "@/router";
  13. import ProgressBar from "@/components/xiao-chan/progress-bar/ProgressBar.vue";
  14. import {formatDateToStr} from '@/utils/moment-utils'
  15. import {ElLink} from 'element-plus'
  16. import JsDialogComp from "@/components/js-dialog-comp/JsDialogComp.vue";
  17. import {CyMessageBox} from "@/components/cy/message-box";
  18. import {useProgressBarStore} from "@/pinia/progress-bar-store";
  19. import {useUserStore} from "@/pinia/user-store";
  20. import {useSystemStore} from "@/pinia/system-store";
  21. const progressBarStore = useProgressBarStore()
  22. const systemStore = useSystemStore()
  23. progressBarStore.initialize({
  24. title: '数据上传',
  25. isOpen: false,
  26. abnormalClosing: false,
  27. })
  28. const emrChannelFunc = {
  29. "firstPageOfMedicalRecord": (val) => {
  30. router.push({
  31. name: 'fillCaseFrontSheet',
  32. query: {
  33. patNo: val.inpatientNo,
  34. deptCode: val.smallDept,
  35. },
  36. })
  37. },
  38. "medicalAdvice": (val) => {
  39. router.push({
  40. name: 'yiZhuLuRu',
  41. params: {
  42. inpatientNo: val.inpatientNo
  43. },
  44. query: {
  45. pattern: 'all'
  46. }
  47. })
  48. }
  49. }
  50. const createChannel = () => {
  51. let homePage = new BroadcastChannel('emrChannel')
  52. homePage.addEventListener('message', async (e) => {
  53. if (!router.currentRoute.value.path.includes('/myEmrEditor')) {
  54. await router.push('/blank')
  55. let data = JSON.parse(e.data)
  56. emrChannelFunc[data.name](data.data)
  57. }
  58. })
  59. }
  60. function avatarNotification(data) {
  61. const message = (
  62. <div>
  63. <div>
  64. 科室: {data.deptName}
  65. </div>
  66. <div>
  67. {data.msg}
  68. </div>
  69. </div>
  70. )
  71. ElNotification({
  72. icon: <img src={data.avatar} style={{width: '32px', height: "32px", borderRadius: '16px'}} alt=""/>,
  73. title: data.title,
  74. message: message,
  75. dangerouslyUseHTMLString: true,
  76. duration: 0,
  77. })
  78. }
  79. function checkTheCallbacks({data, isAdd}) {
  80. const message = (
  81. <table style="width: 100%">
  82. <tbody>
  83. <tr>
  84. <td style="padding-right: 8px">患者:</td>
  85. <td>{data.patientName}</td>
  86. </tr>
  87. <tr>
  88. <td style="padding-right: 8px">检查名称:</td>
  89. <td>{data.reqName}</td>
  90. </tr>
  91. <tr>
  92. <td style="padding-right: 8px"> 报告时间:</td>
  93. <td>{formatDateToStr(data.reportTime)}</td>
  94. </tr>
  95. <tr>
  96. <td colspan="2" style="text-ali">
  97. <ElLink type="primary" target="_blank"
  98. href={`http://172.16.32.122:8099/mReport?REQUISITIONID=${data.reqNo}`}>
  99. 查看图像
  100. </ElLink>
  101. </td>
  102. </tr>
  103. </tbody>
  104. </table>
  105. )
  106. ElNotification({
  107. title: isAdd ? '检查结果返回' : '修改检查结果',
  108. message: message,
  109. dangerouslyUseHTMLString: true,
  110. type: 'success',
  111. position: 'bottom-right',
  112. duration: 0
  113. })
  114. }
  115. function systemNotification(data) {
  116. console.log(data)
  117. if (data.count) {
  118. systemStore.addUnreadMessageCount(data.count)
  119. }
  120. if (data.refreshDelay) {
  121. sleep(data.refreshDelay).then(() => {
  122. location.reload();
  123. })
  124. }
  125. if (data?.donTDisplay) {
  126. return
  127. }
  128. ElNotification({
  129. title: typeof data.title === 'undefined' ? '新消息' : data.title,
  130. message: h('pre', {
  131. class: 'message_pre'
  132. }, data.message),
  133. dangerouslyUseHTMLString: true,
  134. type: typeof data.type === 'undefined' ? 'warning' : data.type,
  135. duration: 0,
  136. })
  137. }
  138. onMounted(() => {
  139. createChannel()
  140. setCallback('refreshToken', (data) => {
  141. useUserStore().setToken(data.token)
  142. })
  143. setCallback('sidSingle', async () => {
  144. localStorage.clear()
  145. await router.push('/login')
  146. await ElMessageBox.alert('您的账号已在其他地方登陆,如需修改密码请在个人中心中修改。', '提示', {
  147. type: 'warning',
  148. })
  149. })
  150. setCallback('criticalValue', (data) => {
  151. CyMessageBox({
  152. title: '患者危急值',
  153. message: data.message,
  154. type: 'error',
  155. confirmButtonText: '前往处理',
  156. cancelButtonText: '关闭'
  157. }).then(res => {
  158. router.push(`/inpatient/zhuYuanYiSheng/criticalValue?id=${data.id}`)
  159. }).catch(() => {
  160. })
  161. })
  162. setCallback('systemNotification', systemNotification)
  163. setCallback('checkTheCallbacks', checkTheCallbacks)
  164. setCallback('avatarNotification', avatarNotification);
  165. })
  166. </script>
  167. <style lang="scss">
  168. .message_pre {
  169. font-weight: normal;
  170. margin: 0;
  171. font-size: 14px;
  172. line-height: 1;
  173. }
  174. </style>