cnhis-design-vue 3.3.1-beta.17 → 3.3.1-beta.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/README.md +87 -87
  2. package/es/components/ai-chat/index.d.ts +59 -20
  3. package/es/components/ai-chat/src/Index.vue.d.ts +59 -20
  4. package/es/components/ai-chat/src/Index.vue2.js +1 -1
  5. package/es/components/ai-chat/src/api/index.d.ts +3 -0
  6. package/es/components/ai-chat/src/api/index.js +1 -1
  7. package/es/components/ai-chat/src/components/ChatAudio.vue.d.ts +5 -3
  8. package/es/components/ai-chat/src/components/ChatAudio.vue2.js +1 -1
  9. package/es/components/ai-chat/src/components/ChatBI.vue.d.ts +2 -2
  10. package/es/components/ai-chat/src/components/ChatBI.vue2.js +1 -1
  11. package/es/components/ai-chat/src/components/ChatCard.js +1 -1
  12. package/es/components/ai-chat/src/components/ChatFooter.vue.d.ts +19 -17
  13. package/es/components/ai-chat/src/components/ChatFooter.vue2.js +1 -1
  14. package/es/components/ai-chat/src/components/ChatMain.js +1 -1
  15. package/es/components/ai-chat/src/components/ChatMainDefault.js +1 -1
  16. package/es/components/ai-chat/src/components/ChatPatient.vue.d.ts +2 -2
  17. package/es/components/ai-chat/src/components/ChatPatient.vue2.js +1 -1
  18. package/es/components/ai-chat/src/components/ChatPrompt.vue.d.ts +2 -2
  19. package/es/components/ai-chat/src/components/ChatPrompt.vue2.js +1 -1
  20. package/es/components/ai-chat/src/components/ChatRight.vue.d.ts +4 -2
  21. package/es/components/ai-chat/src/components/ChatRight.vue2.js +1 -1
  22. package/es/components/ai-chat/src/components/card/JsonCard.js +1 -1
  23. package/es/components/ai-chat/src/hooks/index.d.ts +2 -0
  24. package/es/components/ai-chat/src/hooks/index.js +1 -0
  25. package/es/components/ai-chat/src/hooks/useData.d.ts +47 -0
  26. package/es/components/ai-chat/src/hooks/useData.js +1 -0
  27. package/es/components/ai-chat/src/hooks/useWebsocket.d.ts +2 -1
  28. package/es/components/ai-chat/src/hooks/useWebsocket.js +1 -1
  29. package/es/components/ai-chat/src/types/index.d.ts +1 -3
  30. package/es/components/ai-chat/src/types/index.js +1 -1
  31. package/es/components/ai-chat/style/index.css +1 -1
  32. package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
  33. package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +1 -0
  34. package/es/components/bpmn-workflow/types/ModelingModule.d.ts +1 -0
  35. package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +1 -0
  36. package/es/components/card-render/src/components/index.d.ts +23 -23
  37. package/es/components/classification/src/components/table-modal/index.vue.d.ts +0 -3
  38. package/es/components/form-render/src/hooks/useBusinessBinding.js +1 -1
  39. package/es/components/iho-chat/index.d.ts +69 -2
  40. package/es/components/iho-chat/src/Index.vue.d.ts +69 -2
  41. package/es/components/iho-chat/src/api/index.d.ts +1 -0
  42. package/es/components/iho-chat/src/api/index.js +1 -1
  43. package/es/components/iho-chat/src/components/ChatAdd.vue.d.ts +1 -0
  44. package/es/components/iho-chat/src/components/ChatAdd.vue2.js +1 -1
  45. package/es/components/iho-chat/src/components/ChatFile.vue.d.ts +1 -0
  46. package/es/components/iho-chat/src/components/ChatFooter.vue.d.ts +1 -0
  47. package/es/components/iho-chat/src/components/ChatHeader.vue.d.ts +57 -0
  48. package/es/components/iho-chat/src/components/ChatMain.vue.d.ts +1 -0
  49. package/es/components/iho-chat/src/components/ChatRecord.vue.d.ts +54 -0
  50. package/es/components/iho-chat/src/components/ChatRecord.vue2.js +1 -1
  51. package/es/components/iho-chat/src/components/ChatSearch.vue.d.ts +8 -2
  52. package/es/components/iho-chat/src/components/ChatSearch.vue2.js +1 -1
  53. package/es/components/iho-chat/src/components/ChatSet.vue.d.ts +1 -0
  54. package/es/components/iho-chat/src/components/MultipleVideo.vue.d.ts +1 -0
  55. package/es/components/iho-chat/src/components/PersonProfile.vue2.js +1 -1
  56. package/es/components/iho-chat/src/hooks/useSearchPatientList.d.ts +11 -0
  57. package/es/components/iho-chat/src/hooks/useSearchPatientList.js +1 -0
  58. package/es/components/iho-chat/style/index.css +1 -1
  59. package/es/components/iho-table/src/plugins/filterRenderPlugin/index.js +1 -1
  60. package/es/components/index.css +1 -1
  61. package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
  62. package/es/env.d.ts +25 -25
  63. package/es/shared/assets/img/ai__avatar.png.js +1 -1
  64. package/es/shared/assets/img/defaultCover/10review_successful.png.js +1 -1
  65. package/es/shared/assets/img/defaultCover/11review_fail.png.js +1 -1
  66. package/es/shared/assets/img/defaultCover/12no_setting.png.js +1 -1
  67. package/es/shared/assets/img/defaultCover/13no_menu_setting.png.js +1 -1
  68. package/es/shared/assets/img/defaultCover/14no_call_setting.png.js +1 -1
  69. package/es/shared/assets/img/defaultCover/15no_use_tag.png.js +1 -1
  70. package/es/shared/assets/img/defaultCover/16no_table_data.png.js +1 -1
  71. package/es/shared/assets/img/defaultCover/1location.png.js +1 -1
  72. package/es/shared/assets/img/defaultCover/2notfound.png.js +1 -1
  73. package/es/shared/assets/img/defaultCover/3loading.png.js +1 -1
  74. package/es/shared/assets/img/defaultCover/4no_permission.png.js +1 -1
  75. package/es/shared/assets/img/defaultCover/5no_data.png.js +1 -1
  76. package/es/shared/assets/img/defaultCover/6no_network.png.js +1 -1
  77. package/es/shared/assets/img/defaultCover/7no_doctor.png.js +1 -1
  78. package/es/shared/assets/img/defaultCover/8system_error.png.js +1 -1
  79. package/es/shared/assets/img/defaultCover/9system_upgrade.png.js +1 -1
  80. package/es/shared/assets/img/failure.png.js +1 -1
  81. package/es/shared/assets/img/file-emr.png.js +1 -1
  82. package/es/shared/assets/img/file.png.js +1 -1
  83. package/es/shared/assets/img/logo.png.js +1 -1
  84. package/es/shared/assets/img/no-permission.png.js +1 -1
  85. package/es/shared/assets/img/nodata.png.js +1 -1
  86. package/es/shared/assets/img/notfound.png.js +1 -1
  87. package/es/shared/assets/img/qr.png.js +1 -1
  88. package/es/shared/assets/img/success.png.js +1 -1
  89. package/es/shared/assets/img/table_style_2.png.js +1 -1
  90. package/es/shared/assets/img/use.png.js +1 -1
  91. package/es/shared/assets/img/video.png.js +1 -1
  92. package/es/shared/assets/img/video_default_cover.png.js +1 -1
  93. package/es/shared/assets/img/xb_big.png.js +1 -1
  94. package/es/shared/assets/img/xb_small.png.js +1 -1
  95. package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +86 -0
  96. package/es/shared/package.json.js +1 -1
  97. package/es/shared/utils/fabricjs/index.d.ts +6823 -0
  98. package/es/shared/utils/tapable/index.d.ts +139 -0
  99. package/package.json +3 -2
@@ -1 +1 @@
1
- import{defineComponent as e,inject as t,ref as a,reactive as l,computed as n,watch as o,createVNode as i}from"vue";import{NForm as s,NFormItem as r,NInput as u,NIcon as d,NButton as c}from"naive-ui";import{InjectionAIChat as v}from"../types/index.js";import"../../../index.js";import{cloneDeep as p,isArray as m,omit as f}from"lodash-es";import{isValidJSON as g}from"../utils/index.js";import{ChevronDown as h,ChevronForward as b}from"@vicons/ionicons5";import{useTheme as y}from"../../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import"@vue/shared";import"../../../../shared/utils/index.js";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import"../../../../shared/hooks/useScrollLoading.js";import E from"../../../form-render/index.js";import I from"../../../card-render/index.js";var k=e({name:"ChatCard",inheritAttrs:!1,props:{msgItem:{type:Object,default:()=>({})},selectParams:{type:Object},configs:{type:Object},msgId:{type:String}},emits:["button-click"],setup(e,{attrs:k,slots:x,emit:C}){const _={TEXT:"INPUT",NUMBER:"INPUT_NUMBER",DATETIME:"DATE",MULTI_SELECT:"REMOTE_SEARCH",SELECT:"REMOTE_SEARCH"},T=y(),{patientInfo:P,state:w,axiosInstance:O,isSmall:S,appId:j}=t(v),M=a([]),R=a(),L=a(),N=l({vaa05:""}),F=a(),q=n((()=>{var t,a;return!!(null==(a=null==(t=e.msgItem)?void 0:t.content)?void 0:a.body)})),A=e.msgItem.content,H={},B=l(p(A.data||{})),K={beforeRequest(e,t,a){var l,n;if(null==t?void 0:t.params){const{items:e=[]}=A.body||{},a=null==(n=(l=R.value).getFormValues)?void 0:n.call(l);Object.keys(t.params).forEach((l=>{const n=e.find((e=>e.code===l));"vaa05"===l?t.params.vaa05=L.value.selectedPatient.vaa01:Reflect.has(a,l)?t.params[l]=a[l]:n&&(t.params[l]=n.value)}))}t&&Reflect.has(t,"configs")&&(t.configs=L.value.selectedPatient)}};function U(e){const{eventName:t,data:a}=e;t&&C("button-click",{buttonInfo:a,isBI:!0})}function D(e){B[e.button.id+"Disabled"]="1",C("button-click",{buttonInfo:{...f(e.button,["props"]),data:e.data}})}if(q.value){const t=A.body.items||[],a=t.some((e=>"vaa05"===e.code));M.value=t.filter((e=>e.showFlag)).map((t=>{var l,n,o;if("vaa05"===t.code&&!S.value)return L.value={...t},t._value?N.vaa05=t._value:(null==(l=t.options)?void 0:l.length)&&t.value&&(N.vaa05=null==(n=t.options.find((e=>e.value===t.value)))?void 0:n.label,L.value.selectedPatient=e.configs),null;const i={html_type:_[t.type]||t.type,val_key:t.code,name:t.name,elem_width:12,default_val:t.value,lazyRequest:!0,requestCache:!0,urlConfig:{nameKey:null!=(o=t.labelField)?o:"label"},option:[],is_null:t.required?"0":"1",is_edit:e.msgItem.disabled?"0":"1",componentProps:{},multi_select:"MULTI_SELECT"===t.type?"0":"1"};if("DATETIME"===t.type&&(i.date_format="yyyy-MM-dd HH:mm:ss"),"REMOTE_SEARCH"===i.html_type){if(i.componentProps={fallbackOption:!1},i.option=t.options||[],i.default_val=null,t.value&&m(t.options)&&t.options.length>0){t.options.find((e=>(null==e?void 0:e.value)===t.value))&&(i.default_val=t.value)}if(Object.assign(i.urlConfig,{url:"/flow/api/instruction/parameter/getOptionsValues",method:"post",params:{...e.selectParams,code:t.code,source:S.value?"inner":"global",...S.value?{appId:j.value}:{}},dependKey:[]}),a&&(i.urlConfig.params.configs=P.value.info||w.selectedPatient),t.dependencies){const e=t.dependencies.split(",");i.urlConfig.dependKey=e,i.urlConfig.params.params={},e.forEach((e=>{i.urlConfig.params.params[e]=""}))}}return i})).filter((e=>!!e))}function J(){var t;if(!L.value)return null;function a(){e.msgItem.disabled||(w.showPatient=!0)}return i(s,{class:"form-render",ref:F,"require-mark-placement":"left",disabled:e.msgItem.disabled,model:N,rules:{vaa05:{required:L.value.required,message:L.value.name+((null==(t=window.getLanguageByCode)?void 0:t.call(window,"10010.1.146"))||"为必填"),trigger:["input"]}}},{default:()=>[i(r,{label:L.value.name,path:"vaa05",class:"form-render__formItem",style:"--n-feedback-height: 16px; --n-feedback-padding: 0px; --n-feedback-font-size: 12px"},{default:()=>{var e;return[i(u,{style:"--n-text-color-disabled: #000; --n-placeholder-color-disabled: #000;--n-padding-left: 8px; --n-padding-right: 8px",readonly:!0,value:N.vaa05,placeholder:(null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.147"))||"请选择",onClick:a},{suffix:()=>i(d,{color:"#c2c2c2",component:h},null)})]}})]})}async function V(t,a){var l,n;try{const o=a||R.value.getFormValues();await(null==(l=R.value)?void 0:l.validate()),A.body.items.forEach((e=>{var t;"vaa05"===e.code?(e._value=w.selectedPatientLabel,e.value=L.value.selectedPatient.vaa01||e.value):o[e.code]&&(e.value=o[e.code]),e.showFlag||(o[e.code]=e.value),(null==(t=H[e.code])?void 0:t[0])&&(e.options=H[e.code])})),w.loading=!0,C("button-click",{values:o,buttonInfo:t,patient:(null==(n=L.value)?void 0:n.selectedPatient)||e.configs,isForm:!0})}catch(e){w.loading=!1}}function z(e){const{fieldInstance:t,context:a,value:l,fieldKey:n}=e;"REMOTE_SEARCH"===t.componentType&&(null==l?void 0:l.length)&&(H[n]=[null==a?void 0:a.currentOption])}function X(){C("button-click",{showMore:!0})}function G(){var e;if("1834043761964638208"!==(null==(e=A.settings)?void 0:e.id)||!A.data)return null;const t=JSON.parse(A.settings.setting),a=e=>{var t;let l="";for(let n=0;n<e.length;n++){const o=e[n];if(o.setting.scopeKey){l=o.setting.scopeKey;break}if((null==(t=o.childrens)?void 0:t.length)&&(l=a(o.childrens),l))break}return l},l=a(t.templates);return!l||!g(A.data[l])||JSON.parse(A.data[l]).length<=5?null:(g(B[l])&&(B[l]=JSON.parse(B[l]).slice(0,5)),i(c,{block:!0,text:!0,"icon-placement":"right",color:T.value["--c-primary-color"],style:"margin-top: 10px",onClick:X},{icon:()=>i(d,{component:b},null),default:()=>"查看更多"}))}return o((()=>w.showPatient),(t=>{!e.msgItem.disabled&&q.value&&!t&&w.selectedPatientLabel&&L.value&&(N.vaa05=w.selectedPatientLabel,L.value.selectedPatient={...w.selectedPatientForm})})),()=>{var t;return i("div",{class:"card"},[q.value?[i("p",null,[A.title||A.header.title]),i("div",{class:"form-box"},[[J(),i(E,{"request-instance":{get:O.get,post:O.post},"life-cycle":K,column:12,ref:R,"field-list":M.value,onFormChange:z},null)]]),A.footer.buttons.map((t=>function(t){const a={width:"100%","--n-height":"36px",fontSize:"15px",marginTop:"10px"},l=q.value?{...a,marginTop:"0"}:a;return i(c,{id:e.msgId,style:l,secondary:!0,class:"gradient",disabled:e.msgItem.disabled,onClick:async function(){var e;if(q.value){if(!R.value)return;try{L.value?null==(e=F.value)||e.validate((async e=>{var a,l;if(!e){const e=null==(l=(a=R.value).getFormValues)?void 0:l.call(a);Object.assign(e,{vaa05:L.value.selectedPatient.vaa01}),await V(t,e)}})):await V(t)}catch(e){}}else C("button-click")}},{default:()=>[q.value?null==t?void 0:t.text:A.buttonName]})}(t)))]:[i(I,{config:g(null==(t=A.settings)?void 0:t.setting)?JSON.parse(A.settings.setting):null,data:B,"onModule-click":U,"onButton-click":D},null),G()]])}}});export{k as default};
1
+ import{defineComponent as e,ref as t,reactive as a,computed as l,watch as n,createVNode as o}from"vue";import{NForm as i,NFormItem as s,NInput as r,NIcon as u,NButton as d}from"naive-ui";import"../../../index.js";import{cloneDeep as c,isArray as v,omit as p}from"lodash-es";import{isValidJSON as m}from"../utils/index.js";import{ChevronDown as f,ChevronForward as g}from"@vicons/ionicons5";import{useData as b}from"../hooks/useData.js";import y from"../../../form-render/index.js";import h from"../../../card-render/index.js";var E=e({name:"ChatCard",inheritAttrs:!1,props:{msgItem:{type:Object,default:()=>({})},selectParams:{type:Object},configs:{type:Object},msgId:{type:String}},emits:["button-click"],setup(e,{attrs:E,slots:I,emit:_}){const k={TEXT:"INPUT",NUMBER:"INPUT_NUMBER",DATETIME:"DATE",MULTI_SELECT:"REMOTE_SEARCH",SELECT:"REMOTE_SEARCH"},{cssVars:C,patientInfo:x,state:T,axiosInstance:P,isSmall:w,appId:O}=b(),M=t([]),R=t(),S=t(),j=a({vaa05:""}),L=t(),N=l((()=>{var t,a;return!!(null==(a=null==(t=e.msgItem)?void 0:t.content)?void 0:a.body)})),F=e.msgItem.content,q={},A=a(c(F.data||{})),B={beforeRequest(e,t,a){var l,n;if(null==t?void 0:t.params){const{items:e=[]}=F.body||{},a=null==(n=(l=R.value).getFormValues)?void 0:n.call(l);Object.keys(t.params).forEach((l=>{const n=e.find((e=>e.code===l));"vaa05"===l?t.params.vaa05=S.value.selectedPatient.vaa01:Reflect.has(a,l)?t.params[l]=a[l]:n&&(t.params[l]=n.value)}))}t&&Reflect.has(t,"configs")&&(t.configs=S.value.selectedPatient)}};function H(e){const{eventName:t,data:a}=e;t&&_("button-click",{buttonInfo:a,isBI:!0})}function K(e){A[e.button.id+"Disabled"]="1",_("button-click",{buttonInfo:{...p(e.button,["props"]),data:e.data}})}if(N.value){const t=F.body.items||[],a=t.some((e=>"vaa05"===e.code));M.value=t.filter((e=>e.showFlag)).map((t=>{var l,n,o;if("vaa05"===t.code&&!w.value)return S.value={...t},t._value?j.vaa05=t._value:(null==(l=t.options)?void 0:l.length)&&t.value&&(j.vaa05=null==(n=t.options.find((e=>e.value===t.value)))?void 0:n.label,S.value.selectedPatient=e.configs),null;const i={html_type:k[t.type]||t.type,val_key:t.code,name:t.name,elem_width:12,default_val:t.value,lazyRequest:!0,requestCache:!0,urlConfig:{nameKey:null!=(o=t.labelField)?o:"label"},option:[],is_null:t.required?"0":"1",is_edit:e.msgItem.disabled?"0":"1",componentProps:{},multi_select:"MULTI_SELECT"===t.type?"0":"1"};if("DATETIME"===t.type&&(i.date_format="yyyy-MM-dd HH:mm:ss"),"REMOTE_SEARCH"===i.html_type){if(i.componentProps={fallbackOption:!1},i.option=t.options||[],i.default_val=null,t.value&&v(t.options)&&t.options.length>0){t.options.find((e=>(null==e?void 0:e.value)===t.value))&&(i.default_val=t.value)}if(Object.assign(i.urlConfig,{url:"/flow/api/instruction/parameter/getOptionsValues",method:"post",params:{...e.selectParams,code:t.code,source:w.value?"inner":"global",...w.value?{appId:O.value}:{}},dependKey:[]}),a&&(i.urlConfig.params.configs=x.value.info||T.selectedPatient),t.dependencies){const e=t.dependencies.split(",");i.urlConfig.dependKey=e,i.urlConfig.params.params={},e.forEach((e=>{i.urlConfig.params.params[e]=""}))}}return i})).filter((e=>!!e))}function U(){var t;if(!S.value)return null;function a(){e.msgItem.disabled||(T.showPatient=!0)}return o(i,{class:"form-render",ref:L,"require-mark-placement":"left",disabled:e.msgItem.disabled,model:j,rules:{vaa05:{required:S.value.required,message:S.value.name+((null==(t=window.getLanguageByCode)?void 0:t.call(window,"10010.1.146"))||"为必填"),trigger:["input"]}}},{default:()=>[o(s,{label:S.value.name,path:"vaa05",class:"form-render__formItem",style:"--n-feedback-height: 16px; --n-feedback-padding: 0px; --n-feedback-font-size: 12px"},{default:()=>{var e;return[o(r,{style:"--n-text-color-disabled: #000; --n-placeholder-color-disabled: #000;--n-padding-left: 8px; --n-padding-right: 8px",readonly:!0,value:j.vaa05,placeholder:(null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.147"))||"请选择",onClick:a},{suffix:()=>o(u,{color:"#c2c2c2",component:f},null)})]}})]})}async function D(t,a){var l,n;try{const o=a||R.value.getFormValues();await(null==(l=R.value)?void 0:l.validate()),F.body.items.forEach((e=>{var t;"vaa05"===e.code?(e._value=T.selectedPatientLabel,e.value=S.value.selectedPatient.vaa01||e.value):o[e.code]&&(e.value=o[e.code]),e.showFlag||(o[e.code]=e.value),(null==(t=q[e.code])?void 0:t[0])&&(e.options=q[e.code])})),T.loading=!0,_("button-click",{values:o,buttonInfo:t,patient:(null==(n=S.value)?void 0:n.selectedPatient)||e.configs,isForm:!0})}catch(e){T.loading=!1}}function V(e){const{fieldInstance:t,context:a,value:l,fieldKey:n}=e;"REMOTE_SEARCH"===t.componentType&&(null==l?void 0:l.length)&&(q[n]=[null==a?void 0:a.currentOption])}function J(){_("button-click",{showMore:!0})}function z(){var e;if("1834043761964638208"!==(null==(e=F.settings)?void 0:e.id)||!F.data)return null;const t=JSON.parse(F.settings.setting),a=e=>{var t;let l="";for(let n=0;n<e.length;n++){const o=e[n];if(o.setting.scopeKey){l=o.setting.scopeKey;break}if((null==(t=o.childrens)?void 0:t.length)&&(l=a(o.childrens),l))break}return l},l=a(t.templates);return!l||!m(F.data[l])||JSON.parse(F.data[l]).length<=5?null:(m(A[l])&&(A[l]=JSON.parse(A[l]).slice(0,5)),o(d,{block:!0,text:!0,"icon-placement":"right",color:C.value["--c-primary-color"],style:"margin-top: 10px",onClick:J},{icon:()=>o(u,{component:g},null),default:()=>"查看更多"}))}return n((()=>T.showPatient),(t=>{!e.msgItem.disabled&&N.value&&!t&&T.selectedPatientLabel&&S.value&&(j.vaa05=T.selectedPatientLabel,S.value.selectedPatient={...T.selectedPatientForm})})),()=>{var t;return o("div",{class:"card"},[N.value?[o("p",null,[F.title||F.header.title]),o("div",{class:"form-box"},[[U(),o(y,{"request-instance":{get:P.get,post:P.post},"life-cycle":B,column:12,ref:R,"field-list":M.value,onFormChange:V},null)]]),F.footer.buttons.map((t=>function(t){const a={width:"100%","--n-height":"36px",fontSize:"15px",marginTop:"10px"},l=N.value?{...a,marginTop:"0"}:a;return o(d,{id:e.msgId,style:l,secondary:!0,class:"gradient",disabled:e.msgItem.disabled,onClick:async function(){var e;if(N.value){if(!R.value)return;try{S.value?null==(e=L.value)||e.validate((async e=>{var a,l;if(!e){const e=null==(l=(a=R.value).getFormValues)?void 0:l.call(a);Object.assign(e,{vaa05:S.value.selectedPatient.vaa01}),await D(t,e)}})):await D(t)}catch(e){}}else _("button-click")}},{default:()=>[N.value?null==t?void 0:t.text:F.buttonName]})}(t)))]:[o(h,{config:m(null==(t=F.settings)?void 0:t.setting)?JSON.parse(F.settings.setting):null,data:A,"onModule-click":H,"onButton-click":K},null),z()]])}}});export{E as default};
@@ -3,16 +3,17 @@ import { CommandItem } from '../types';
3
3
  import { CAudioSDK } from '../../../../components/audio-sdk';
4
4
  import { AnyObject } from '../../../../shared/types';
5
5
  declare const _default: import("vue").DefineComponent<{}, {
6
- cssVars: import("vue").ComputedRef<AnyObject>;
7
6
  audioSdk: CAudioSDK;
8
- emit: (event: string, ...args: any[]) => void;
9
- shortcutList: any;
10
- state: any;
11
- isSmall: any;
12
- audioTimed: any;
13
- commandList: any;
14
- isDefault: any;
15
- patientInfo: any;
7
+ cssVars: import("vue").ComputedRef<AnyObject>;
8
+ shortcutList: import("vue").Ref<any>;
9
+ state: AnyObject;
10
+ isSmall: import("vue").ComputedRef<boolean>;
11
+ audioTimed: import("vue").Ref<any>;
12
+ commandList: import("vue").Ref<any>;
13
+ isDefault: import("vue").ComputedRef<boolean>;
14
+ patientInfo: import("vue").Ref<any>;
15
+ emit: (event: "button-click" | "program", ...args: any[]) => void;
16
+ sendMessage: (params?: AnyObject) => Promise<void>;
16
17
  inputRef: import("vue").Ref<any>;
17
18
  showPopover: import("vue").Ref<boolean>;
18
19
  breadcrumb: import("vue").Ref<{
@@ -34,7 +35,7 @@ declare const _default: import("vue").DefineComponent<{}, {
34
35
  showPatient: import("vue").Ref<boolean>;
35
36
  showAudio: import("vue").Ref<boolean>;
36
37
  placeholder: import("vue").ComputedRef<"请向我提问,Shift+Enter换行" | "请向我提问或输入\"/\"查看指令" | "请向我提问或输入\"/\"查看指令,Shift+Enter换行">;
37
- isAllDisabled: import("vue").ComputedRef<any>;
38
+ isAllDisabled: import("vue").ComputedRef<boolean>;
38
39
  btnDisabled: import("vue").ComputedRef<any>;
39
40
  showMagicWand: import("vue").ComputedRef<boolean>;
40
41
  patient: import("vue").ComputedRef<string>;
@@ -83,8 +84,8 @@ declare const _default: import("vue").DefineComponent<{}, {
83
84
  "onUpdate:show"?: ((...args: any[]) => any) | undefined;
84
85
  }>>;
85
86
  emit: (event: "update:show", ...args: any[]) => void;
86
- queryPrompt: any;
87
- state: any;
87
+ state: AnyObject;
88
+ queryPrompt: import("vue").Ref<any>;
88
89
  listRef: import("vue").Ref<any>;
89
90
  keyword: import("vue").Ref<string>;
90
91
  list: import("vue").Ref<AnyObject[]>;
@@ -122,8 +123,8 @@ declare const _default: import("vue").DefineComponent<{}, {
122
123
  "onUpdate:show"?: ((...args: any[]) => any) | undefined;
123
124
  }>>;
124
125
  emit: (event: "update:show", ...args: any[]) => void;
125
- patientInfo: any;
126
- state: any;
126
+ state: AnyObject;
127
+ patientInfo: import("vue").Ref<any>;
127
128
  formValue: {
128
129
  businessType: string;
129
130
  vaa01: null;
@@ -179,9 +180,10 @@ declare const _default: import("vue").DefineComponent<{}, {
179
180
  "onUpdate:show"?: ((...args: any[]) => any) | undefined;
180
181
  }>>;
181
182
  emit: (event: "update:show", ...args: any[]) => void;
182
- state: any;
183
- vaa07: any;
184
- immediatelyRecording: any;
183
+ state: AnyObject;
184
+ vaa07: import("vue").ComputedRef<any>;
185
+ immediatelyRecording: import("vue").Ref<any>;
186
+ sendMessage: (params?: AnyObject) => Promise<void>;
185
187
  time: import("vue").Ref<number>;
186
188
  endType: string;
187
189
  pause: import("@vueuse/shared").Fn;
@@ -1 +1 @@
1
- import{defineComponent as e,inject as o,ref as n,computed as t,onBeforeUnmount as l,watch as a,openBlock as i,createElementBlock as s,normalizeClass as r,unref as d,createElementVNode as u,createBlock as c,withCtx as v,createVNode as m,createTextVNode as h,toDisplayString as f,createCommentVNode as p,Fragment as k,renderList as w,normalizeStyle as g,createSlots as y,withModifiers as C,getCurrentInstance as b}from"vue";import{NButton as x,NIcon as _,NPopover as j,NInput as I,NTag as z,NBreadcrumb as M,NBreadcrumbItem as T,NSwitch as P}from"naive-ui";import{PeopleOutline as S,SparklesSharp as D,PaperPlane as L,ChevronBack as U,ChevronForward as B}from"@vicons/ionicons5";import{InjectionAIChatEmits as E,InjectionAIChat as K}from"../types/index.js";import"../../../audio-sdk/index.js";import{cloneDeep as A,isString as F,last as R}from"lodash-es";import{useTheme as W}from"../../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import"@vue/shared";import"../../../../shared/utils/index.js";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import"../../../../shared/hooks/useScrollLoading.js";import N from"./ChatPrompt.vue.js";import V from"./ChatPatient.vue.js";import q from"./ChatAudio.vue.js";import H from"../../../audio-sdk/src/audioSDK.js";const G={class:"menu-box fillet-8"},J={class:"input-wrapper fillet-10"},O=u("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},[u("path",{fill:"none",stroke:"black","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M192 448h128"}),u("path",{d:"M384 208v32c0 70.4-57.6 128-128 128h0c-70.4 0-128-57.6-128-128v-32",fill:"none",stroke:"black","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"}),u("path",{fill:"none",stroke:"black","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M256 368v80"}),u("path",{d:"M256 64a63.68 63.68 0 0 0-64 64v111c0 35.2 29 65 64 65s64-29 64-65V128c0-36-28-64-64-64z",fill:"none",stroke:"#4972EF","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"})],-1),Q={key:0,class:"btn-box"},X=u("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},[u("path",{fill:"none",stroke:"black","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M192 448h128"}),u("path",{d:"M384 208v32c0 70.4-57.6 128-128 128h0c-70.4 0-128-57.6-128-128v-32",fill:"none",stroke:"black","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"}),u("path",{fill:"none",stroke:"black","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M256 368v80"}),u("path",{d:"M256 64a63.68 63.68 0 0 0-64 64v111c0 35.2 29 65 64 65s64-29 64-65V128c0-36-28-64-64-64z",fill:"none",stroke:"#4972EF","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"})],-1),Y=["disabled"],Z={class:"command-box"},$={class:"command-box__header"},ee={key:0,class:"title"},oe={class:"command-box__menu"},ne=["onMouseover","onClick"],te={class:"label"},le={class:"remark"};var ae=e({__name:"ChatFooter",setup(e){const ae=W(),ie=H.create(),se=o(E),{shortcutList:re,state:de,isSmall:ue,audioTimed:ce,commandList:ve,isDefault:me,patientInfo:he}=o(K),fe=n(),pe=n(!1),ke=n([]),we=n(A(ve.value||[])),ge=n(!1),ye=n(""),Ce=n(!1),be=n(!1),xe=t((()=>me.value?"请向我提问,Shift+Enter换行":ue?'请向我提问或输入"/"查看指令':'请向我提问或输入"/"查看指令,Shift+Enter换行')),_e=t((()=>{var e,o;return me.value&&1!==(null==(o=null==(e=he.value)?void 0:e.info)?void 0:o.vac34)})),je=t((()=>_e.value||de.loading||!de.sendContent.replace(/(&nbsp;|\s|<br>)+/g,""))),Ie=t((()=>{var e;return!de.sendContent&&!(null==(e=fe.value)?void 0:e.activated.value)})),ze=t((()=>{var e,o;if(!de.selectedPatient)return(null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.190"))||"选择患者";const{bcq04b:n,vaa05:t}=de.selectedPatient;let l="";n&&(l+=n+((null==(o=window.getLanguageByCode)?void 0:o.call(window,"10010.1.191"))||"床"));return t&&(l+=(!l||l.endsWith("/")?"":"/")+t),l}));async function Me(){try{const e=await ie.start({instance:b(),allowPunctuationMark:!1,timed:ce.value||10,realTimeRecognition:!0});if("success"!==(null==e?void 0:e.result))return;de.sendContent=e.data||""}catch(e){console.log(e)}}function Te(e){var o;if(F(e))return e;if(me.value)return e.value;const{content:n}=(null==(o=null==e?void 0:e.contents)?void 0:o[0])||{};return null==n?void 0:n.instructionName}function Pe(){var e;pe.value=!1,we.value=A(ve.value||[]),ke.value=[],(null==(e=ve.value)?void 0:e.length)&&(pe.value=!0,ye.value=we.value[0].shortcutId)}function Se(e){if(me.value)"Enter"!==e.key||De(e)||Ue();else if(!["Slash","NumpadDivide"].includes(e.code)||de.selectedCommand||de.sendContent)if("Backspace"===e.key)pe.value=!1,!de.sendContent.startsWith("/")&&!de.sendContent.startsWith("、")||2!==de.sendContent.length||de.selectedCommand?!de.sendContent&&de.selectedCommand&&(e.preventDefault(),de.selectedCommand=null,de.sendContent="/",Pe()):Pe();else if(pe.value&&["ArrowUp","ArrowDown"].includes(e.key)){const o=we.value.findIndex((e=>e.shortcutId===ye.value));if("ArrowUp"===e.key){const e=o>0?o-1:we.value.length-1;ye.value=we.value[e].shortcutId}else if("ArrowDown"===e.key){const e=o<we.value.length-1?o+1:0;ye.value=we.value[e].shortcutId}}else if(["Enter"].includes(e.key)){if(!De(e))if(e.preventDefault(),pe.value){Be(we.value.find((e=>e.shortcutId===ye.value)))}else Ue()}else pe.value=!1;else Pe()}function De(e){return e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}function Le(e){!e&&de.selectedPrompt&&(de.selectedPrompt=null)}function Ue(){je.value||(de.sending=!0,de.loading=!0)}function Be(e){var o;ye.value=e.shortcutId,fe.value.focus(),(null==(o=e.children)?void 0:o.length)?(we.value=e.children,ye.value=we.value[0].shortcutId,ke.value.push(e)):(de.selectedCommand=e||{},pe.value=!1,de.sendContent="")}function Ee(){var e;ke.value.pop(),we.value=R(ke.value)?null==(e=R(ke.value))?void 0:e.children:A(ve.value||[]),ye.value=we.value[0].shortcutId,fe.value.focus()}function Ke(e){e||(de.showPatient=!1)}function Ae({focused:e,checked:o}){const n={};return o?(n.background="#d03050",e&&(n.boxShadow="0 0 0 2px #d0305040")):(n.background="#2080f0",e&&(n.boxShadow="0 0 0 2px #2080f040")),n}return l((()=>{H.destroy()})),a((()=>de.showPatient),(e=>{e&&(Ce.value=e)})),(e,o)=>(i(),s("section",{class:r(["chat-footer-wrapper",{"is-small":d(ue)}])},[u("div",{class:r(["chat-footer",d(de).loading?"disabled":""])},[u("div",G,[d(ue)||d(me)?p("v-if",!0):(i(),c(d(x),{key:0,secondary:"",size:"small",onClick:o[0]||(o[0]=()=>Ce.value=!0)},{icon:v((()=>[m(d(_),{color:d(ae)["--c-primary-color"],size:"20",component:d(S)},null,8,["color","component"])])),default:v((()=>[h(" "+f(d(ze)),1)])),_:1})),d(re)&&d(re).length>0?(i(!0),s(k,{key:1},w(d(re),(e=>(i(),c(d(x),{secondary:"",size:"small",style:g(d(ue)?"background: #fff":""),round:d(ue),key:Te(e),disabled:d(_e),onClick:()=>function(e){var o;if(F(e))de.sendContent=e;else{if(me.value&&e.key)return void(["recommend_treatment_plan","recommend_examination","recommend_diagnosis"].includes(e.key)?(de.params={opType:e.key},de.sending=!0,de.loading=!0,de.loadingText="","recommend_treatment_plan"===e.key?de.loadingText="参考诊断结果与患者个体信息,正全面梳理知识库和临床指南,综合考量为您匹配最适宜的诊疗方案推荐":"recommend_examination"===e.key&&(de.loadingText="依据当前诊断与病历内容分析,正在筛为您筛选和匹配最适合的检验检查项目")):se("program",{key:e.key}));const n=null==(o=null==e?void 0:e.contents)?void 0:o[0];se("button-click",{msgItem:n,item:e})}}(e)},{default:v((()=>[h(f(Te(e)),1)])),_:2},1032,["style","round","disabled","onClick"])))),128)):p("v-if",!0)]),m(d(j),{"content-style":"height: 400px",placement:"top-start",trigger:"manual",width:"trigger","show-arrow":!1,to:!1,show:pe.value,onClickoutside:o[4]||(o[4]=e=>pe.value=!1)},{trigger:v((()=>[u("div",J,[m(d(I),{ref_key:"inputRef",ref:fe,placeholder:d(xe),type:"textarea",autosize:{minRows:d(ue)?1:2,maxRows:7},disabled:d(_e)||d(de).loading,value:d(de).sendContent,"onUpdate:value":o[2]||(o[2]=e=>d(de).sendContent=e),onKeydownCapture:Se,onInput:Le},y({_:2},[d(me)?void 0:{name:"prefix",fn:v((()=>[d(de).selectedCommand&&d(de).selectedCommand.shortcutTitle?(i(),c(d(z),{key:0,bordered:!1,color:{textColor:d(ae)["--c-primary-color"]},style:{"--n-border-radius":"5px"}},{default:v((()=>[h(" /"+f(d(de).selectedCommand.shortcutTitle),1)])),_:1},8,["color"])):d(Ie)?(i(),c(d(x),{key:1,text:"",onClick:o[1]||(o[1]=()=>ge.value=!0)},{default:v((()=>[m(d(_),{color:"#8f66f7",size:"18",component:d(D)},null,8,["component"])])),_:1})):p("v-if",!0)])),key:"0"},d(ue)?{name:"suffix",fn:v((()=>[m(d(x),{text:"",disabled:d(de).loading,onClick:Me},{icon:v((()=>[m(d(_),{size:"30"},{default:v((()=>[O])),_:1})])),_:1},8,["disabled"]),m(d(x),{circle:"",class:"gradient",style:{"margin-left":"10px"},disabled:d(je),onClick:Ue},{icon:v((()=>[m(d(_),{color:"#fff",size:"20",component:d(L)},null,8,["component"])])),_:1},8,["disabled"])])),key:"1"}:void 0]),1032,["placeholder","autosize","disabled","value"]),d(ue)?p("v-if",!0):(i(),s("div",Q,[d(me)?(i(),c(d(x),{key:0,text:"",disabled:d(_e)||be.value||d(de).loading,onClick:o[3]||(o[3]=e=>be.value=!0)},{icon:v((()=>[m(d(_),{size:"38"},{default:v((()=>[X])),_:1})])),_:1},8,["disabled"])):p("v-if",!0),u("span",{class:r(["btn-send","gradient","fillet-8",d(je)?"disabled":""]),disabled:d(je),onClick:Ue},[m(d(_),{color:"#fff",size:"22",component:d(L)},null,8,["component"])],10,Y)]))])])),default:v((()=>{var e;return[u("div",Z,[u("div",$,[0===ke.value.length?(i(),s("span",ee,(null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.189"))||"推荐指令")):(i(),s(k,{key:1},[m(d(x),{text:"",onClick:Ee},{default:v((()=>[m(d(_),{color:"#999",size:"20",component:d(U)},null,8,["component"])])),_:1}),m(d(M),null,{default:v((()=>[(i(!0),s(k,null,w(ke.value,(e=>(i(),c(d(T),{key:e.shortcutId},{default:v((()=>[h(f(e.shortcutTitle),1)])),_:2},1024)))),128))])),_:1})],64))]),u("div",oe,[(i(!0),s(k,null,w(we.value,(e=>(i(),s("div",{class:r(["menu-item",e.children&&e.children.length?"":"selectable",ye.value===e.shortcutId?"selected":""]),key:e.shortcutId,onMouseover:C((()=>ye.value=e.shortcutId),["stop"]),onClick:()=>Be(e)},[u("span",te,f(e.shortcutTitle),1),u("span",le,f(e.shortcutDescription),1),e.children&&e.children.length?(i(),c(d(_),{key:0,color:"#999",size:"20",component:d(B)},null,8,["component"])):p("v-if",!0)],42,ne)))),128))])])]})),_:1},8,["show"]),d(me)?p("v-if",!0):(i(),c(N,{key:0,show:ge.value,"onUpdate:show":o[5]||(o[5]=e=>ge.value=e)},null,8,["show"])),d(me)?p("v-if",!0):(i(),c(V,{key:1,show:Ce.value,"onUpdate:show":[o[6]||(o[6]=e=>Ce.value=e),Ke]},null,8,["show"])),d(me)?(i(),c(q,{key:2,show:be.value,"onUpdate:show":o[7]||(o[7]=e=>be.value=e)},null,8,["show"])):p("v-if",!0),d(me)?(i(),c(d(P),{key:3,value:d(de).switchFlag,"onUpdate:value":o[8]||(o[8]=e=>d(de).switchFlag=e),"rail-style":Ae},{checked:v((()=>[h("L1")])),unchecked:v((()=>[h("L2")])),_:1},8,["value"])):p("v-if",!0)],2)],2))}});export{ae as default};
1
+ import{defineComponent as e,ref as n,computed as o,onBeforeUnmount as t,watch as l,openBlock as a,createElementBlock as i,normalizeClass as s,unref as d,createElementVNode as r,createBlock as u,withCtx as c,createVNode as v,createTextVNode as m,toDisplayString as f,createCommentVNode as h,Fragment as k,renderList as p,normalizeStyle as w,createSlots as g,withModifiers as y,getCurrentInstance as C}from"vue";import{NButton as b,NIcon as x,NPopover as _,NInput as I,NTag as j,NBreadcrumb as z,NBreadcrumbItem as M,NSwitch as T}from"naive-ui";import{PeopleOutline as D,SparklesSharp as P,PaperPlane as L,ChevronBack as S,ChevronForward as U}from"@vicons/ionicons5";import"../../../audio-sdk/index.js";import{cloneDeep as B,isString as E,last as K}from"lodash-es";import A from"./ChatPrompt.vue.js";import F from"./ChatPatient.vue.js";import R from"./ChatAudio.vue.js";import{useData as V}from"../hooks/useData.js";import"../utils/index.js";import W from"../../../audio-sdk/src/audioSDK.js";const N={class:"menu-box fillet-8"},q={class:"input-wrapper fillet-10"},G=r("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},[r("path",{fill:"none",stroke:"black","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M192 448h128"}),r("path",{d:"M384 208v32c0 70.4-57.6 128-128 128h0c-70.4 0-128-57.6-128-128v-32",fill:"none",stroke:"black","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"}),r("path",{fill:"none",stroke:"black","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M256 368v80"}),r("path",{d:"M256 64a63.68 63.68 0 0 0-64 64v111c0 35.2 29 65 64 65s64-29 64-65V128c0-36-28-64-64-64z",fill:"none",stroke:"#4972EF","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"})],-1),H={key:0,class:"btn-box"},J=r("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},[r("path",{fill:"none",stroke:"black","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M192 448h128"}),r("path",{d:"M384 208v32c0 70.4-57.6 128-128 128h0c-70.4 0-128-57.6-128-128v-32",fill:"none",stroke:"black","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"}),r("path",{fill:"none",stroke:"black","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M256 368v80"}),r("path",{d:"M256 64a63.68 63.68 0 0 0-64 64v111c0 35.2 29 65 64 65s64-29 64-65V128c0-36-28-64-64-64z",fill:"none",stroke:"#4972EF","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"})],-1),O=["disabled"],Q={class:"command-box"},X={class:"command-box__header"},Y={key:0,class:"title"},Z={class:"command-box__menu"},$=["onMouseover","onClick"],ee={class:"label"},ne={class:"remark"};var oe=e({__name:"ChatFooter",setup(e){const oe=W.create(),{cssVars:te,shortcutList:le,state:ae,isSmall:ie,audioTimed:se,commandList:de,isDefault:re,patientInfo:ue,emit:ce,sendMessage:ve}=V(),me=n(),fe=n(!1),he=n([]),ke=n(B(de.value||[])),pe=n(!1),we=n(""),ge=n(!1),ye=n(!1),Ce=o((()=>re.value?"请向我提问,Shift+Enter换行":ie?'请向我提问或输入"/"查看指令':'请向我提问或输入"/"查看指令,Shift+Enter换行')),be=o((()=>{var e,n;return re.value&&1!==(null==(n=null==(e=ue.value)?void 0:e.info)?void 0:n.vac34)})),xe=o((()=>be.value||ae.loading||!ae.sendContent.replace(/(&nbsp;|\s|<br>)+/g,""))),_e=o((()=>{var e;return!ae.sendContent&&!(null==(e=me.value)?void 0:e.activated.value)})),Ie=o((()=>{var e,n;if(!ae.selectedPatient)return(null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.190"))||"选择患者";const{bcq04b:o,vaa05:t}=ae.selectedPatient;let l="";o&&(l+=o+((null==(n=window.getLanguageByCode)?void 0:n.call(window,"10010.1.191"))||"床"));return t&&(l+=(!l||l.endsWith("/")?"":"/")+t),l}));async function je(){try{const e=await oe.start({instance:C(),allowPunctuationMark:!1,timed:se.value||10,realTimeRecognition:!0});if("success"!==(null==e?void 0:e.result))return;ae.sendContent=e.data||""}catch(e){console.log(e)}}function ze(e){var n;if(E(e))return e;if(re.value)return e.value;const{content:o}=(null==(n=null==e?void 0:e.contents)?void 0:n[0])||{};return null==o?void 0:o.instructionName}function Me(){var e;fe.value=!1,ke.value=B(de.value||[]),he.value=[],(null==(e=de.value)?void 0:e.length)&&(fe.value=!0,we.value=ke.value[0].shortcutId)}function Te(e){if(re.value)"Enter"!==e.key||De(e)||Le();else if(!["Slash","NumpadDivide"].includes(e.code)||ae.selectedCommand||ae.sendContent)if("Backspace"===e.key)fe.value=!1,!ae.sendContent.startsWith("/")&&!ae.sendContent.startsWith("、")||2!==ae.sendContent.length||ae.selectedCommand?!ae.sendContent&&ae.selectedCommand&&(e.preventDefault(),ae.selectedCommand=null,ae.sendContent="/",Me()):Me();else if(fe.value&&["ArrowUp","ArrowDown"].includes(e.key)){const n=ke.value.findIndex((e=>e.shortcutId===we.value));if("ArrowUp"===e.key){const e=n>0?n-1:ke.value.length-1;we.value=ke.value[e].shortcutId}else if("ArrowDown"===e.key){const e=n<ke.value.length-1?n+1:0;we.value=ke.value[e].shortcutId}}else if(["Enter"].includes(e.key)){if(!De(e))if(e.preventDefault(),fe.value){Se(ke.value.find((e=>e.shortcutId===we.value)))}else Le()}else fe.value=!1;else Me()}function De(e){return e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}function Pe(e){!e&&ae.selectedPrompt&&(ae.selectedPrompt=null)}function Le(){xe.value||(re.value?ve():(ae.sending=!0,ae.loading=!0))}function Se(e){var n;we.value=e.shortcutId,me.value.focus(),(null==(n=e.children)?void 0:n.length)?(ke.value=e.children,we.value=ke.value[0].shortcutId,he.value.push(e)):(ae.selectedCommand=e||{},fe.value=!1,ae.sendContent="")}function Ue(){var e;he.value.pop(),ke.value=K(he.value)?null==(e=K(he.value))?void 0:e.children:B(de.value||[]),we.value=ke.value[0].shortcutId,me.value.focus()}function Be(e){e||(ae.showPatient=!1)}function Ee({focused:e,checked:n}){const o={};return n?(o.background="#d03050",e&&(o.boxShadow="0 0 0 2px #d0305040")):(o.background="#2080f0",e&&(o.boxShadow="0 0 0 2px #2080f040")),o}return t((()=>{W.destroy()})),l((()=>ae.showPatient),(e=>{e&&(ge.value=e)})),(e,n)=>(a(),i("section",{class:s(["chat-footer-wrapper",{"is-small":d(ie)}])},[r("div",{class:s(["chat-footer",d(ae).loading?"disabled":""])},[r("div",N,[d(ie)||d(re)?h("v-if",!0):(a(),u(d(b),{key:0,secondary:"",size:"small",onClick:n[0]||(n[0]=()=>ge.value=!0)},{icon:c((()=>[v(d(x),{color:d(te)["--c-primary-color"],size:"20",component:d(D)},null,8,["color","component"])])),default:c((()=>[m(" "+f(d(Ie)),1)])),_:1})),d(le)&&d(le).length>0?(a(!0),i(k,{key:1},p(d(le),(e=>(a(),u(d(b),{secondary:"",size:"small",style:w(d(ie)?"background: #fff":""),round:d(ie),key:ze(e),disabled:d(be),onClick:()=>function(e){var n;if(E(e))ae.sendContent=e;else{if(re.value&&e.key)return void(["recommend_treatment_plan","recommend_examination","recommend_diagnosis"].includes(e.key)?(ae.loadingText="","recommend_treatment_plan"===e.key?ae.loadingText="参考诊断结果与患者个体信息,正全面梳理知识库和临床指南,综合考量为您匹配最适宜的诊疗方案推荐":"recommend_examination"===e.key&&(ae.loadingText="依据当前诊断与病历内容分析,正在筛为您筛选和匹配最适合的检验检查项目"),ae.loadingText="系统正在对您的对话内容进行梳理整合,转化为规范的结构化问诊记录",ve({opType:e.key})):ce("program",{key:e.key}));const o=null==(n=null==e?void 0:e.contents)?void 0:n[0];ce("button-click",{msgItem:o,item:e})}}(e)},{default:c((()=>[m(f(ze(e)),1)])),_:2},1032,["style","round","disabled","onClick"])))),128)):h("v-if",!0)]),v(d(_),{"content-style":"height: 400px",placement:"top-start",trigger:"manual",width:"trigger","show-arrow":!1,to:!1,show:fe.value,onClickoutside:n[4]||(n[4]=e=>fe.value=!1)},{trigger:c((()=>[r("div",q,[v(d(I),{ref_key:"inputRef",ref:me,placeholder:d(Ce),type:"textarea",autosize:{minRows:d(ie)?1:2,maxRows:7},disabled:d(be)||d(ae).loading,value:d(ae).sendContent,"onUpdate:value":n[2]||(n[2]=e=>d(ae).sendContent=e),onKeydownCapture:Te,onInput:Pe},g({_:2},[d(re)?void 0:{name:"prefix",fn:c((()=>[d(ae).selectedCommand&&d(ae).selectedCommand.shortcutTitle?(a(),u(d(j),{key:0,bordered:!1,color:{textColor:d(te)["--c-primary-color"]},style:{"--n-border-radius":"5px"}},{default:c((()=>[m(" /"+f(d(ae).selectedCommand.shortcutTitle),1)])),_:1},8,["color"])):d(_e)?(a(),u(d(b),{key:1,text:"",onClick:n[1]||(n[1]=()=>pe.value=!0)},{default:c((()=>[v(d(x),{color:"#8f66f7",size:"18",component:d(P)},null,8,["component"])])),_:1})):h("v-if",!0)])),key:"0"},d(ie)?{name:"suffix",fn:c((()=>[v(d(b),{text:"",disabled:d(ae).loading,onClick:je},{icon:c((()=>[v(d(x),{size:"30"},{default:c((()=>[G])),_:1})])),_:1},8,["disabled"]),v(d(b),{circle:"",class:"gradient",style:{"margin-left":"10px"},disabled:d(xe),onClick:Le},{icon:c((()=>[v(d(x),{color:"#fff",size:"20",component:d(L)},null,8,["component"])])),_:1},8,["disabled"])])),key:"1"}:void 0]),1032,["placeholder","autosize","disabled","value"]),d(ie)?h("v-if",!0):(a(),i("div",H,[d(re)?(a(),u(d(b),{key:0,text:"",disabled:d(be)||ye.value||d(ae).loading,onClick:n[3]||(n[3]=e=>ye.value=!0)},{icon:c((()=>[v(d(x),{size:"38"},{default:c((()=>[J])),_:1})])),_:1},8,["disabled"])):h("v-if",!0),r("span",{class:s(["btn-send","gradient","fillet-8",d(xe)?"disabled":""]),disabled:d(xe),onClick:Le},[v(d(x),{color:"#fff",size:"22",component:d(L)},null,8,["component"])],10,O)]))])])),default:c((()=>{var e;return[r("div",Q,[r("div",X,[0===he.value.length?(a(),i("span",Y,(null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.189"))||"推荐指令")):(a(),i(k,{key:1},[v(d(b),{text:"",onClick:Ue},{default:c((()=>[v(d(x),{color:"#999",size:"20",component:d(S)},null,8,["component"])])),_:1}),v(d(z),null,{default:c((()=>[(a(!0),i(k,null,p(he.value,(e=>(a(),u(d(M),{key:e.shortcutId},{default:c((()=>[m(f(e.shortcutTitle),1)])),_:2},1024)))),128))])),_:1})],64))]),r("div",Z,[(a(!0),i(k,null,p(ke.value,(e=>(a(),i("div",{class:s(["menu-item",e.children&&e.children.length?"":"selectable",we.value===e.shortcutId?"selected":""]),key:e.shortcutId,onMouseover:y((()=>we.value=e.shortcutId),["stop"]),onClick:()=>Se(e)},[r("span",ee,f(e.shortcutTitle),1),r("span",ne,f(e.shortcutDescription),1),e.children&&e.children.length?(a(),u(d(x),{key:0,color:"#999",size:"20",component:d(U)},null,8,["component"])):h("v-if",!0)],42,$)))),128))])])]})),_:1},8,["show"]),d(re)?h("v-if",!0):(a(),u(A,{key:0,show:pe.value,"onUpdate:show":n[5]||(n[5]=e=>pe.value=e)},null,8,["show"])),d(re)?h("v-if",!0):(a(),u(F,{key:1,show:ge.value,"onUpdate:show":[n[6]||(n[6]=e=>ge.value=e),Be]},null,8,["show"])),d(re)?(a(),u(R,{key:2,show:ye.value,"onUpdate:show":n[7]||(n[7]=e=>ye.value=e)},null,8,["show"])):h("v-if",!0),d(re)?(a(),u(d(T),{key:3,value:d(ae).switchFlag,"onUpdate:value":n[8]||(n[8]=e=>d(ae).switchFlag=e),"rail-style":Ee},{checked:c((()=>[m("L1")])),unchecked:c((()=>[m("L2")])),_:1},8,["value"])):h("v-if",!0)],2)],2))}});export{oe as default};
@@ -1 +1 @@
1
- import{defineComponent as e,inject as n,ref as t,computed as l,watch as o,createVNode as s,createTextVNode as a,nextTick as i,isVNode as u}from"vue";import{NSpin as r,NAvatar as d,NSpace as c,NButton as m}from"naive-ui";import{InjectionAIChatEmits as v,InjectionAIChat as g}from"../types/index.js";import p from"../../../../shared/assets/img/ai__avatar.png.js";import f from"../../../../shared/assets/img/logo.png.js";import{isArray as h,isFunction as w,has as b}from"lodash-es";import{uuidGenerator as y}from"../../../../shared/utils/index.js";import"@vueuse/core";import"date-fns";import"@vue/shared";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{useScrollLoading as C}from"../../../../shared/hooks/useScrollLoading.js";import I from"./ChatCard.js";import{isValidJSON as j}from"../utils/index.js";import x from"./ChatBI.vue.js";function k(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!u(e)}var L=e({name:"ChatMain",inheritAttrs:!1,setup(e,{attrs:u,slots:L,emit:T}){const B=n(v),{userAvatar:E,queryData:P,state:S,queryRecord:M,defaultShortcutList:D,hideInput:O=!1,isSmall:z}=n(g),A=t(null),q=t([]),H=t(!1),N=t(!1),R=t(),U=l((()=>z.value?f:p)),_={page:0,hasMore:!0};async function F(e=!1){if(!_.hasMore)return;_.page++,1==_.page&&(q.value=[]);const{records:n,rows:t}=await M.value({page:_.page});h(t)&&q.value.length<=+n&&(q.value=_.page>1?[...q.value,...t]:t,K(),q.value.length>=+n&&(e&&(H.value=!0),_.hasMore=!1,console.log("没有更多消息了")))}async function J(){var e,n;q.value.unshift({msgId:y(),contents:[{role:"user",content:S.sendContent}]}),null==(e=A.value)||e.scrollTo({top:0,behavior:"auto"}),K();const t=S.selectedCommand,l=S.selectedPrompt;S.selectedCommand=null,S.selectedPrompt=null;const o=await P.value({content:S.sendContent,contentType:"text",command:t,prompt:l,patient:S.selectedPatient});h(null==o?void 0:o.contents)&&(q.value.unshift(o),await i(),null==(n=A.value)||n.scrollTo({top:0,behavior:"auto"})),S.selectedPatientLabel="",S.selectedPatientForm=null,S.sending=!1,S.loading=!1,S.sendContent=""}function G(e,n,t){if(e.type!==n){if(e.childrens&&e.childrens.length)for(let l=0;l<e.childrens.length;l++)G(e.childrens[l],n,t)}else t.push(e)}function K(){q.value.forEach((e=>{e.contents.forEach((e=>{var n;if(Reflect.has(e,"disabled")||(e.disabled=!0),"json"===e.contentType&&"string"!=typeof e.content){const{settings:t,data:l,needConfirms:o}=e.content;if(o||!(null==t?void 0:t.setting)||!j(null==t?void 0:t.setting)||!(null==(n=null==l?void 0:l.buttonList)?void 0:n.length))return;const{templates:s=[]}=JSON.parse(t.setting),a=[];s.forEach((e=>{G(e,"BUTTON",a)})),a.forEach((e=>{const{buttonList:n}=e.setting;n.forEach((e=>{var n;const{conditions:t=[]}=(null==(n=null==e?void 0:e.advancedConfig)?void 0:n.disabled)||{};t.length&&(l[e.id+"Disabled"]="1")}))}))}}))}))}function Q(e,n,t,l){const{contentType:o,content:a}=n;return"json"===o&&a?s(I,{selectParams:{taskId:e.taskId,instructionId:e.instructionId},msgItem:n,configs:t,msgId:l,"onButton-click":(t={})=>function(e){var n;const{item:t,msgItem:l,showMore:o}=e;return o?(R.value={item:t,msgItem:l},void(N.value=!0)):l?(B("button-click",e),void(l.disabled=!0)):void(t.link||(S.sendContent=(null==(n=window.getLanguageByCode)?void 0:n.call(window,"10010.1.27"))||"确定",S.sending=!0,S.loading=!0))}({item:e,msgItem:n,...t})},null):null}function V(e,n){const{contents:t=[],buttonType:l="",configs:o={},msgId:a=""}=e,i=Q(e,t[n],o,a);if(i)return i;return[t[n].content.replace(/\\n|\n|\r\n/g,"<br>").split("<br>").filter((e=>!!e)).map(((e,n,t)=>[e,n===t.length-1?null:s("br",null,null)]))]}function W({role:e=""}){return"user"===e}function X(){var e,n;let t;return s("div",{class:"message-item"},[s(d,{round:!0,size:z.value?64:40,src:U.value},null),s("div",{class:"content-box"},[s("div",{class:"content fillet-10 default"},[s("h2",null,[a((null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.192"))||"Hi,我是你的AI助理")]),s("p",null,[a("我汇集了医生站/护士站各项智能服务,可以向我进行提问哦 ~ "),s("br",null,null),a("你的反馈助我成长,期待我们一起探索未来!下次可以在首页和应用页找到我~")]),h(D.value)&&D.value.length>0?[s("p",{style:"margin: 5px 0 5px"},[a((null==(n=window.getLanguageByCode)?void 0:n.call(window,"10010.1.195"))||"你可以试着问我:")]),s(c,{"wrap-item":!1},k(t=D.value.map((e=>s(m,{size:"large",secondary:!0,onClick:()=>S.sendContent=e,disabled:S.loading},k(e)?e:{default:()=>[e]}))))?t:{default:()=>[t]})]:null])])])}return C(A,(()=>{F()}),O.value?"bottom":"top"),F(!0),o((()=>S.externalData),(e=>{var n,t;e&&(b(n=e,"msgId")||(n.msgId=y()),q.value.unshift(n),null==(t=A.value)||t.scrollTo({top:0,behavior:"auto"}),S.loading=!1,S.externalData=null)})),o((()=>S.sending),(e=>{var n,t,l,o,s,a,i;if(e){if(q.value.length>0&&[(null==(n=window.getLanguageByCode)?void 0:n.call(window,"10010.1.428"))||"确认",(null==(t=window.getLanguageByCode)?void 0:t.call(window,"10010.1.27"))||"确定"].includes(S.sendContent)){const e=null==(s=null==(l=q.value[0])?void 0:l.contents)?void 0:s[(null==(o=q.value[0].contents)?void 0:o.length)-1];return(null==(a=e.content)?void 0:a.body)&&!e.disabled?(null==(i=document.getElementById(q.value[0].msgId))||i.click(),void setTimeout((()=>{q.value.unshift({msgId:y(),contents:[{role:"user",content:S.sendContent}]}),S.selectedCommand=null,S.selectedPrompt=null,S.sending=!1,S.sendContent=""}))):void J()}J()}})),()=>[s("section",{class:"chat-main-wrapper",ref:A},[s("div",{class:"chat-main-box"},[s("div",{class:"chat-main",style:{"flex-direction":O.value?"column":"column-reverse"}},[[S.loading?s("div",{class:"message-item"},[[s("div",{class:"content-box"},[s("div",{class:"content loading"},[s(r,{size:22,stroke:"#4170EE"},null),s("span",null,[a("正在加载中,请稍等...")])])])]]):null,q.value.map((e=>e.contents.map(((n,t)=>s("div",{class:"message-item",key:e.msgId+t},[[s("div",{class:["content-box",W(n)?"mine":""]},[s("div",{class:"content"},[w(n.render)?n.render():V(e,t)])])]]))))),H.value?X():null]]),s(x,{show:N.value,"onUpdate:show":e=>N.value=e,data:R.value},null)])])]}});export{L as default};
1
+ import{defineComponent as e,ref as n,computed as t,watch as l,createVNode as o,createTextVNode as s,nextTick as a,isVNode as i}from"vue";import{NSpin as u,NAvatar as r,NSpace as d,NButton as c}from"naive-ui";import m from"../../../../shared/assets/img/ai__avatar.png.js";import v from"../../../../shared/assets/img/logo.png.js";import{isArray as g,isFunction as p,has as f}from"lodash-es";import{uuidGenerator as h}from"../../../../shared/utils/index.js";import"@vueuse/core";import"date-fns";import"@vue/shared";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{useScrollLoading as w}from"../../../../shared/hooks/useScrollLoading.js";import b from"./ChatCard.js";import{isValidJSON as C}from"../utils/index.js";import y from"./ChatBI.vue.js";import{useData as I}from"../hooks/useData.js";function j(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!i(e)}var k=e({name:"ChatMain",inheritAttrs:!1,setup(e,{attrs:i,slots:k,emit:x}){const{state:L,queryData:T,queryRecord:B,defaultShortcutList:E,hideInput:P,isSmall:S,emit:D}=I(),M=n(null),O=n([]),z=n(!1),q=n(!1),A=n(),H=t((()=>S.value?v:m)),N={page:0,hasMore:!0};async function R(e=!1){if(!N.hasMore)return;N.page++,1==N.page&&(O.value=[]);const{records:n,rows:t}=await B.value({page:N.page});g(t)&&O.value.length<=+n&&(O.value=N.page>1?[...O.value,...t]:t,F(),O.value.length>=+n&&(e&&(z.value=!0),N.hasMore=!1,console.log("没有更多消息了")))}async function U(){var e,n;O.value.unshift({msgId:h(),contents:[{role:"user",content:L.sendContent}]}),null==(e=M.value)||e.scrollTo({top:0,behavior:"auto"}),F();const t=L.selectedCommand,l=L.selectedPrompt;L.selectedCommand=null,L.selectedPrompt=null;const o=await T.value({content:L.sendContent,contentType:"text",command:t,prompt:l,patient:L.selectedPatient});g(null==o?void 0:o.contents)&&(O.value.unshift(o),await a(),null==(n=M.value)||n.scrollTo({top:0,behavior:"auto"})),L.selectedPatientLabel="",L.selectedPatientForm=null,L.sending=!1,L.loading=!1,L.sendContent=""}function _(e,n,t){if(e.type!==n){if(e.childrens&&e.childrens.length)for(let l=0;l<e.childrens.length;l++)_(e.childrens[l],n,t)}else t.push(e)}function F(){O.value.forEach((e=>{e.contents.forEach((e=>{var n;if(Reflect.has(e,"disabled")||(e.disabled=!0),"json"===e.contentType&&"string"!=typeof e.content){const{settings:t,data:l,needConfirms:o}=e.content;if(o||!(null==t?void 0:t.setting)||!C(null==t?void 0:t.setting)||!(null==(n=null==l?void 0:l.buttonList)?void 0:n.length))return;const{templates:s=[]}=JSON.parse(t.setting),a=[];s.forEach((e=>{_(e,"BUTTON",a)})),a.forEach((e=>{const{buttonList:n}=e.setting;n.forEach((e=>{var n;const{conditions:t=[]}=(null==(n=null==e?void 0:e.advancedConfig)?void 0:n.disabled)||{};t.length&&(l[e.id+"Disabled"]="1")}))}))}}))}))}function J(e,n,t,l){const{contentType:s,content:a}=n;return"json"===s&&a?o(b,{selectParams:{taskId:e.taskId,instructionId:e.instructionId},msgItem:n,configs:t,msgId:l,"onButton-click":(t={})=>function(e){var n;const{item:t,msgItem:l,showMore:o}=e;return o?(A.value={item:t,msgItem:l},void(q.value=!0)):l?(D("button-click",e),void(l.disabled=!0)):void(t.link||(L.sendContent=(null==(n=window.getLanguageByCode)?void 0:n.call(window,"10010.1.27"))||"确定",L.sending=!0,L.loading=!0))}({item:e,msgItem:n,...t})},null):null}function G(e,n){const{contents:t=[],buttonType:l="",configs:s={},msgId:a=""}=e,i=J(e,t[n],s,a);if(i)return i;return[t[n].content.replace(/\\n|\n|\r\n/g,"<br>").split("<br>").filter((e=>!!e)).map(((e,n,t)=>[e,n===t.length-1?null:o("br",null,null)]))]}function K({role:e=""}){return"user"===e}function Q(){var e,n;let t;return o("div",{class:"message-item"},[o(r,{round:!0,size:S.value?64:40,src:H.value},null),o("div",{class:"content-box"},[o("div",{class:"content fillet-10 default"},[o("h2",null,[s((null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.192"))||"Hi,我是你的AI助理")]),o("p",null,[s("我汇集了医生站/护士站各项智能服务,可以向我进行提问哦 ~ "),o("br",null,null),s("你的反馈助我成长,期待我们一起探索未来!下次可以在首页和应用页找到我~")]),g(E.value)&&E.value.length>0?[o("p",{style:"margin: 5px 0 5px"},[s((null==(n=window.getLanguageByCode)?void 0:n.call(window,"10010.1.195"))||"你可以试着问我:")]),o(d,{"wrap-item":!1},j(t=E.value.map((e=>o(c,{size:"large",secondary:!0,onClick:()=>L.sendContent=e,disabled:L.loading},j(e)?e:{default:()=>[e]}))))?t:{default:()=>[t]})]:null])])])}return w(M,(()=>{R()}),P.value?"bottom":"top"),R(!0),l((()=>L.externalData),(e=>{var n,t;e&&(f(n=e,"msgId")||(n.msgId=h()),O.value.unshift(n),null==(t=M.value)||t.scrollTo({top:0,behavior:"auto"}),L.loading=!1,L.externalData=null)})),l((()=>L.sending),(e=>{var n,t,l,o,s,a,i;if(e){if(O.value.length>0&&[(null==(n=window.getLanguageByCode)?void 0:n.call(window,"10010.1.428"))||"确认",(null==(t=window.getLanguageByCode)?void 0:t.call(window,"10010.1.27"))||"确定"].includes(L.sendContent)){const e=null==(s=null==(l=O.value[0])?void 0:l.contents)?void 0:s[(null==(o=O.value[0].contents)?void 0:o.length)-1];return(null==(a=e.content)?void 0:a.body)&&!e.disabled?(null==(i=document.getElementById(O.value[0].msgId))||i.click(),void setTimeout((()=>{O.value.unshift({msgId:h(),contents:[{role:"user",content:L.sendContent}]}),L.selectedCommand=null,L.selectedPrompt=null,L.sending=!1,L.sendContent=""}))):void U()}U()}})),()=>[o("section",{class:"chat-main-wrapper",ref:M},[o("div",{class:"chat-main-box"},[o("div",{class:"chat-main",style:{"flex-direction":P.value?"column":"column-reverse"}},[[L.loading?o("div",{class:"message-item"},[[o("div",{class:"content-box"},[o("div",{class:"content loading"},[o(u,{size:22,stroke:"#4170EE"},null),o("span",null,[s("正在加载中,请稍等...")])])])]]):null,O.value.map((e=>e.contents.map(((n,t)=>o("div",{class:"message-item",key:e.msgId+t},[[o("div",{class:["content-box",K(n)?"mine":""]},[o("div",{class:"content"},[p(n.render)?n.render():G(e,t)])])]]))))),z.value?Q():null]]),o(y,{show:q.value,"onUpdate:show":e=>q.value=e,data:A.value},null)])])]}});export{k as default};
@@ -1 +1 @@
1
- import{defineComponent as e,inject as n,ref as t,watch as o,createVNode as r,nextTick as a,resolveComponent as s}from"vue";import{NTooltip as l,NButton as i,NIcon as c}from"naive-ui";import{InjectionAIChatEmits as u,InjectionAIChat as d}from"../types/index.js";import{isArray as p,cloneDeep as m,isFunction as v}from"lodash-es";import{uuidGenerator as g}from"../../../../shared/utils/index.js";import"@vueuse/core";import"date-fns";import"@vue/shared";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import{SyncOutline as h}from"@vicons/ionicons5";import{useScrollLoading as f}from"../../../../shared/hooks/useScrollLoading.js";import y from"./card/JsonCard.js";import{getHistoryRecordApi as x,conversationApi as _}from"../api/index.js";var T=e({name:"ChatMain",inheritAttrs:!1,components:{JsonCard:y},setup(e,{attrs:y,slots:T,emit:b}){const j=n(u),{patientInfo:w,state:C,vaa07:q}=n(d),k=t(null),I=t([]),M={page:0,hasMore:!0};async function S(){if(!q.value)return;if(!M.hasMore||!q.value)return;M.page++,1==M.page&&(I.value=[]);const e=await x({sessionId:q.value,page:M.page,pageSize:20}),{rows:n,query:t={}}=e||{};p(n)&&(n.forEach((e=>{p(e.contents)&&e.contents.length>1&&e.contents.reverse()})),I.value.length<=+t.records&&(I.value=M.page>1?[...I.value,...n]:n,I.value.length>=+t.records&&(M.hasMore=!1,console.log("没有更多消息了"))))}async function R(e){var n;p(e.contents)&&(I.value.unshift(e),await a(),null==(n=k.value)||n.scrollTo({top:0,behavior:"auto"}))}function F(e,n){var t;const{contentType:o,messageType:r}=(null==(t=null==e?void 0:e.contents)?void 0:t[n])||{};return"json"===o&&"retry_inquiry"!==r}function J(e){const n=e.replace(/\\n|\n|\r\n/g,"<br>").split("<br>").filter((e=>!!e)).map(((e,n,t)=>[e,n===t.length-1?null:r("br",null,null)]));return n.length?[n]:null}function O(e,n){var t,o,a,u,d;const{contents:p=[],msgId:m=""}=e;return"json"===(null==(t=p[n])?void 0:t.contentType)?"retry_inquiry"===(null==(o=p[n])?void 0:o.messageType)?[J((null==(u=null==(a=p[n])?void 0:a.content)?void 0:u.errorMsg)||""),r(l,{trigger:"hover"},{default:()=>"重新生成",trigger:()=>r(i,{style:"position: relative;top: 3px;margin-left: 8px",type:"primary",text:!0,onClick:()=>{var e,t,o;return o=null==(t=null==(e=p[n])?void 0:e.content)?void 0:t.audioUrl,C.params={audioUrl:o,opType:"create_inquiry"},C.sending=!0,C.loading=!0,void(C.loadingText="系统正在对您的对话内容进行梳理整合,转化为规范的结构化问诊记录")}},{icon:()=>r(c,{component:h},null)})})]:function(e,n){return r(s("json-card"),{item:e,messageItem:n},null)}(e,p[n]):J((null==(d=p[n])?void 0:d.content)||"")}function U({role:e=""}){return"user"===e}return f(k,(()=>{S()}),"top"),o((()=>q.value),(e=>{C.showRight=!1,I.value=[],M.page=0,M.hasMore=!0,S()}),{immediate:!0}),o((()=>C.reportContent),(e=>{e&&(R(e),C.reportContent=null)})),o((()=>C.sending),(async e=>{var n,t,o,r,a,s,l;if(e){const{opType:e}=C.params||{};if(!e&&C.sendContent&&I.value.unshift({msgId:g(),contents:[{role:"user",content:C.sendContent}]}),null==(n=k.value)||n.scrollTo({top:0,behavior:"auto"}),e&&["recommend_treatment_plan","recommend_diagnosis","recommend_examination"].includes(e)){if(I.value.length>0){const e=I.value.find((e=>{var n;return!U(null==(n=null==e?void 0:e.contents)?void 0:n[0])}));e&&Object.assign(C.params,m(e))}Object.assign(C.params,{contents:[{role:"user",content:"",contentType:"text"}]})}try{const n=await _({contents:[{role:"user",content:C.sendContent,contentType:"text"}],platform:"web",sessionType:"text_chat",source:"global",configs:w.value.info,switchFlag:C.switchFlag?1:0,...C.params});["diagnosis","medical_order"].includes(e)&&C.showRightSlot&&j("program",{key:"medical",type:"refresh",params:{vac01:null==(o=null==(t=w.value)?void 0:t.info)?void 0:o.vac01,type:1}}),p(n.contents)&&n.contents.length>1&&n.contents.reverse(),R(n),e&&["create_inquiry","create_medical"].includes(e)&&("create_inquiry"===e?"retry_inquiry"!==(null==(a=null==(r=null==n?void 0:n.contents)?void 0:r[0])?void 0:a.messageType)&&(C.consultationContent=n,C.showRight=!0,C.showRightSlot=!1):j("program",{key:"medical",params:{vac01:null==(l=null==(s=w.value)?void 0:s.info)?void 0:l.vac01,type:1}})),e&&"create_inquiry"!==e||(C.sendContent=""),C.params={}}catch(e){console.log("error ==>",e)}finally{C.sending=!1,C.loading=!1,C.loadingText=""}}})),()=>[r("section",{class:"chat-main-wrapper",ref:k},[r("div",{class:"chat-main-box"},[r("div",{class:"chat-main",style:"column-reverse"},[[C.loading?r("div",{class:"message-item"},[r("div",{class:"content-box"},[r("div",{class:"content loading"},[r("span",{class:"ai-chat__loading-icon"},null),r("span",null,[C.loadingText||"正在整合数据..."])])])]):null,I.value.map((e=>e.contents.map(((n,t)=>O(e,t)?r("div",{class:"message-item",key:e.msgId+t},[r("div",{class:["content-box",U(n)?"mine":""]},[r("div",{class:["content",{"content-json":!v(n.render)&&F(e,t)}]},[v(n.render)?n.render():O(e,t)])])]):null))))]])])])]}});export{T as default};
1
+ import{defineComponent as e,ref as n,watch as o,createVNode as r,resolveComponent as t}from"vue";import{NTooltip as s,NButton as i,NIcon as a}from"naive-ui";import{isArray as l,isFunction as c}from"lodash-es";import"../../../../shared/utils/index.js";import"@vueuse/core";import"date-fns";import"@vue/shared";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import{SyncOutline as u}from"@vicons/ionicons5";import{useScrollLoading as d}from"../../../../shared/hooks/useScrollLoading.js";import m from"./card/JsonCard.js";import{getHistoryRecordApi as p}from"../api/index.js";import{useData as g}from"../hooks/useData.js";import"../utils/index.js";var v=e({name:"ChatMain",inheritAttrs:!1,components:{JsonCard:m},setup(e,{attrs:m,slots:v,emit:h}){const{state:f,vaa07:y,sendMessage:x}=g(),j=n(null),M={page:0,hasMore:!0};async function T(){if(!y.value)return;if(!M.hasMore||!y.value)return;M.page++,1==M.page&&(f.record=[]);const e=await p({sessionId:y.value,page:M.page,pageSize:20}),{rows:n,query:o={}}=e||{};l(n)&&(n.forEach((e=>{l(e.contents)&&e.contents.length>1&&e.contents.reverse()})),f.record.length<=+o.records&&(f.record=M.page>1?[...f.record,...n]:n,f.record.length>=+o.records&&(M.hasMore=!1,console.log("没有更多消息了"))))}function b(e,n){var o;const{contentType:r,messageType:t}=(null==(o=null==e?void 0:e.contents)?void 0:o[n])||{};return"json"===r&&"retry_inquiry"!==t}function k(e){const n=e.replace(/\\n|\n|\r\n/g,"<br>").split("<br>").filter((e=>!!e)).map(((e,n,o)=>[e,n===o.length-1?null:r("br",null,null)]));return n.length?[n]:null}function w(e,n){var o,l,c,d,m;const{contents:p=[],msgId:g=""}=e;return"json"===(null==(o=p[n])?void 0:o.contentType)?"retry_inquiry"===(null==(l=p[n])?void 0:l.messageType)?[k((null==(d=null==(c=p[n])?void 0:c.content)?void 0:d.errorMsg)||""),r(s,{trigger:"hover"},{default:()=>"重新生成",trigger:()=>r(i,{style:"position: relative;top: 3px;margin-left: 8px",type:"primary",text:!0,onClick:()=>{var e,o,r;return r=null==(o=null==(e=p[n])?void 0:e.content)?void 0:o.audioUrl,f.loadingText="系统正在对您的对话内容进行梳理整合,转化为规范的结构化问诊记录",void x({audioUrl:r,opType:"create_inquiry"})}},{icon:()=>r(a,{component:u},null)})})]:function(e,n){return r(t("json-card"),{item:e,messageItem:n},null)}(e,p[n]):k((null==(m=p[n])?void 0:m.content)||"")}function C({role:e=""}){return"user"===e}return d(j,(()=>{T()}),"top"),o((()=>y.value),(e=>{f.showRight=!1,f.showRightSlot=!1,f.record=[],M.page=0,M.hasMore=!0,T()}),{immediate:!0}),()=>[r("section",{class:"chat-main-wrapper",ref:j},[r("div",{class:"chat-main-box"},[r("div",{class:"chat-main",style:"column-reverse"},[[f.loading?r("div",{class:"message-item"},[r("div",{class:"content-box"},[r("div",{class:"content loading"},[r("span",{class:"ai-chat__loading-icon"},null),r("span",null,[f.loadingText||"正在整合数据..."])])])]):null,f.record.map((e=>e.contents.map(((n,o)=>w(e,o)?r("div",{class:"message-item",key:e.msgId+o},[r("div",{class:["content-box",C(n)?"mine":""]},[r("div",{class:["content",{"content-json":!c(n.render)&&b(e,o)}]},[c(n.render)?n.render():w(e,o)])])]):null))))]])])])]}});export{v as default};
@@ -13,8 +13,8 @@ declare const _default: import("vue").DefineComponent<{
13
13
  "onUpdate:show"?: ((...args: any[]) => any) | undefined;
14
14
  }>>;
15
15
  emit: (event: "update:show", ...args: any[]) => void;
16
- patientInfo: any;
17
- state: any;
16
+ state: AnyObject;
17
+ patientInfo: import("vue").Ref<any>;
18
18
  formValue: {
19
19
  businessType: string;
20
20
  vaa01: null;
@@ -1 +1 @@
1
- import{defineComponent as e,inject as a,reactive as l,ref as n,openBlock as t,createBlock as o,unref as u,withCtx as i,createVNode as d,createTextVNode as r,toDisplayString as w}from"vue";import{NDrawer as s,NDrawerContent as v,NForm as g,NFormItem as c,NRadioGroup as f,NRadio as p,NSelect as y,NButton as b}from"naive-ui";import{isFunction as m,isArray as h}from"lodash-es";import{InjectionAIChat as C}from"../types/index.js";var L=e({__name:"ChatPatient",props:{show:{type:Boolean}},emits:["update:show"],setup(e,{emit:L}){var B;const{patientInfo:_,state:k}=a(C),I=l({businessType:"CLINICIAN",vaa01:null,bck03a:""}),P={businessType:{required:!0,trigger:"change",message:"请选择类型"},vaa01:{required:!0,trigger:["blur","change"],message:(null==(B=window.getLanguageByCode)?void 0:B.call(window,"10010.1.201"))||"请选择患者"}},T=n([]),q=n();function N(e){var a,l,n,t;const{bcq04b:o,vae96:u}=e,i="1"==u?(null==(a=window.getLanguageByCode)?void 0:a.call(window,"10010.1.203"))||"男":"2"==u?(null==(l=window.getLanguageByCode)?void 0:l.call(window,"10010.1.204"))||"女":(null==(n=window.getLanguageByCode)?void 0:n.call(window,"10010.1.205"))||"未知";let d="";o&&(d+=o+((null==(t=window.getLanguageByCode)?void 0:t.call(window,"10010.1.191"))||"床"));const r=a=>{e[a]&&(d+=(!d||d.endsWith("/")?"":"/")+e[a])};return r("vaa05"),d+="/"+i,r("vae87"),r("bck02a"),d.startsWith("/")&&(d=d.slice(1)),d}function A(e,a){I.bck03a=a.bck03a}async function x(e){var a;if(m(null==(a=_.value)?void 0:a.queryPatient))try{const a=await _.value.queryPatient({keyword:e,businessType:I.businessType});if(h(a))return void(T.value=a);T.value=[]}catch(e){T.value=[]}}function S(){I.vaa01=null,I.bck03a="",x("")}function U(e){var a;e.preventDefault(),null==(a=q.value)||a.validate((e=>{if(!e){const e={...I,...T.value.find((e=>e.vaa01===I.vaa01))};k.showPatient?(k.selectedPatientLabel=N(e),k.selectedPatientForm=e):k.selectedPatient=e,L("update:show",!1)}}))}return x(""),(a,l)=>(t(),o(u(s),{placement:"bottom",height:"300","trap-focus":!1,to:"#"+u(k).id,show:e.show,onMaskClick:l[2]||(l[2]=()=>L("update:show",!1))},{default:i((()=>[d(u(v),null,{default:i((()=>[d(u(g),{ref_key:"formRef",ref:q,"label-placement":"left","label-width":"auto",size:"large",model:I,"require-mark-placement":"right-hanging",rules:P},{default:i((()=>{var e,a,n;return[d(u(c),{label:(null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.197"))||"业务",path:"businessType"},{default:i((()=>{var e;return[d(u(f),{value:I.businessType,"onUpdate:value":[l[0]||(l[0]=e=>I.businessType=e),S],name:(null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.197"))||"业务"},{default:i((()=>[d(u(p),{value:"CLINICIAN"},{default:i((()=>{var e;return[r((null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.198"))||"门诊")]})),_:1}),d(u(p),{value:"HOSPITAL"},{default:i((()=>{var e;return[r((null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.199"))||"住院")]})),_:1})])),_:1},8,["value"])]})),_:1}),d(u(c),{label:(null==(a=window.getLanguageByCode)?void 0:a.call(window,"10010.1.200"))||"患者",path:"vaa01"},{default:i((()=>{var e;return[d(u(y),{to:"body",remote:"",value:I.vaa01,"onUpdate:value":[l[1]||(l[1]=e=>I.vaa01=e),A],placeholder:(null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.201"))||"请选择患者",filterable:"",options:T.value,"render-label":N,"value-field":"vaa01",onSearch:x},null,8,["value","options"])]})),_:1}),d(u(c),{label:(null==(n=window.getLanguageByCode)?void 0:n.call(window,"10010.1.202"))||"科室"},{default:i((()=>[r(w(I.bck03a),1)])),_:1}),d(u(c),null,{default:i((()=>[d(u(b),{block:"",type:"primary",onClick:U},{default:i((()=>{var e;return[r((null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.27"))||"确定")]})),_:1})])),_:1})]})),_:1},8,["model"])])),_:1})])),_:1},8,["to","show"]))}});export{L as default};
1
+ import{defineComponent as e,reactive as a,ref as l,openBlock as n,createBlock as t,unref as o,withCtx as u,createVNode as i,createTextVNode as d,toDisplayString as r}from"vue";import{NDrawer as s,NDrawerContent as w,NForm as v,NFormItem as g,NRadioGroup as c,NRadio as f,NSelect as p,NButton as y}from"naive-ui";import{isFunction as b,isArray as m}from"lodash-es";import{useData as h}from"../hooks/useData.js";import"../utils/index.js";var C=e({__name:"ChatPatient",props:{show:{type:Boolean}},emits:["update:show"],setup(e,{emit:C}){var L;const{state:k,patientInfo:B}=h(),_=a({businessType:"CLINICIAN",vaa01:null,bck03a:""}),I={businessType:{required:!0,trigger:"change",message:"请选择类型"},vaa01:{required:!0,trigger:["blur","change"],message:(null==(L=window.getLanguageByCode)?void 0:L.call(window,"10010.1.201"))||"请选择患者"}},P=l([]),T=l();function q(e){var a,l,n,t;const{bcq04b:o,vae96:u}=e,i="1"==u?(null==(a=window.getLanguageByCode)?void 0:a.call(window,"10010.1.203"))||"男":"2"==u?(null==(l=window.getLanguageByCode)?void 0:l.call(window,"10010.1.204"))||"女":(null==(n=window.getLanguageByCode)?void 0:n.call(window,"10010.1.205"))||"未知";let d="";o&&(d+=o+((null==(t=window.getLanguageByCode)?void 0:t.call(window,"10010.1.191"))||"床"));const r=a=>{e[a]&&(d+=(!d||d.endsWith("/")?"":"/")+e[a])};return r("vaa05"),d+="/"+i,r("vae87"),r("bck02a"),d.startsWith("/")&&(d=d.slice(1)),d}function N(e,a){_.bck03a=a.bck03a}async function A(e){var a;if(b(null==(a=B.value)?void 0:a.queryPatient))try{const a=await B.value.queryPatient({keyword:e,businessType:_.businessType});if(m(a))return void(P.value=a);P.value=[]}catch(e){P.value=[]}}function j(){_.vaa01=null,_.bck03a="",A("")}function x(e){var a;e.preventDefault(),null==(a=T.value)||a.validate((e=>{if(!e){const e={..._,...P.value.find((e=>e.vaa01===_.vaa01))};k.showPatient?(k.selectedPatientLabel=q(e),k.selectedPatientForm=e):k.selectedPatient=e,C("update:show",!1)}}))}return A(""),(a,l)=>(n(),t(o(s),{placement:"bottom",height:"300","trap-focus":!1,to:"#"+o(k).id,show:e.show,onMaskClick:l[2]||(l[2]=()=>C("update:show",!1))},{default:u((()=>[i(o(w),null,{default:u((()=>[i(o(v),{ref_key:"formRef",ref:T,"label-placement":"left","label-width":"auto",size:"large",model:_,"require-mark-placement":"right-hanging",rules:I},{default:u((()=>{var e,a,n;return[i(o(g),{label:(null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.197"))||"业务",path:"businessType"},{default:u((()=>{var e;return[i(o(c),{value:_.businessType,"onUpdate:value":[l[0]||(l[0]=e=>_.businessType=e),j],name:(null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.197"))||"业务"},{default:u((()=>[i(o(f),{value:"CLINICIAN"},{default:u((()=>{var e;return[d((null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.198"))||"门诊")]})),_:1}),i(o(f),{value:"HOSPITAL"},{default:u((()=>{var e;return[d((null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.199"))||"住院")]})),_:1})])),_:1},8,["value"])]})),_:1}),i(o(g),{label:(null==(a=window.getLanguageByCode)?void 0:a.call(window,"10010.1.200"))||"患者",path:"vaa01"},{default:u((()=>{var e;return[i(o(p),{to:"body",remote:"",value:_.vaa01,"onUpdate:value":[l[1]||(l[1]=e=>_.vaa01=e),N],placeholder:(null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.201"))||"请选择患者",filterable:"",options:P.value,"render-label":q,"value-field":"vaa01",onSearch:A},null,8,["value","options"])]})),_:1}),i(o(g),{label:(null==(n=window.getLanguageByCode)?void 0:n.call(window,"10010.1.202"))||"科室"},{default:u((()=>[d(r(_.bck03a),1)])),_:1}),i(o(g),null,{default:u((()=>[i(o(y),{block:"",type:"primary",onClick:x},{default:u((()=>{var e;return[d((null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.27"))||"确定")]})),_:1})])),_:1})]})),_:1},8,["model"])])),_:1})])),_:1},8,["to","show"]))}});export{C as default};
@@ -16,8 +16,8 @@ declare const _default: import("vue").DefineComponent<{
16
16
  "onUpdate:show"?: ((...args: any[]) => any) | undefined;
17
17
  }>>;
18
18
  emit: (event: "update:show", ...args: any[]) => void;
19
- queryPrompt: any;
20
- state: any;
19
+ state: AnyObject;
20
+ queryPrompt: import("vue").Ref<any>;
21
21
  listRef: import("vue").Ref<any>;
22
22
  keyword: import("vue").Ref<string>;
23
23
  list: import("vue").Ref<AnyObject[]>;
@@ -1 +1 @@
1
- import{createElementVNode as e,defineComponent as o,inject as t,ref as a,computed as l,watch as n,openBlock as r,createBlock as s,unref as p,withCtx as u,createVNode as i,createElementBlock as c,Fragment as d,renderList as m,toDisplayString as v,withDirectives as h,vShow as f}from"vue";import{NDrawer as w,NDrawerContent as g,NButton as k,NIcon as C,NInput as y}from"naive-ui";import{CloseOutline as _,SearchOutline as j}from"@vicons/ionicons5";import{isFunction as x}from"lodash-es";import"../../../../shared/utils/index.js";import{useDebounceFn as M}from"@vueuse/core";import"date-fns";import"@vue/shared";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import{useScrollLoading as b}from"../../../../shared/hooks/useScrollLoading.js";import{InjectionAIChat as B}from"../types/index.js";var L;const P={class:"title"},R=e("span",null,(null==(L=window.getLanguageByCode)?void 0:L.call(window,"10010.1.206"))||"发现提示词",-1),S=["onClick"];var U=o({__name:"ChatPrompt",props:{show:{type:Boolean}},emits:["update:show"],setup(o,{emit:L}){const U=o,q={page:0,hasMore:!0},{queryPrompt:z,state:H}=t(B),I=a(),O=a(""),T=a([]),$=l((()=>!T.value.length&&!!(O.value||"").replace(/^\s+|\s+$/g,""))),A=M(E,500);async function D(){try{if(!q.hasMore||!x(z.value))return;q.page++,1==q.page&&(T.value=[]);const e=await z.value({keyword:O.value,page:q.page});T.value.length<=+e.records&&(T.value=q.page>1?T.value.concat(e.rows):e.rows,T.value.length>=+e.records&&(q.hasMore=!1))}catch(e){}}function E(){Object.assign(q,{page:0,hasMore:!0}),D()}return b(I,(()=>{D()})),n((()=>U.show),(e=>{e&&(O.value="",E())})),(t,a)=>(r(),s(p(w),{placement:"bottom",height:"70%","trap-focus":!1,to:"#"+p(H).id,show:o.show,"content-class":"prompt-wrapper",onMaskClick:a[2]||(a[2]=()=>L("update:show",!1))},{default:u((()=>[i(p(g),null,{header:u((()=>[e("div",P,[R,i(p(k),{text:"",onClick:a[0]||(a[0]=()=>L("update:show",!1))},{default:u((()=>[i(p(C),{size:"20",component:p(_)},null,8,["component"])])),_:1})]),i(p(y),{ref:"inputRef",clearable:"",autofocus:"",value:O.value,"onUpdate:value":[a[1]||(a[1]=e=>O.value=e),p(A)]},{prefix:u((()=>[i(p(C),{component:p(j)},null,8,["component"])])),_:1},8,["value","onUpdate:value"])])),default:u((()=>{var o;return[e("div",{class:"list-wrapper",ref_key:"listRef",ref:I},[(r(!0),c(d,null,m(T.value,(o=>(r(),c("div",{class:"item",key:o.promptId,onClick:()=>function(e){L("update:show",!1),H.selectedPrompt=e,H.sendContent=e.promptContent}(o)},[e("p",null,v(o.promptTitle),1),e("p",null,v(o.promptContent),1)],8,S)))),128)),h(e("div",null,(null==(o=window.getLanguageByCode)?void 0:o.call(window,"10010.1.81"))||"找不到相关的结果",512),[[f,p($)]])],512)]})),_:1})])),_:1},8,["to","show"]))}});export{U as default};
1
+ import{createElementVNode as e,defineComponent as o,ref as t,computed as a,watch as s,openBlock as l,createBlock as n,unref as r,withCtx as u,createVNode as p,createElementBlock as i,Fragment as c,renderList as d,toDisplayString as m,withDirectives as v,vShow as h}from"vue";import{NDrawer as f,NDrawerContent as w,NButton as g,NIcon as k,NInput as C}from"naive-ui";import{CloseOutline as y,SearchOutline as _}from"@vicons/ionicons5";import{isFunction as j}from"lodash-es";import"../../../../shared/utils/index.js";import{useDebounceFn as x}from"@vueuse/core";import"date-fns";import"@vue/shared";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import{useScrollLoading as M}from"../../../../shared/hooks/useScrollLoading.js";import{useData as b}from"../hooks/useData.js";import"../utils/index.js";var B;const L={class:"title"},P=e("span",null,(null==(B=window.getLanguageByCode)?void 0:B.call(window,"10010.1.206"))||"发现提示词",-1),R=["onClick"];var S=o({__name:"ChatPrompt",props:{show:{type:Boolean}},emits:["update:show"],setup(o,{emit:B}){const S=o,U={page:0,hasMore:!0},{state:q,queryPrompt:z}=b(),D=t(),H=t(""),I=t([]),O=a((()=>!I.value.length&&!!(H.value||"").replace(/^\s+|\s+$/g,""))),T=x(A,500);async function $(){try{if(!U.hasMore||!j(z.value))return;U.page++,1==U.page&&(I.value=[]);const e=await z.value({keyword:H.value,page:U.page});I.value.length<=+e.records&&(I.value=U.page>1?I.value.concat(e.rows):e.rows,I.value.length>=+e.records&&(U.hasMore=!1))}catch(e){}}function A(){Object.assign(U,{page:0,hasMore:!0}),$()}return M(D,(()=>{$()})),s((()=>S.show),(e=>{e&&(H.value="",A())})),(t,a)=>(l(),n(r(f),{placement:"bottom",height:"70%","trap-focus":!1,to:"#"+r(q).id,show:o.show,"content-class":"prompt-wrapper",onMaskClick:a[2]||(a[2]=()=>B("update:show",!1))},{default:u((()=>[p(r(w),null,{header:u((()=>[e("div",L,[P,p(r(g),{text:"",onClick:a[0]||(a[0]=()=>B("update:show",!1))},{default:u((()=>[p(r(k),{size:"20",component:r(y)},null,8,["component"])])),_:1})]),p(r(C),{ref:"inputRef",clearable:"",autofocus:"",value:H.value,"onUpdate:value":[a[1]||(a[1]=e=>H.value=e),r(T)]},{prefix:u((()=>[p(r(k),{component:r(_)},null,8,["component"])])),_:1},8,["value","onUpdate:value"])])),default:u((()=>{var o;return[e("div",{class:"list-wrapper",ref_key:"listRef",ref:D},[(l(!0),i(c,null,d(I.value,(o=>(l(),i("div",{class:"item",key:o.promptId,onClick:()=>function(e){B("update:show",!1),q.selectedPrompt=e,q.sendContent=e.promptContent}(o)},[e("p",null,m(o.promptTitle),1),e("p",null,m(o.promptContent),1)],8,R)))),128)),v(e("div",null,(null==(o=window.getLanguageByCode)?void 0:o.call(window,"10010.1.81"))||"找不到相关的结果",512),[[h,r(O)]])],512)]})),_:1})])),_:1},8,["to","show"]))}});export{S as default};
@@ -4,13 +4,15 @@ declare const _default: import("vue").DefineComponent<{}, {
4
4
  key: string;
5
5
  title: string;
6
6
  }[];
7
- state: any;
8
- patientInfo: any;
7
+ state: AnyObject;
8
+ patientInfo: import("vue").Ref<any>;
9
+ sendMessage: (params?: AnyObject) => Promise<void>;
9
10
  toolbarConfig: {
10
11
  toolbarKeys: never[];
11
12
  };
12
13
  content: import("vue").Ref<string>;
13
14
  handleSave: () => Promise<void>;
15
+ handleDelete: () => Promise<void>;
14
16
  createMedicalRecord: () => void;
15
17
  extractContentByTitle: () => AnyObject;
16
18
  NSpace: any;
@@ -1 +1 @@
1
- import{defineComponent as t,inject as e,reactive as n,ref as o,watch as l,withDirectives as i,openBlock as s,createElementBlock as a,createVNode as c,unref as r,withCtx as u,createTextVNode as y,vShow as d}from"vue";import{NSpace as p,NButton as f}from"naive-ui";import{InjectionAIChat as k}from"../types/index.js";import{$message as g}from"../utils/index.js";import _ from"../../../editor/index.js";import{saveApi as m}from"../api/index.js";const v={class:"ai-chat-right"};var j=t({__name:"ChatRight",setup(t){const j=[{key:"zs_yy",title:"主诉"},{key:"xbs_fuk",title:"现病史"},{key:"jws_vtk",title:"既往史"},{key:"patient_allergy_sync",title:"过敏史"},{key:"tgjcms_wsssss",title:"体格检查描述"},{key:"marriage",title:"婚姻状况"},{key:"nation",title:"民族"},{key:"profession",title:"职业"},{key:"jkzk_wyuu",title:"一般健康状况"},{key:"ryljlz_tbyvrt",title:"外长期居住史"},{key:"yjbz_qisf1",title:"饮酒标志"},{key:"gydwufcjfsxwzjcs_aogt_oietyntrrqk",title:"工业毒物、粉尘及放射性物质接触史"},{key:"yqtysjcs_ua_uirqk",title:"疫区、疫水接触史"},{key:"ryct_tbsw",title:"入院查体"},{key:"fzjclg_lessxj",title:"辅助检查结果"},{key:"o_hn_iyjc_hr",title:"互认回填"},{key:"cbzd_phyo",title:"初步诊断"},{key:"zljh_yuya",title:"诊疗计划"},{key:"wdcqjzs_qftanwk",title:"外地长期居住史"}],{state:h,patientInfo:w}=e(k),b=n({toolbarKeys:[]}),x=o("");async function C(){var t;try{const e=q();h.consultationContent.contents[0].content.details.autoBackFillData=e,await m({msgId:h.consultationContent.msgId,contents:h.consultationContent.contents,configs:null==(t=w.value)?void 0:t.info}),g.success("保存成功")}catch(t){console.log("error ==>",t)}}function z(){const t=q();console.log("json ==>",t,h.consultationContent),h.consultationContent.contents[0].content.details.autoBackFillData=t,h.params={opType:"create_medical",...h.consultationContent,contents:[{role:"user",content:"",contentType:"text"}],medicalInfo:h.consultationContent},h.sending=!0,h.loading=!0,h.loadingText="系统进入深度分析模式,正在整合数据,调取主诉,获取现病史、既往病史,读取过敏史,综合多维度信息生成诊断建议"}function q(){const t={};return j.forEach((e=>{const n=new RegExp(`<p><span.*?><strong>\\d+、${e.title}<\\/strong><\\/span><\\/p><p>(.*?)<\\/p>`,"i"),o=x.value.match(n);if(o&&o[1]){const n=o[1].trim();t[e.key]="<br>"===n?"":n}})),t}return l((()=>h.showRight),(t=>{var e,n,o,l;if(t){const{autoBackFillData:t}=(null==(l=null==(o=null==(n=null==(e=h.consultationContent)?void 0:e.contents)?void 0:n[0])?void 0:o.content)?void 0:l.details)||{};if(x.value="",!t)return;j.forEach(((e,n)=>{x.value+=`<p><span style="font-size: 16px;"><strong>${n+1}、${e.title}</strong></span></p><p><span>${t[e.key]||""}</span></p><p>${n<j.length-1?"<br>":""}`}))}else h.consultationContent=null})),(t,e)=>i((s(),a("div",v,[c(r(_),{"toolbar-config":b,modelValue:x.value,"onUpdate:modelValue":e[0]||(e[0]=t=>x.value=t)},null,8,["toolbar-config","modelValue"]),c(r(p),{class:"footer","wrap-item":!1},{default:u((()=>[c(r(f),{round:"",class:"gradient",disabled:r(h).loading,onClick:z},{default:u((()=>[y("审核完成")])),_:1},8,["disabled"]),c(r(f),{round:"",onClick:C},{default:u((()=>[y("暂存")])),_:1})])),_:1})],512)),[[d,r(h).showRight]])}});export{j as default};
1
+ import{defineComponent as t,reactive as e,ref as n,watch as o,withDirectives as l,openBlock as s,createElementBlock as a,createVNode as i,unref as c,withCtx as r,createTextVNode as u,vShow as d}from"vue";import{NSpace as y,NButton as g}from"naive-ui";import{$message as f}from"../utils/index.js";import p from"../../../editor/index.js";import{saveApi as k,deleteApi as m}from"../api/index.js";import{useData as _}from"../hooks/useData.js";import{remove as h}from"lodash-es";const w={class:"ai-chat-right"};var v=t({__name:"ChatRight",setup(t){const v=[{key:"zs_yy",title:"主诉"},{key:"xbs_fuk",title:"现病史"},{key:"jws_vtk",title:"既往史"},{key:"patient_allergy_sync",title:"过敏史"},{key:"tgjcms_wsssss",title:"体格检查描述"},{key:"marriage",title:"婚姻状况"},{key:"nation",title:"民族"},{key:"profession",title:"职业"},{key:"jkzk_wyuu",title:"一般健康状况"},{key:"ryljlz_tbyvrt",title:"外长期居住史"},{key:"yjbz_qisf1",title:"饮酒标志"},{key:"gydwufcjfsxwzjcs_aogt_oietyntrrqk",title:"工业毒物、粉尘及放射性物质接触史"},{key:"yqtysjcs_ua_uirqk",title:"疫区、疫水接触史"},{key:"ryct_tbsw",title:"入院查体"},{key:"fzjclg_lessxj",title:"辅助检查结果"},{key:"o_hn_iyjc_hr",title:"互认回填"},{key:"cbzd_phyo",title:"初步诊断"},{key:"zljh_yuya",title:"诊疗计划"},{key:"wdcqjzs_qftanwk",title:"外地长期居住史"}],{state:j,patientInfo:C,sendMessage:b}=_(),x=e({toolbarKeys:[]}),z=n("");async function I(){var t;try{const e=B();j.consultationContent.contents[0].content.details.autoBackFillData=e,await k({msgId:j.consultationContent.msgId,contents:j.consultationContent.contents,configs:null==(t=C.value)?void 0:t.info}),f.success("保存成功")}catch(t){console.log("error ==>",t)}}async function q(){var t;try{await m({messageId:j.consultationContent.msgId}),h(j.record,(t=>t.msgId===j.consultationContent.msgId)),j.showRight=!1,f.success((null==(t=window.getLanguageByCode)?void 0:t.call(window,"10010.1.411"))||"删除成功")}catch(t){console.log("error ==>",t)}}function R(){const t=B();console.log("json ==>",t,j.consultationContent),j.consultationContent.contents[0].content.details.autoBackFillData=t,j.loadingText="系统进入深度分析模式,正在整合数据,调取主诉,获取现病史、既往病史,读取过敏史,综合多维度信息生成诊断建议",b({opType:"create_medical",...j.consultationContent,contents:[{role:"user",content:"",contentType:"text"}],medicalInfo:j.consultationContent})}function B(){const t={};return v.forEach((e=>{const n=new RegExp(`<p><span.*?><strong>\\d+、${e.title}<\\/strong><\\/span><\\/p><p>(.*?)<\\/p>`,"i"),o=z.value.match(n);if(o&&o[1]){const n=o[1].trim();t[e.key]="<br>"===n?"":n}})),t}return o((()=>j.showRight),(t=>{var e,n,o,l;if(t){j.showRightSlot=!1;const{autoBackFillData:t}=(null==(l=null==(o=null==(n=null==(e=j.consultationContent)?void 0:e.contents)?void 0:n[0])?void 0:o.content)?void 0:l.details)||{};if(z.value="",!t)return;v.forEach(((e,n)=>{z.value+=`<p><span style="font-size: 16px;"><strong>${n+1}、${e.title}</strong></span></p><p><span>${t[e.key]||""}</span></p><p>${n<v.length-1?"<br>":""}`}))}else j.consultationContent=null})),(t,e)=>l((s(),a("div",w,[i(c(p),{"toolbar-config":x,modelValue:z.value,"onUpdate:modelValue":e[0]||(e[0]=t=>z.value=t)},null,8,["toolbar-config","modelValue"]),i(c(y),{class:"footer","wrap-item":!1},{default:r((()=>[i(c(g),{round:"",class:"gradient",disabled:c(j).loading,onClick:R},{default:r((()=>[u("审核完成")])),_:1},8,["disabled"]),i(c(g),{round:"",onClick:I},{default:r((()=>[u("暂存")])),_:1}),i(c(g),{round:"",onClick:q,style:{"margin-left":"auto"}},{default:r((()=>{var t;return[u((null==(t=window.getLanguageByCode)?void 0:t.call(window,"10010.1.215"))||"删除")]})),_:1})])),_:1})],512)),[[d,c(j).showRight]])}});export{v as default};
@@ -1 +1 @@
1
- import{defineComponent as e,inject as a,ref as i,computed as s,createVNode as l,resolveComponent as n,createTextVNode as t}from"vue";import{NSpace as o,NIcon as d,NImage as c,NButton as r}from"naive-ui";import m from"../../../../../shared/assets/img/file.png.js";import u from"../../../../../shared/assets/img/file-emr.png.js";import p from"../../../../../shared/assets/img/use.png.js";import{CheckmarkCircle as v}from"@vicons/ionicons5";import g from"./SelectIcon.js";import{InjectionAIChatEmits as f,InjectionAIChat as y}from"../../types/index.js";import{isArray as h,isString as b}from"lodash-es";var _=e({name:"ChatJsonCard",inheritAttrs:!1,props:{item:{type:Object,default:()=>({})},messageItem:{type:Object,default:()=>({})}},components:{NSpace:o,NIcon:d,NImage:c,SelectIcon:g},emits:[],setup(e,{attrs:o,slots:d,emit:c}){const g=a(f),{state:_,patientInfo:x}=a(y),{messageType:k,content:C}=e.messageItem,I=i([]),T=i([]),j=s((()=>{var e,a;return(null==(a=null==(e=x.value)?void 0:e.info)?void 0:a.vac01)||"1878974046080958465"})),N=s((()=>null==C?void 0:C.diagnosis)),w=s((()=>{var e;return"diagnosis_added"===k&&(null==(e=N.value)?void 0:e.length)})),S=s((()=>w.value||"medical_added"===k)),E=s((()=>"diagnosis"===k||"diagnosis_added"===k||"treatment_plan"===k));var q,D;"diagnosis_added"===k&&(I.value=null==(D=null==(q=C.recommendedExaminations)?void 0:q.map)?void 0:D.call(q,(e=>e.name)));const O=(e,a="name")=>{T.value.includes(e[a])?T.value=T.value.filter((i=>i!==e[a])):T.value.push(e[a])};function A(a,i){var s,l;null==(s=null==a?void 0:a.preventDefault)||s.call(a),null==(l=null==a?void 0:a.stopPropagation)||l.call(a);let n=i?[i]:[];arguments.length||(n=C.possibleConditions.filter((e=>T.value.includes(e.code)))),n.length&&(_.params={...e.item,opType:"diagnosis",contents:[{role:"user",content:"",contentType:"text"}],possibleConditions:n},_.sending=!0,_.loading=!0,_.loadingText="依据当前诊断与病历内容分析,正在筛为您筛选和匹配最适合的检验检查项目")}async function J(a,i){var s,l;if(b(a)||(null==(s=null==a?void 0:a.preventDefault)||s.call(a),null==(l=null==a?void 0:a.stopPropagation)||l.call(a)),"edit"===a){const e=i?I.value.includes(i.name)?[i.name]:[]:[...I.value];g("program",{key:"medical_order",params:{bbx05List:JSON.stringify(e),vac01:j.value,type:3}})}else{let a=i?[i]:[];i||(a=C.recommendedExaminations.filter((e=>I.value.includes(e.name)))),_.params={...e.item,opType:"medical_order",contents:[{role:"user",content:"",contentType:"text"}],recommendedExaminations:a},_.sending=!0,_.loading=!0}}const P=async()=>{var e;const a=(null==(e=C.reports)?void 0:e[0])||{};g("program",{key:"report",params:{vaa07:j.value,reportType:a.reportType,reportId:a.reportId}})},L=async(e,a)=>{var i,s;null==(i=null==e?void 0:e.preventDefault)||i.call(e),null==(s=null==e?void 0:e.stopPropagation)||s.call(e);const l=a?[a.name]:T.value;g("program",{key:"recommend_treatment_plan",params:{drugNameList:JSON.stringify(l),vac01:j.value,type:3}})},z=e=>{if(!("diagnosis_added"===k?!I.value.length:!T.value.length))return"diagnosis"===k?A():"diagnosis_added"===k?J(e):"treatment_plan"===k?L():void 0};async function H(){"medical"===k?(async()=>{var e,a;g("program",{key:"medical",params:{vac01:null==(a=null==(e=x.value)?void 0:e.info)?void 0:a.vac01,type:1}})})():(_.consultationContent=e.item,_.showRight=!0)}const R=()=>l("div",{class:"diagnosis-added-box"},[l("div",{class:"recommended-wrap"},[l("div",{class:"title"},[t("检验检查推荐")]),C.recommendedExaminations.map((e=>l("div",{class:"recommended-item"},[l("div",{class:"top"},[l("div",{class:"left-tag"},[l("span",{class:["recommended-tag",{active:I.value.includes(e.name)}],onClick:()=>(e=>{I.value.includes(e.name)?I.value=I.value.filter((a=>a!==e.name)):I.value.push(e.name)})(e)},[e.name,l(n("select-icon"),{class:"select-icon",width:16},null)])]),l("img",{class:"right-icon",src:p,onClick:a=>J(a,e)},null)]),l("div",{class:"desc"},[e.description])])))])]);const W=()=>{if(!S.value)return null;return("medical_added"===k?[{}]:N.value).map((e=>l("div",{class:"card-header"},[l("span",{class:"left-title"},[l(n("n-icon"),{component:v},null),"medical_added"===k?"已完成申请单开立":`已添加诊断:${e.name}`]),"medical_added"===k?null:l("span",{class:"right-desc"},[t("创建时间: "),e.createdTime])])))},$=()=>{if(!E.value)return null;const e="diagnosis_added"===k?!I.value.length:!T.value.length;return l("div",{class:"card-footer"},[l("span",{class:"left-desc"},[t("请注意,推荐信息由AI生成,结果仅供临床参考")]),l("div",{class:"right-btns"},[l(r,{size:"large",disabled:e,onClick:()=>z("edit")},{default:()=>[t("编辑所选")]}),l("span",{class:["right-btn",{disabled:e}],onClick:()=>z()},[t("引用所选")])])])},B=()=>"inquiry"==k||"medical"==k?(()=>{var e,a;const i="inquiry"===k;return l("div",{class:"inquiry_medical-box",onClick:()=>H()},[l("div",{class:"left-img"},[l("img",{src:i?m:u},null)]),l("div",{class:"right-text"},[l("p",{class:"top-info"},[i?null==(e=C.summary)?void 0:e.inquiryStr:C.info]),l("p",{class:"sum-time"},[t("创建时间:"),(null==(a=C.summary)?void 0:a.creationTime)||C.creationTime])])])})():"diagnosis"==k?l("div",{class:"diagnosis-box"},[l("div",{class:"title"},[t("诊断辅助")]),l("div",{class:"desc"},[C.patientHistory]),C.possibleConditions.map((e=>l("div",{class:["con-item",{active:T.value.includes(e.code)}],onClick:()=>O(e,"code")},[l("div",{class:"top-content"},[l("div",{class:"left_wrap"},[l("a",{href:e.link,target:"_blank"},[t("【"),e.condition,t("】")]),e.code,t("("),e.probability,t(")")]),l("img",{class:"right-icon",src:p,onClick:a=>A(a,e)},null)]),l("div",{class:"btm-desc"},[e.description])])))]):"diagnosis_added"==k?R():"treatment_plan"==k?l("div",{class:"treatment-plan-box"},[l("div",{class:"top-div"},[l("div",{class:"title"},[C.title])]),l("div",{class:"desc"},[C.description]),l("div",{class:"medication-wrap"},[l("div",{class:"title"},[t("药物")]),C.medications.map((e=>l("div",{class:["medication-item",{active:T.value.includes(e.name)}],onClick:()=>O(e)},[l("div",{class:"top"},[l("div",{class:"name"},[e.name]),l("img",{class:"right-icon",src:p,onClick:a=>L(a,e)},null)]),l("ul",null,[l("li",null,[t("用量: "),e.dosage,e.purpose]),l("li",null,[t("用法: "),e.usageInstructions])])])))]),l("div",{class:"precaution-wrap"},[l("div",{class:"title"},[t("注意事项")]),l("div",{class:"precaution-div"},[C.precautions.map(((e,a)=>l("div",{class:"treatment-item"},[a+1,t(". "),e])))])])]):"report_message"==k?(()=>{var e,a;const i=(null==(e=C.reports)?void 0:e[0])||{},s=(null==(a=i.reportInterpretation)?void 0:a.replace(/\\n|\n|\r/g,"<br>").split("<br>"))||[""],o=s.map(((e,a)=>[e,a===s.length-1?null:l("br",null,null)]));return l("div",{class:"report-message-box"},[l("div",{class:"top-title"},[l("div",{class:"left-title"},[l(n("n-icon"),{component:v},null),i.reportName]),l("div",{class:"right-detail"},[l(r,{text:!0,onClick:P},{default:()=>[t("报告详情")]}),l(r,{text:!0},{default:()=>[t("推荐方案")]})])]),l("div",{class:"center-img"},[i.images.map((e=>"pdf"===e.imageType?l("embed",{class:"pdf-embed",src:e.image,type:"application/pdf"},null):l(n("n-image"),{src:e.image},null)))]),l("div",{class:"bottom-interpretation"},[o,l("div",{class:"desc-tip"},[t("请注意,辅助诊断由AI推荐,结果仅供临床参考。")])])])})():"medical_added"==k?function(){if(!h(C))return null;const e=C.map((e=>{const{itemName:a,sample:i,execDeptName:s}=e||{};let n="";a&&(n+=a);const t=()=>!n||n.endsWith("/")?"":"/";return i&&(n+=t()+i),s&&(n+=t()+s),l("div",{class:"item"},[l("span",null,[n]),l("span",{class:"time"},[e.beginExecTime])])}));return l("div",{class:"medical-added-box"},[e])}():"默认json内容";return()=>l("section",{class:"json-card_section"},[W(),l("div",{class:"card-content"},[B()]),$()])}});export{_ as default};
1
+ import{defineComponent as e,ref as a,computed as l,createVNode as i,resolveComponent as s,createTextVNode as t}from"vue";import{NSpace as n,NIcon as d,NImage as o,NButton as c}from"naive-ui";import r from"../../../../../shared/assets/img/file.png.js";import m from"../../../../../shared/assets/img/file-emr.png.js";import u from"../../../../../shared/assets/img/use.png.js";import{CheckmarkCircle as p}from"@vicons/ionicons5";import v from"./SelectIcon.js";import{isArray as g,isString as f}from"lodash-es";import{useData as y}from"../../hooks/useData.js";import"../../utils/index.js";var h=e({name:"ChatJsonCard",inheritAttrs:!1,props:{item:{type:Object,default:()=>({})},messageItem:{type:Object,default:()=>({})}},components:{NSpace:n,NIcon:d,NImage:o,SelectIcon:v},emits:[],setup(e,{attrs:n,slots:d,emit:o}){const{state:v,patientInfo:h,emit:_,sendMessage:b}=y(),{messageType:x,content:k}=e.messageItem,C=a([]),I=a([]),T=l((()=>{var e,a;return(null==(a=null==(e=h.value)?void 0:e.info)?void 0:a.vac01)||"1878974046080958465"})),j=l((()=>null==k?void 0:k.diagnosis)),w=l((()=>{var e;return"diagnosis_added"===x&&(null==(e=j.value)?void 0:e.length)})),N=l((()=>w.value||"medical_added"===x)),S=l((()=>x&&["diagnosis","diagnosis_added","treatment_plan"].includes(x))),D=l((()=>"diagnosis_added"===x?k.recommendedExaminations.filter((e=>"outer"!==e.type)):"treatment_plan"===x?k.medications.filter((e=>"outer"!==e.type)):[])),q=l((()=>{var e,a;return"diagnosis_added"===x?null==(a=null==(e=k.recommendedExaminations)?void 0:e.filter)?void 0:a.call(e,(e=>"outer"===e.type)):"treatment_plan"===x?k.medications.filter((e=>"outer"===e.type)):[]}));var E,O;"diagnosis_added"===x&&(C.value=null==(O=null==(E=D.value)?void 0:E.map)?void 0:O.call(E,(e=>e.name)));const A=(e,a="name")=>{I.value.includes(e[a])?I.value=I.value.filter((l=>l!==e[a])):I.value.push(e[a])};function J(a,l){var i,s;null==(i=null==a?void 0:a.preventDefault)||i.call(a),null==(s=null==a?void 0:a.stopPropagation)||s.call(a);let t=l?[l]:[];arguments.length||(t=k.possibleConditions.filter((e=>I.value.includes(e.code)))),t.length&&(v.loadingText="依据当前诊断与病历内容分析,正在筛为您筛选和匹配最适合的检验检查项目",b({...e.item,opType:"diagnosis",contents:[{role:"user",content:"",contentType:"text"}],possibleConditions:t}))}async function P(a,l){var i,s;if(f(a)||(null==(i=null==a?void 0:a.preventDefault)||i.call(a),null==(s=null==a?void 0:a.stopPropagation)||s.call(a)),"edit"===a){const e=l?C.value.includes(l.name)?[l.name]:[]:[...C.value];_("program",{key:"medical_order",params:{bbx05List:JSON.stringify(e),vac01:T.value,type:3}})}else{let a=l?[l]:[];l||(a=D.value.filter((e=>C.value.includes(e.name)))),b({...e.item,opType:"medical_order",contents:[{role:"user",content:"",contentType:"text"}],recommendedExaminations:a})}}const L=async()=>{var e;const a=(null==(e=k.reports)?void 0:e[0])||{};_("program",{key:"report",params:{vaa07:T.value,reportType:a.reportType,reportId:a.reportId}})},z=async(e,a)=>{var l,i;null==(l=null==e?void 0:e.preventDefault)||l.call(e),null==(i=null==e?void 0:e.stopPropagation)||i.call(e);const s=a?[a.name]:I.value;_("program",{key:"recommend_treatment_plan",params:{drugNameList:JSON.stringify(s),vac01:T.value,type:3}})},H=e=>{if(!("diagnosis_added"===x?!C.value.length:!I.value.length))return"diagnosis"===x?J():"diagnosis_added"===x?P(e):"treatment_plan"===x?z():void 0};const M=()=>{var a,l;const s="inquiry"===x;return i("div",{class:"inquiry_medical-box",onClick:()=>async function(){var a,l;"medical"===x?_("program",{key:"medical",params:{vac01:null==(l=null==(a=h.value)?void 0:a.info)?void 0:l.vac01,type:1}}):(v.consultationContent=e.item,v.showRight=!0)}()},[i("div",{class:"left-img"},[i("img",{src:s?r:m},null)]),i("div",{class:"right-text"},[i("p",{class:"top-info"},[s?null==(a=k.summary)?void 0:a.inquiryStr:k.info]),i("p",{class:"sum-time"},[t("创建时间:"),(null==(l=k.summary)?void 0:l.creationTime)||k.creationTime])])])},R=()=>i("div",{class:"diagnosis-added-box"},[i("div",{class:"recommended-wrap"},[i("div",{class:"title"},[t("检验检查推荐")]),D.value.map((e=>i("div",{class:"recommended-item"},[i("div",{class:"top"},[i("div",{class:"left-tag"},[i("span",{class:["recommended-tag",{active:C.value.includes(e.name)}],onClick:()=>(e=>{C.value.includes(e.name)?C.value=C.value.filter((a=>a!==e.name)):C.value.push(e.name)})(e)},[e.name,i(s("select-icon"),{class:"select-icon",width:16},null)])]),i("img",{class:"right-icon",src:u,onClick:a=>P(a,e)},null)]),i("div",{class:"desc"},[e.description])])))]),q.value.length?i("div",{class:"recommended-wrap outer-wrap"},[i("div",{class:"title"},[t("其他检验检查推荐")]),q.value.map((e=>i("div",{class:"recommended-item"},[i("div",{class:"top"},[i("div",{class:"left-tag"},[i("span",{class:"recommended-tag"},[e.name])])]),i("div",{class:"desc"},[e.description])])))]):null]);const W=()=>{if(!N.value)return null;return("medical_added"===x?[{}]:j.value).map((e=>i("div",{class:"card-header"},[i("span",{class:"left-title"},[i(s("n-icon"),{component:p},null),"medical_added"===x?"已完成申请单开立":`已添加诊断:${e.name}`]),"medical_added"===x?null:i("span",{class:"right-desc"},[t("创建时间: "),e.createdTime])])))},$=()=>{if(!S.value)return null;const e="diagnosis_added"===x?!C.value.length:!I.value.length;return i("div",{class:"card-footer"},[i("span",{class:"left-desc"},[t("请注意,推荐信息由AI生成,结果仅供临床参考")]),i("div",{class:"right-btns"},[x&&["diagnosis_added","treatment_plan"].includes(x)?i(c,{size:"large",disabled:e,onClick:()=>H("edit")},{default:()=>[t("编辑所选")]}):null,i("span",{class:["right-btn",{disabled:e}],onClick:()=>H()},[t("引用所选")])])])},B=()=>"inquiry"==x||"medical"==x?M():"diagnosis"==x?i("div",{class:"diagnosis-box"},[i("div",{class:"title"},[t("诊断辅助")]),i("div",{class:"desc"},[k.patientHistory]),k.possibleConditions.map((e=>i("div",{class:["con-item",{active:I.value.includes(e.code)}],onClick:()=>A(e,"code")},[i("div",{class:"top-content"},[i("div",{class:"left_wrap"},[i("a",{href:e.link,target:"_blank"},[t("【"),e.condition,t("】")]),e.code,t("("),e.probability,t(")")]),i("img",{class:"right-icon",src:u,onClick:a=>J(a,e)},null)]),i("div",{class:"btm-desc"},[e.description])])))]):"diagnosis_added"==x?R():"treatment_plan"==x?i("div",{class:"treatment-plan-box"},[i("div",{class:"top-div"},[i("div",{class:"title"},[k.title])]),i("div",{class:"desc"},[k.description]),i("div",{class:"medication-wrap"},[i("div",{class:"title"},[t("药物")]),D.value.map((e=>i("div",{class:["medication-item",{active:I.value.includes(e.name)}],onClick:()=>A(e)},[i("div",{class:"top"},[i("div",{class:"name"},[e.name]),i("img",{class:"right-icon",src:u,onClick:a=>z(a,e)},null)]),i("ul",null,[i("li",null,[t("用量: "),e.dosage,e.purpose]),i("li",null,[t("用法: "),e.usageInstructions])])])))]),i("div",{class:"precaution-wrap"},[i("div",{class:"title"},[t("注意事项")]),i("div",{class:"precaution-div"},[k.precautions.map(((e,a)=>i("div",{class:"treatment-item"},[a+1,t(". "),e])))])]),q.value.length?i("div",{class:"medication-wrap"},[i("div",{class:"title"},[t("其他治疗方案推荐")]),q.value.map((e=>i("div",{class:"medication-item outer-item"},[i("div",{class:"top"},[i("div",{class:"name"},[e.name])]),i("ul",null,[i("li",null,[t("用量: "),e.dosage,e.purpose]),i("li",null,[t("用法: "),e.usageInstructions])])])))]):null]):"report_message"==x?(()=>{var e,a;const l=(null==(e=k.reports)?void 0:e[0])||{},n=(null==(a=l.reportInterpretation)?void 0:a.replace(/\\n|\n|\r/g,"<br>").split("<br>"))||[""],d=n.map(((e,a)=>[e,a===n.length-1?null:i("br",null,null)]));return i("div",{class:"report-message-box"},[i("div",{class:"top-title"},[i("div",{class:"left-title"},[i(s("n-icon"),{component:p},null),l.reportName]),i("div",{class:"right-detail"},[i(c,{text:!0,onClick:L},{default:()=>[t("报告详情")]}),i(c,{text:!0},{default:()=>[t("推荐方案")]})])]),i("div",{class:"center-img"},[l.images.map((e=>"pdf"===e.imageType?i("embed",{class:"pdf-embed",src:e.image,type:"application/pdf"},null):i(s("n-image"),{src:e.image},null)))]),i("div",{class:"bottom-interpretation"},[d,i("div",{class:"desc-tip"},[t("请注意,辅助诊断由AI推荐,结果仅供临床参考。")])])])})():"medical_added"==x?function(){if(!g(k))return null;const e=k.map((e=>{const{itemName:a,sample:l,execDeptName:s}=e||{};let t="";a&&(t+=a);const n=()=>!t||t.endsWith("/")?"":"/";return l&&(t+=n()+l),s&&(t+=n()+s),i("div",{class:"item"},[i("span",null,[t]),i("span",{class:"time"},[e.beginExecTime])])}));return i("div",{class:"medical-added-box"},[e])}():"默认json内容";return()=>i("section",{class:"json-card_section"},[W(),i("div",{class:"card-content"},[B()]),$()])}});export{h as default};
@@ -0,0 +1,2 @@
1
+ export * from './useData';
2
+ export * from './useWebsocket';
@@ -0,0 +1 @@
1
+ export{InjectionAIChatData,initData,useData}from"./useData.js";export{useWebsocket}from"./useWebsocket.js";
@@ -0,0 +1,47 @@
1
+ import { InjectionKey, Ref } from 'vue';
2
+ import { AnyObject } from '../../../../shared/types';
3
+ export declare const InjectionAIChatData: InjectionKey<ReturnType<typeof initData>>;
4
+ export declare function initData(props: AnyObject, emit: (event: 'button-click' | 'program', ...args: any[]) => void): {
5
+ patientInfo: Ref<any>;
6
+ queryPrompt: Ref<any>;
7
+ queryData: Ref<any>;
8
+ queryRecord: Ref<any>;
9
+ defaultShortcutList: Ref<any>;
10
+ hideInput: Ref<any>;
11
+ shortcutList: Ref<any>;
12
+ audioTimed: Ref<any>;
13
+ commandList: Ref<any>;
14
+ appId: Ref<any>;
15
+ immediatelyRecording: Ref<any>;
16
+ cssVars: import("vue").ComputedRef<AnyObject>;
17
+ state: AnyObject;
18
+ isSmall: import("vue").ComputedRef<boolean>;
19
+ isDefault: import("vue").ComputedRef<boolean>;
20
+ vaa07: import("vue").ComputedRef<any>;
21
+ axiosInstance: import("axios").AxiosInstance;
22
+ emit: (event: 'button-click' | 'program', ...args: any[]) => void;
23
+ appendMessage: (item: AnyObject) => Promise<void>;
24
+ sendMessage: (params?: AnyObject) => Promise<void>;
25
+ };
26
+ export declare const useData: () => {
27
+ patientInfo: Ref<any>;
28
+ queryPrompt: Ref<any>;
29
+ queryData: Ref<any>;
30
+ queryRecord: Ref<any>;
31
+ defaultShortcutList: Ref<any>;
32
+ hideInput: Ref<any>;
33
+ shortcutList: Ref<any>;
34
+ audioTimed: Ref<any>;
35
+ commandList: Ref<any>;
36
+ appId: Ref<any>;
37
+ immediatelyRecording: Ref<any>;
38
+ cssVars: import("vue").ComputedRef<AnyObject>;
39
+ state: AnyObject;
40
+ isSmall: import("vue").ComputedRef<boolean>;
41
+ isDefault: import("vue").ComputedRef<boolean>;
42
+ vaa07: import("vue").ComputedRef<any>;
43
+ axiosInstance: import("axios").AxiosInstance;
44
+ emit: (event: 'button-click' | 'program', ...args: any[]) => void;
45
+ appendMessage: (item: AnyObject) => Promise<void>;
46
+ sendMessage: (params?: AnyObject) => Promise<void>;
47
+ };
@@ -0,0 +1 @@
1
+ import{ref as e,reactive as t,computed as n,toRef as o,inject as i,nextTick as s}from"vue";import{useTheme as a}from"../../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import{isArray as r,cloneDeep as l}from"lodash-es";import"@vue/shared";import{uuidGenerator as c}from"../../../../shared/utils/index.js";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import"naive-ui";import"../../../../shared/hooks/useScrollLoading.js";import{axiosInstance as d,conversationApi as u}from"../api/index.js";const m=Symbol("InjectionAIChatData");function p(i,m){d.defaults.headers.Authorization="bearer "+i.token;const p=e(),h=t({id:"ai-chat-"+c(),loading:!1,sending:!1,sendContent:"",selectedCommand:null,selectedPrompt:null,externalData:null,selectedPatient:null,selectedPatientLabel:"",selectedPatientForm:null,showPatient:!1,showRight:!1,showRightSlot:!1,switchFlag:!0,record:[]}),f=a(),v=n((()=>"small"===i.uiStyle)),g=n((()=>"default"===i.uiStyle)),y=n((()=>{var e,t;return null==(t=null==(e=i.patientInfo)?void 0:e.info)?void 0:t.vaa07}));async function I(e){var t;r(e.contents)&&(h.record.unshift(e),await s(),null==(t=p.value)||t.scrollTo({top:0,behavior:"auto"}))}return{patientInfo:o(i,"patientInfo"),queryPrompt:o(i,"queryPrompt"),queryData:o(i,"queryData"),queryRecord:o(i,"queryRecord"),defaultShortcutList:o(i,"defaultShortcutList"),hideInput:o(i,"hideInput"),shortcutList:o(i,"shortcutList"),audioTimed:o(i,"audioTimed"),commandList:o(i,"commandList"),appId:o(i,"appId"),immediatelyRecording:o(i,"immediatelyRecording"),cssVars:f,state:h,isSmall:v,isDefault:g,vaa07:y,axiosInstance:d,emit:m,appendMessage:I,sendMessage:async function(e={}){var t,n,o,s,a,d,f,v,g,y;h.loading=!0;const{opType:_}=e,w={...e};if(!_&&h.sendContent&&h.record.unshift({msgId:c(),contents:[{role:"user",content:h.sendContent}]}),null==(t=p.value)||t.scrollTo({top:0,behavior:"auto"}),_&&["recommend_treatment_plan","recommend_diagnosis","recommend_examination"].includes(_)){if(h.record.length>0){const e=h.record.find((e=>{var t;return!function({role:e=""}){return"user"===e}(null==(t=null==e?void 0:e.contents)?void 0:t[0])}));e&&Object.assign(w,l(e))}Object.assign(w,{contents:[{role:"user",content:"",contentType:"text"}]})}try{const e=await u({contents:[{role:"user",content:h.sendContent,contentType:"text"}],platform:"web",sessionType:"text_chat",source:"global",configs:null==(n=i.patientInfo)?void 0:n.info,switchFlag:h.switchFlag?1:0,...w});if(["diagnosis","medical_order"].includes(_)&&h.showRightSlot){let e="cliRefreshDiagnosis";"medical_order"===_&&(e="cliRefreshMedical"),m("program",{key:e,type:"refresh",params:{}})}r(e.contents)&&e.contents.length>1&&e.contents.reverse(),I(e),_&&["create_inquiry","create_medical"].includes(_)&&("create_inquiry"===_?"retry_inquiry"!==(null==(s=null==(o=null==e?void 0:e.contents)?void 0:o[0])?void 0:s.messageType)&&(null==(v=null==(f=null==(d=null==(a=null==e?void 0:e.contents)?void 0:a[0])?void 0:d.content)?void 0:f.details)?void 0:v.autoBackFillData)&&(h.consultationContent=e,h.showRight=!0):m("program",{key:"medical",params:{vac01:null==(y=null==(g=i.patientInfo)?void 0:g.info)?void 0:y.vac01,type:1}})),_&&"create_inquiry"!==_||(h.sendContent="")}catch(e){console.log("error ==>",e)}finally{h.loading=!1,h.loadingText=""}}}}const h=()=>i(m);export{m as InjectionAIChatData,p as initData,h as useData};
@@ -1,2 +1,3 @@
1
1
  import { AnyObject } from '../../../../shared/types';
2
- export declare function useWebsocket(props: AnyObject, state: AnyObject): void;
2
+ import { initData } from './useData';
3
+ export declare function useWebsocket(props: AnyObject, data: ReturnType<typeof initData>): void;
@@ -1 +1 @@
1
- import{onBeforeUnmount as o}from"vue";import{isValidJSON as e}from"../utils/index.js";function t(t,n){if(!t.orgId||!t.userId)return;let r=!1;try{const s=window.location.protocol,c=window.location.host,l=`${"https:"===s?"wss:":"ws:"}//${c}/flow/ai/opd/${t.orgId}_${t.userId}`,i=new WebSocket(l);i.onopen=()=>{r=!0,console.log("0 websocket连接成功 ==>")},i.onerror=()=>console.log("WebSocket连接失败"),i.onmessage=o=>{const{data:t}=o||{};if(!e(t))return;const r=JSON.parse(t);n.reportContent=r||null},async function e(t=0){return t>5?console.log("websocket连接失败 ==>"):r?console.log("websocket连接成功 ==>"):(setTimeout((()=>{e(++t)}),100),void o((()=>{i.close()})))}()}catch(o){console.log("error ==>",o)}}export{t as useWebsocket};
1
+ import{onBeforeUnmount as o}from"vue";import{isValidJSON as e}from"../utils/index.js";function t(t,s){if(!t.orgId||!t.userId)return;let n=!1;try{const{appendMessage:r}=s,c=window.location.protocol,l=window.location.host,i=`${"https:"===c?"wss:":"ws:"}//${l}/flow/ai/opd/${t.orgId}_${t.userId}`,a=new WebSocket(i);a.onopen=()=>{n=!0,console.log("0 websocket连接成功 ==>")},a.onerror=()=>console.log("WebSocket连接失败"),a.onmessage=o=>{const{data:t}=o||{};if(!e(t))return;const s=JSON.parse(t);r(s||{})},async function e(t=0){return t>5?console.log("websocket连接失败 ==>"):n?console.log("websocket连接成功 ==>"):(setTimeout((()=>{e(++t)}),100),void o((()=>{a.close()})))}()}catch(o){console.log("error ==>",o)}}export{t as useWebsocket};
@@ -1,7 +1,5 @@
1
- import { InjectionKey, VNodeChild } from 'vue';
1
+ import { VNodeChild } from 'vue';
2
2
  import { AnyObject } from '../../../../shared/types';
3
- export declare const InjectionAIChat: InjectionKey<AnyObject>;
4
- export declare const InjectionAIChatEmits: InjectionKey<(event: string, ...args: any[]) => void>;
5
3
  export type MessageItem = {
6
4
  role: string;
7
5
  contentType: 'json' | 'text';
@@ -1 +1 @@
1
- const t=Symbol("InjectionAIChat"),o=Symbol("InjectionAIChatEmits");export{t as InjectionAIChat,o as InjectionAIChatEmits};
1
+