You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

713 lines
31 KiB

3 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
5 months ago
4 months ago
1 year ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
5 months ago
2 years ago
3 years ago
5 months ago
2 years ago
5 months ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
5 months ago
2 years ago
10 months ago
1 year ago
3 months ago
1 year ago
3 months ago
1 year ago
2 years ago
4 months ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
2 years ago
2 years ago
3 years ago
3 months ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
2 years ago
1 year ago
1 year ago
1 year ago
3 months ago
3 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
2 years ago
1 year ago
1 year ago
1 year ago
1 year ago
3 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
5 months ago
2 years ago
2 years ago
5 months ago
2 years ago
2 years ago
5 months ago
2 years ago
2 years ago
5 months ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
5 months ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
1 year ago
2 years ago
1 year ago
1 year ago
1 year ago
2 years ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
10 months ago
3 months ago
1 year ago
3 months ago
1 year ago
1 year ago
2 years ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
3 years ago
3 months ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
2 years ago
2 years ago
2 years ago
3 years ago
5 months ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
5 months ago
2 years ago
3 years ago
5 months ago
3 years ago
5 months ago
2 years ago
3 years ago
3 years ago
2 years ago
5 months ago
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
5 months ago
3 years ago
3 years ago
2 years ago
  1. <template>
  2. <div>
  3. <div v-show="checkPagePriv(pagePriv.privs, '人员列表')" class="listBtn">
  4. <el-button type="primary" class="commonbutton" @click="prList">人员列表</el-button>
  5. </div>
  6. <div v-show="checkPagePriv(pagePriv.privs, '医生诊台')" class="listBtn">
  7. <el-button type="primary" class="commonbutton" @click="toDoctorCheck">医生诊台</el-button>
  8. </div>
  9. <div v-show="checkPagePriv(pagePriv.privs, '导入结果')" class="listBtn">
  10. <el-dropdown @command="btnImportResult">
  11. <el-button type="primary" class="commonbutton">
  12. 导入结果<i class="el-icon-arrow-down el-icon--right"></i>
  13. </el-button>
  14. <el-dropdown-menu slot="dropdown">
  15. <el-dropdown-item command="pacs" :disabled="sumBtnDisabled('save')"
  16. v-show="checkPagePriv(pagePriv.privs, '导入检查结果')">导入检查结果</el-dropdown-item>
  17. <el-dropdown-item command="lis" :disabled="sumBtnDisabled('save')"
  18. v-show="checkPagePriv(pagePriv.privs, '导入检验结果')">导入检验结果</el-dropdown-item>
  19. <el-dropdown-item command="diAn" :disabled="sumBtnDisabled('save')"
  20. v-show="checkPagePriv(pagePriv.privs, '导入迪安结果')">导入迪安结果</el-dropdown-item>
  21. </el-dropdown-menu>
  22. </el-dropdown>
  23. </div>
  24. <!--AI诊断不控制权限 v-show="checkPagePriv(pagePriv.privs, 'AI诊断')" :disabled="sumBtnDisabled('save')"-->
  25. <div class="listBtn">
  26. <el-button slot="reference" class="commonbutton" @click="btnAIdiagnosis(false)">AI诊断</el-button>
  27. </div>
  28. <div v-show="checkPagePriv(pagePriv.privs, '保存')" class="listBtn">
  29. <el-button type="primary" class="commonbutton" @click="btnSave"
  30. :disabled="sumBtnDisabled('save')">保存</el-button>
  31. </div>
  32. <div v-show="checkPagePriv(pagePriv.privs, '修改')" class="listBtn">
  33. <el-button type="primary" class="commonbutton" @click="btnEdit"
  34. :disabled="sumBtnDisabled('edit')">修改</el-button>
  35. </div>
  36. <div v-show="checkPagePriv(pagePriv.privs, '取消总检')" class="listBtn">
  37. <el-button type="primary" class="commonbutton" @click="btnDel"
  38. :disabled="sumBtnDisabled('del')">取消总检</el-button>
  39. </div>
  40. <div v-show="checkPagePriv(pagePriv.privs, '审核')" class="listBtn">
  41. <el-button type="primary" class="commonbutton" @click="audit"
  42. :disabled="sumBtnDisabled('audit')">审核</el-button>
  43. </div>
  44. <div v-show="checkPagePriv(pagePriv.privs, '取消审核')" class="listBtn">
  45. <el-button type="primary" class="commonbutton" @click="unAudit"
  46. :disabled="sumBtnDisabled('unAudit')">取消审核</el-button>
  47. </div>
  48. <!-- 直接放在 建议旁边
  49. <div class="listBtn">
  50. <el-button type="primary" class="btnClass" @click="addDiagnosis">疾病诊断</el-button>
  51. </div>
  52. -->
  53. <div v-show="checkPagePriv(pagePriv.privs, '体检报告')" class="listBtn">
  54. <el-button type="primary" class="commonbutton" @click="btnReport"
  55. :disabled="sumBtnDisabled('report')">体检报告</el-button>
  56. </div>
  57. <div v-show="checkPagePriv(pagePriv.privs, '复查')" class="listBtn">
  58. <el-button type="primary" class="commonbutton" @click="btnReCheck"
  59. :disabled="sumBtnDisabled('reCheck')">复查</el-button>
  60. </div>
  61. <div v-show="checkPagePriv(pagePriv.privs, '随访')" class="listBtn">
  62. <el-button type="primary" class="commonbutton" @click="btnReCall"
  63. :disabled="sumBtnDisabled('reCall')">随访</el-button>
  64. </div>
  65. <div v-show="false" class="listBtn">
  66. <el-button type="primary" class="commonbutton" @click="btnIntervene"
  67. :disabled="sumBtnDisabled('intervene')">干预措施</el-button>
  68. </div>
  69. <div v-show="checkPagePriv(pagePriv.privs, '职业病')" class="listBtn">
  70. <el-button type="primary" class="commonbutton" @click="btnOcc"
  71. :disabled="sumBtnDisabled('btnOcc')">职业病</el-button>
  72. </div>
  73. <div class="listBtn">
  74. <el-button type="primary" class="commonbutton" @click="btnReset">重置</el-button>
  75. </div>
  76. <!-- AI诊断所有小结信息-->
  77. <div v-show="AI.visible"
  78. :style="`z-index:3;border-radius: 10px;border: 1px solid #ddd;background-color:#FFF; position: absolute;top:50px;left:0px;width:${AI.width}px;height: ${AI.height}px;opacity:1;`">
  79. <div v-show="AI.max" style="display: flex;justify-content: space-between;">
  80. <p>AI诊断内容</p>
  81. <el-tooltip content="隐藏 AI诊断内容" placement="top">
  82. <i class="el-icon-minus" @click="btnAImax(AI.max)"
  83. style="font-size: 24px;color: red;cursor:pointer;"></i>
  84. </el-tooltip>
  85. </div>
  86. <div v-show="!AI.max">
  87. <el-tooltip content="显示 AI诊断内容" placement="top">
  88. <i class="el-icon-plus" @click="btnAImax(AI.max)"
  89. style="font-size: 24px;color: red;cursor:pointer;"></i>
  90. </el-tooltip>
  91. </div>
  92. <!-- <el-input v-show="AI.max" type="textarea" v-model="AI.diagnosis" placeholder="AI诊断内容"
  93. :autosize="{ minRows: AIDH, maxRows: AIDH }" style="text-align: right;">
  94. </el-input> -->
  95. <div ref="aiContent" v-html="AI.html" :style="`height:${AI.height - 42 - 48}px;overflow-y: auto;display: blockresize:vertical;padding: 5px 5px 5px 20px;line-height: 1.5;box-sizing: border-box;width: 100%;font-size: inherit;background-color: #fff;background-image: none;border: 1px solid #dcdfe6;border-radius: 4px;transition: border-color .2s cubic-bezier(.645, .045, .355, 1);`"></div>
  96. <div v-show="AI.max" style="text-align: right; margin-top: 10px;">
  97. <el-button class="commonbutton" @click="AI.visible = false">关闭</el-button>
  98. <el-button class="commonbutton" @click="btnAIdiagnosis(true)">AI重新诊断</el-button>
  99. </div>
  100. </div>
  101. <div v-show="sumDoctorCheck.sumDoctorCheckDialogVisible"
  102. :style="`z-index:3;border-radius: 10px;border: 1px solid #ddd;background-color:#FFF; position: absolute;top:50px;right:120px;width:300px;height: ${window.pageHeight - 42 - 10}px;opacity:1;`">
  103. <PatientRegisterList win="sumDoctorCheck" :winAbsolute="true" />
  104. </div>
  105. <el-dialog title="职业病" :visible.sync="dialogWin.OccDisease" width="800px" :close-on-click-modal="false"
  106. :append-to-body="true">
  107. <OccDisease />
  108. </el-dialog>
  109. <!-- 抽屉方式遮罩层不能操作
  110. <el-drawer title="体检人员列表" :visible.sync="sumDoctorCheck.sumDoctorCheckDialogVisible" direction="rtl"
  111. :wrapperClosable="false" :modal="false" :size="300">
  112. <PatientRegisterList :win="sumDoctorCheck" :winAbsolute="false"/>
  113. </el-drawer>
  114. -->
  115. <!-- 直接放在 建议旁边
  116. <el-drawer title="诊断列表" :visible.sync="sumDoctorCheck.sumDiagnosisVisible" direction="ltr" :size="300"
  117. :wrapperClosable="false">
  118. <SumDiagnosis :patientRegisterId="dataTransOpts.tableS.patient_register.id" />
  119. </el-drawer>
  120. -->
  121. </div>
  122. </template>
  123. <script>
  124. import { mapState } from "vuex";
  125. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  126. import { getPagePriv, checkPagePriv, deepCopy } from "../../utlis/proFunc";
  127. import PatientRegisterList from "../doctorCheck/PatientRegisterList.vue";
  128. import SumDiagnosis from "./SumDiagnosis.vue";
  129. import OccDisease from "../../components/occDisease/OccDisease.vue"
  130. import moment from "moment";
  131. import MarkdownIt from "markdown-it";
  132. const md = new MarkdownIt();
  133. export default {
  134. components: {
  135. PatientRegisterList,
  136. SumDiagnosis,
  137. OccDisease
  138. },
  139. data() {
  140. return {
  141. pagePriv: {
  142. routeUrlorPageName: 'sumDoctorCheck', //当前页面归属路由或归属页面权限名称
  143. privs: [] // 页面权限
  144. },
  145. dialogVisible: false,
  146. tableData: [
  147. {
  148. col: 'col',
  149. details: [{ id: 1, name: '000' }, { id: 2, name: '001' }]
  150. }
  151. ],
  152. summary_check_doctor_alias: ["总检", "审核"],
  153. AI: {
  154. width: 500,
  155. height: 24,
  156. max: true,
  157. visible: false,
  158. diagnosis: 'AI诊断信息',
  159. rawText: "", // 原始 markdown 内容(流式累加)
  160. html: "", // 渲染后的 HTML(逐字更新)
  161. typingIndex: 0,
  162. typingTimer: null
  163. },
  164. };
  165. },
  166. created() {
  167. //获取用户当前页面的权限
  168. let userPriv = window.sessionStorage.getItem('userPriv')
  169. if (userPriv) this.pagePriv.privs = deepCopy(getPagePriv(this.pagePriv.routeUrlorPageName))
  170. this.AI.height = this.frameHeight
  171. },
  172. //挂载完成
  173. mounted() {
  174. postapi('/api/app/SysParmValue/GetSysParmValueBySysParmId', { sysParmId: "summary_check_doctor_alias" })
  175. .then(res => {
  176. if (res.code > -1) {
  177. this.summary_check_doctor_alias = JSON.parse(res.data)
  178. }
  179. })
  180. },
  181. computed: {
  182. ...mapState(["window", "dict", "dataTransOpts", "dialogWin", "patientRegister", "doctorCheck", "sumDoctorCheck"]),
  183. frameHeight() {
  184. return this.window.pageHeight - 42 - 10
  185. },
  186. // AIdiagnosisHeight
  187. AIDH() {
  188. return Math.floor((this.AI.height - 24 - 42 - 4) / 21.5)
  189. }
  190. },
  191. methods: {
  192. checkPagePriv,
  193. prList() {
  194. this.sumDoctorCheck.sumDoctorCheckDialogVisible = true
  195. },
  196. //诊断列表
  197. addDiagnosis() {
  198. this.sumDoctorCheck.sumDiagnosisVisible = true
  199. },
  200. //to医生诊台
  201. toDoctorCheck() {
  202. // this.doctorCheck.prBase = Object.assign({},this.dataTransOpts.tableS.patient_register)
  203. // this.patientRegister.photo = this.doctorCheck.prBase.photo
  204. this.$router.push({ path: "/doctorCheck", query: { patient_register: this.dataTransOpts.tableS.patient_register } });
  205. },
  206. // 按钮可用
  207. sumBtnDisabled(btnFlagName) {
  208. let patientRegister = this.dataTransOpts.tableS.patient_register
  209. let ret = true
  210. //' 请选择体检人员'
  211. if (!patientRegister.id) return ret
  212. // '人员已锁定,不可执行此操作'
  213. if (patientRegister.isLock && patientRegister.isLock == 'Y') return ret
  214. switch (btnFlagName) {
  215. case 'addSuggtion':
  216. case 'save':
  217. if (patientRegister.completeFlag && patientRegister.completeFlag != '3') ret = false
  218. break;
  219. case 'edit':
  220. case 'del':
  221. case 'audit':
  222. if (patientRegister.completeFlag && patientRegister.completeFlag == '3' && patientRegister.isAudit != 'Y') ret = false
  223. break;
  224. case 'unAudit':
  225. case 'reCheck':
  226. if (patientRegister.completeFlag && patientRegister.completeFlag == '3' && patientRegister.isAudit && patientRegister.isAudit == 'Y') ret = false
  227. break;
  228. case 'report':
  229. ret = false
  230. break;
  231. case 'intervene':
  232. if (patientRegister.completeFlag && patientRegister.completeFlag == '3') ret = false
  233. break;
  234. case 'btnOcc':
  235. if (patientRegister.isPatientOccupationalDisease && patientRegister.isPatientOccupationalDisease == 'Y') ret = false
  236. break;
  237. default:
  238. ret = false
  239. break;
  240. }
  241. console.log('sumBtnDisabled btnFlagName, patientRegister,ret', btnFlagName, patientRegister, ret)
  242. return ret
  243. },
  244. // 导入结果(检查、检验、迪安)
  245. btnImportResult(checkType) {
  246. if (!this.dataTransOpts.tableS.patient_register.id) {
  247. this.$message.warning({ showClose: true, message: "请先选择记录!" })
  248. return
  249. }
  250. let url = '/api/app/ImportLisResult/ImportResultByPatientRegisterId'
  251. let patientRegisterId = this.dataTransOpts.tableS.patient_register.id
  252. switch (checkType) {
  253. case 'pacs':
  254. url = '/api/app/ImportPacsResult/ImportResultByPatientRegisterId'
  255. postapi(url, { patientRegisterId })
  256. .then(res => {
  257. if (res.code > -1) {
  258. // 心电图(格尔木)
  259. return postapi('/api/app/ImportElectrocardiogramResult/ImportElectrocardiogramResultByPatientRegisterId', { patientRegisterId })
  260. }
  261. })
  262. .then(res => {
  263. if (res && res.code > -1) {
  264. this.$message.success({ showClose: true, message: '导入成功!' })
  265. }
  266. })
  267. break;
  268. case 'diAn':
  269. url = "/api/app/ImportLisResult/ImportDianResultByPatientRegisterId";
  270. postapi(url, { patientRegisterId }).then(res => {
  271. if (res.code > -1) {
  272. this.$message.success({ showClose: true, message: '导入成功!' })
  273. }
  274. })
  275. break;
  276. default: //lis
  277. postapi(url, { patientRegisterId }).then(res => {
  278. if (res.code > -1) {
  279. this.$message.success({ showClose: true, message: '导入成功!' })
  280. }
  281. })
  282. break;
  283. }
  284. },
  285. //保存数据
  286. btnSave() {
  287. let body = {
  288. patientRegisterId: this.dataTransOpts.tableS.patient_register.id,
  289. summaryDoctorId: this.dataTransOpts.tableS.patient_register.summaryDoctorId || null,
  290. summaryDate: this.dataTransOpts.tableS.patient_register.summaryDate || moment(new Date()).format("yyyy-MM-DD HH:mm:ss"),
  291. medicalConclusionId: this.dataTransOpts.tableS.patient_register.medicalConclusionId || null,
  292. summaryHistoricalReview:this.sumDoctorCheck.historySummary,
  293. sumSummarys: this.sumDoctorCheck.summaryList,
  294. sumSuggestions: this.sumDoctorCheck.suggestionList
  295. }
  296. // 检查综述建议是否同一个人,防止不同人员数据覆盖
  297. let message = ''
  298. for (let index = 0; index < this.sumDoctorCheck.summaryList.length; index++) {
  299. let e = this.sumDoctorCheck.summaryList[index];
  300. if (!e.patientRegisterId || e.patientRegisterId != this.dataTransOpts.tableS.patient_register.id) {
  301. message = "人员ID 与 综述人员ID 不一致"
  302. break
  303. }
  304. }
  305. if (!message) {
  306. let male_disable_keywords = ['子宫', '宫颈', '卵巢', '白带', '阴道']
  307. let female_disable_keywords = ['睾丸', '阴茎']
  308. let disable_keywords = []
  309. switch (this.dataTransOpts.tableS.patient_register.sexId) {
  310. case 'M':
  311. case 'F':
  312. disable_keywords = this.dataTransOpts.tableS.patient_register.sexId == 'M' ? male_disable_keywords : female_disable_keywords
  313. disable_keywords.forEach(key => {
  314. this.sumDoctorCheck.summaryList.forEach(e => {
  315. if (e.summaryTitle && e.summaryTitle.indexOf(key) > -1) message = `当前患者性别为:${this.dataTransOpts.tableS.patient_register.sexName} 报告不应出现 ${key} 字眼`
  316. if (e.details) {
  317. e.details.forEach(d => {
  318. if (d.summaryContent && d.summaryContent.indexOf(key) > -1) message = `当前患者性别为:${this.dataTransOpts.tableS.patient_register.sexName} 报告不应出现 ${key} 字眼`
  319. });
  320. }
  321. });
  322. this.sumDoctorCheck.suggestionList.forEach(e => {
  323. if (e.suggestionTitle && e.suggestionTitle.indexOf(key) > -1) message = `当前患者性别为:${this.dataTransOpts.tableS.patient_register.sexName} 报告不应出现 ${key} 字眼`
  324. if (e.diagnosisNames && e.diagnosisNames.indexOf(key) > -1) message = `当前患者性别为:${this.dataTransOpts.tableS.patient_register.sexName} 报告不应出现 ${key} 字眼`
  325. });
  326. });
  327. break;
  328. default:
  329. break;
  330. }
  331. }
  332. if (message) {
  333. this.$message.error({ showClose: true, message })
  334. return
  335. }
  336. for (let index = 0; index < this.sumDoctorCheck.suggestionList.length; index++) {
  337. let e = this.sumDoctorCheck.suggestionList[index];
  338. if (!e.patientRegisterId || e.patientRegisterId != this.dataTransOpts.tableS.patient_register.id) {
  339. message = "人员ID 与 建议人员ID 不一致"
  340. break
  341. }
  342. }
  343. if (message) {
  344. this.$message.error({ showClose: true, message })
  345. return
  346. }
  347. postapi(`/api/app/patientregister/UpdatePatientRegisterSummarySuggestion`, body)
  348. .then((res) => {
  349. if (res.code > -1) {
  350. // this.dataTransOpts.tableS.patient_register.completeFlag = '3';
  351. this.dataTransOpts.refresh.patient_register.S++
  352. }
  353. })
  354. },
  355. //修改结果
  356. btnEdit() {
  357. this.dataTransOpts.tableS.patient_register.completeFlag = '2'
  358. },
  359. //取消总检
  360. async btnDel() {
  361. let tips = false // 已打印删除提示
  362. if (this.dataTransOpts.tableS.patient_register.reportPrintTimes > 0) {
  363. let sysParmId = "summary_check_cancel_alreay_print_is_prompt"
  364. let sysParam = await postapi('/api/app/SysParmValue/GetSysParmValueBySysParmId', { sysParmId })
  365. if (sysParam.data.toUpperCase() == 'Y') tips = true
  366. }
  367. let body = {
  368. patientRegisterId: this.dataTransOpts.tableS.patient_register.id
  369. }
  370. if (tips) {
  371. this.$confirm("已打印过报告, 是否继续取消总检?", "提示", {
  372. confirmButtonText: "是",
  373. cancelButtonText: "否",
  374. type: "warning",
  375. })
  376. .then(() => {
  377. return postapi(`/api/app/patientregister/CancelSumCheck`, body)
  378. })
  379. .then((res) => {
  380. if (res.code > -1) {
  381. this.dataTransOpts.tableS.patient_register.completeFlag = '2';
  382. }
  383. })
  384. .catch((err) => {
  385. if (err != "cancel") {
  386. this.$message.info({ showClose: true, message: err });
  387. }
  388. });
  389. } else {
  390. postapi(`/api/app/patientregister/CancelSumCheck`, body)
  391. .then((res) => {
  392. if (res.code > -1) {
  393. this.dataTransOpts.tableS.patient_register.completeFlag = '2';
  394. }
  395. })
  396. }
  397. },
  398. // AI诊断 AI重新诊断
  399. btnAIdiagnosis(again) {
  400. if (!again) {
  401. if (this.AI.visible) {
  402. this.btnAImax(false)
  403. return
  404. }
  405. }
  406. let message = ''
  407. let linkStr = ';'
  408. this.sumDoctorCheck.summaryList.forEach(e => {
  409. if (message) {
  410. linkStr = ';'
  411. } else {
  412. linkStr = ''
  413. }
  414. message += linkStr + e.summaryTitle + ':'
  415. e.details.forEach((e1, i) => {
  416. message += (i + 1) + ')、' + e1.summaryContent
  417. });
  418. });
  419. message = '性别:' + this.doctorCheck.prBase.sexName + ',年龄:' + this.doctorCheck.prBase.age + '岁,检查结果:' + message
  420. // postapi('/api/app/AIMessage/GetAIMessageResult', { message })
  421. // .then(res => {
  422. // if (res.code > -1) {
  423. // this.AI.visible = true
  424. // this.AI.diagnosis = res.data.result
  425. // this.btnAImax(false)
  426. // } else {
  427. // this.$message.error({ showClose: true, message: res.message })
  428. // }
  429. // })
  430. postapi('/api/app/AiMessageWs/GetAIMessageResult', { message })
  431. .then(res => {
  432. if (!res) return;
  433. // 移除流结束标志并去掉每行的 'data: ' 前缀
  434. let cleaned = String(res)
  435. .replace(/data:\s*\[DONE\]/g, '')
  436. .replace(/^data:\s*/gm, '')
  437. .trim();
  438. if (!cleaned) return;
  439. this.AI.typingIndex = 0;
  440. this.AI.visible = true;
  441. this.AI.rawText = cleaned;
  442. // 确保 typingIndex 在合理范围
  443. if (!this.AI.typingIndex || this.AI.typingIndex < 0) this.AI.typingIndex = 0;
  444. if (this.AI.typingIndex > this.AI.rawText.length) this.AI.typingIndex = 0;
  445. this.startTyping();
  446. this.btnAImax(false);
  447. })
  448. },
  449. btnAImax(max) {
  450. this.AI.max = !max
  451. if (this.AI.max) {
  452. this.AI.width = 500
  453. this.AI.height = this.frameHeight
  454. } else {
  455. this.AI.width = 24
  456. this.AI.height = 24
  457. }
  458. },
  459. startTyping() {
  460. if (this.AI.typingTimer) clearInterval(this.AI.typingTimer);
  461. this.AI.typingTimer = setInterval(() => {
  462. if (this.AI.typingIndex < this.AI.rawText.length) {
  463. const current = this.AI.rawText.slice(0, this.AI.typingIndex);
  464. this.AI.html = md.render(current);
  465. this.AI.typingIndex++;
  466. // 每次更新后滚动到容器底部,确保最新输出可见
  467. this.$nextTick(() => {
  468. try {
  469. const el = this.$refs.aiContent;
  470. if (el) {
  471. el.scrollTop = el.scrollHeight;
  472. }
  473. } catch (e) {
  474. // ignore
  475. }
  476. });
  477. } else {
  478. clearInterval(this.AI.typingTimer);
  479. }
  480. }, 30); // 每 30ms 打一个字
  481. },
  482. //审核
  483. audit() {
  484. // dataTransOpts.tableS.patient_register.summaryDoctorId
  485. // dataTransOpts.tableS.patient_register.auditDoctorId
  486. let auditDoctorId = this.dataTransOpts.tableS.patient_register.auditDoctorId
  487. if (!auditDoctorId) auditDoctorId = window.sessionStorage.getItem("userId")
  488. let body = {
  489. patientRegisterId: this.dataTransOpts.tableS.patient_register.id,
  490. auditDoctorId, // 不传时,取当前用户
  491. //auditDate: "string" // 不传时,取当前时间
  492. isAudit: 'Y'
  493. }
  494. if (this.dataTransOpts.tableS.patient_register.summaryDoctorId == auditDoctorId) {
  495. this.$confirm(`${this.summary_check_doctor_alias[0]}医生与${this.summary_check_doctor_alias[1]}医生相同,一般不允许这样操作, 是否强行操作?`, "提示", {
  496. confirmButtonText: "是",
  497. cancelButtonText: "否",
  498. type: "warning",
  499. }).then(() => {
  500. this.auditApi(body)
  501. })
  502. } else {
  503. this.auditApi(body)
  504. }
  505. },
  506. //取消审核
  507. unAudit() {
  508. let body = {
  509. patientRegisterId: this.dataTransOpts.tableS.patient_register.id,
  510. //auditDoctor: "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  511. //auditDate: "string" 不传时,取当前时间
  512. isAudit: 'N'
  513. }
  514. this.auditApi(body)
  515. },
  516. // 审核或取消审核接口
  517. auditApi(body) {
  518. postapi(`/api/app/patientregister/updatepatientregisterauditordoctor`, body)
  519. .then((res) => {
  520. console.log("unAudit", res.data);
  521. if (res.code != -1) {
  522. this.dataTransOpts.tableS.patient_register.isAudit = body.isAudit;
  523. }
  524. })
  525. .catch((err) => {
  526. this.$message({ type: "error", message: `${body.isAudit == 'Y' ? '' : '取消'}总检审核失败,原因:${err}` });
  527. });
  528. },
  529. //体检报告
  530. async btnReport() {
  531. if (!this.$peisAPI) {
  532. this.$message.info("此功能,需要在壳客户端才可运行!")
  533. return
  534. }
  535. ///3a0c990e-5756-2dc0-19d5-69a617fe4048
  536. let ReportCode = '0005';
  537. let BusinessCode = this.dataTransOpts.tableS.patient_register.id
  538. if (this.dataTransOpts.tableS.patient_register.isPatientOccupationalDisease == 'Y') ReportCode = '0006'
  539. let token = window.sessionStorage.getItem('token');
  540. let user = window.sessionStorage.getItem('user');
  541. let toOutShell = {
  542. ReportCode, token, BusinessCode,
  543. isBuildImage: 'N',
  544. IsUploadPdf: 'N',
  545. preViewCanPrint: 'Y',
  546. Parameters: [
  547. { Name: 'printer', Value: user },
  548. { Name: 'LTS', Value: 'Y' }, //Y、N N只看不能打印
  549. { Name: "firstPage", Value: "pic/peisReportFirstPage.jpg" }, //报告首页主图
  550. { Name: "pageHeader", Value: "pic/peisReportPageHeader.jpg" }, //报告页眉图片
  551. { Name: "pageFooter", Value: "pic/peisReportPageFooter.jpg" }, //报告页脚图片
  552. { Name: "orgSign", Value: this.dataTransOpts.tableS.patient_register.isPatientOccupationalDisease == 'Y' ? "pic/orgSignOcc.png" : "pic/orgSign.png" }, // 体检章
  553. { Name: 'picExtOne', Value: 'pic/hisLog.jpg' }, // 院徽
  554. { Name: 'picExtTwo', Value: 'pic/orgSignCom.png' }, // 单位公章
  555. { Name: 'resultSign', Value: 'pic/resultSign.png' }, // 结果章,如:职业病(本次体检未发现职业性异常)
  556. { Name: 'picExtThree', Value: 'pic/peisQrCode.jpg' }, // 公众号二维码
  557. { Name: 'picExtFour', Value: 'pic/peisQrCodeMini.jpg' }, // 小程序二维码
  558. ],
  559. };
  560. // 总检审核后才能打印
  561. if (this.dataTransOpts.tableS.patient_register.completeFlag != '3') toOutShell.preViewCanPrint = 'N'
  562. if (toOutShell.preViewCanPrint == 'Y' && this.dataTransOpts.tableS.patient_register.isAudit == 'N') {
  563. let sysParmId = "medical_report_print_after_summary_check_is_audit"
  564. let sysParam = await postapi('/api/app/SysParmValue/GetSysParmValueBySysParmId', { sysParmId })
  565. if (sysParam.data.toUpperCase() == 'Y') toOutShell.preViewCanPrint = 'N'
  566. }
  567. // postapi(`/api/app/printreport/getpeisreport?PatientRegisterId=${this.dataTransOpts.tableS.patient_register.id}`)
  568. // .then((res) => {
  569. // if (res.code != -1) {
  570. // toOutShell.ReportTable = res.data;
  571. // console.log('JSON.stringify(toOutShell)', JSON.stringify(toOutShell));
  572. // return this.$peisAPI.printPre(JSON.stringify(toOutShell));
  573. // }
  574. // })
  575. let JSONtoOutShell = JSON.stringify(toOutShell)
  576. console.log('$peisAPI.printPre', JSONtoOutShell)
  577. this.$peisAPI.printPre(JSONtoOutShell)
  578. .then(res => {
  579. if (res) {
  580. let lres = JSON.parse(res)
  581. if (lres.code < 0) this.$message.error({ showClose: true, message: lres.message })
  582. }
  583. })
  584. .catch(err => {
  585. this.$message.warning(err);
  586. });
  587. },
  588. //复查
  589. btnReCheck() {
  590. console.log("复查")
  591. },
  592. btnReCall() {
  593. console.log("随访")
  594. },
  595. //干预措施
  596. btnIntervene() {
  597. console.log("干预措施")
  598. },
  599. // 显示职业病
  600. btnOcc() {
  601. if (!this.dataTransOpts.tableS.patient_register.id) {
  602. this.$message.warning({ showClose: true, message: '人员信息尚未保存!' })
  603. return
  604. }
  605. this.dataTransOpts.plus.OccDisease++
  606. this.dialogWin.OccDisease = true
  607. },
  608. //重置
  609. btnReset(){
  610. location.reload()
  611. },
  612. addSummary() {
  613. if (!this.dataTransOpts.tableS.patient_register.id) {
  614. alert("请选择检查项目")
  615. return
  616. }
  617. this.doctorCheck.checkSummaryList.push({
  618. registerCheckId: this.dataTransOpts.tableS.patient_register.id,
  619. summary: '',
  620. summaryFlag: 'N',
  621. })
  622. this.doctorCheck.checkSuggestionList.push({
  623. registerCheckId: this.dataTransOpts.tableS.patient_register.id,
  624. suggestion: '',
  625. })
  626. },
  627. },
  628. //监听事件()
  629. watch: {
  630. },
  631. };
  632. </script>
  633. <style scoped>
  634. @import '../../assets/css/global_button.css';
  635. .listBtn {
  636. margin-top: 5px;
  637. margin-left: 10px;
  638. text-align: center;
  639. }
  640. </style>