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.

920 lines
36 KiB

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
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 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
2 years ago
3 years ago
3 years ago
3 years ago
3 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
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
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
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
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
3 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
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
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
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
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
3 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 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
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
2 years ago
2 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
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
2 years ago
  1. <template>
  2. <div>
  3. <!--组件-->
  4. <div style="display: flex;">
  5. <div style="width:50%;">
  6. <el-table id="tableSummary" row-key="id" :data="sumDoctorCheck.summaryList" width="100%" :height="sumHeight"
  7. border size="small">
  8. <el-table-column type="index" width="20" align="center" />
  9. <el-table-column prop="summaryTitle" label="综述">
  10. <template slot-scope="scope">
  11. <div>
  12. <el-input v-model="scope.row.summaryTitle" placeholder="请输入综述" disabled></el-input>
  13. <el-table :id="scope.row.id" :row-key="scope.$index + scope.row.id" style="margin-left: 10px;"
  14. :data="scope.row.details" border @row-click="rowClick" :show-header="false">
  15. <el-table-column width="30">
  16. <template slot-scope="scope2">
  17. <div>{{ scope2.$index + 1 }})</div>
  18. </template>
  19. </el-table-column>
  20. <el-table-column prop="summaryContent" label="综述" min-width="200">
  21. <template slot-scope="scope2">
  22. <!--:autosize="{ minRows: 1, maxRows: 20 } "-->
  23. <el-input type="textarea" v-model="scope2.row.summaryContent" placeholder="请输入综述" disabled
  24. :autosize="{ minRows: 1, maxRows: 20 }">
  25. </el-input>
  26. </template>
  27. </el-table-column>
  28. <el-table-column width="8" />
  29. </el-table>
  30. </div>
  31. </template>
  32. </el-table-column>
  33. </el-table>
  34. </div>
  35. <div style="position: absolute; top: 0px; right: 2px; display: flex;z-index: 3;">
  36. <div style="margin-right: 5px;">
  37. <el-button style="height: 28px;" class="commonbutton" @click="btnCollapseAll"
  38. :disabled="sumBtnDisabled('collapse')">{{
  39. collapse ?
  40. '展开' : '折叠' }}全部建议</el-button>
  41. </div>
  42. <div v-show="checkPagePriv(pagePriv.privs, '新增建议')">
  43. <el-button style="height: 28px;" class="commonbutton" @click="addSuggtion"
  44. :disabled="sumBtnDisabled()">新增建议</el-button>
  45. </div>
  46. </div>
  47. <div style="width:50%;">
  48. <el-table id="tableSuggestion" row-key="id" :data="sumDoctorCheck.suggestionList" width="100%" :height="sumHeight"
  49. border size="small" ref="tableSuggestion">
  50. <el-table-column type="index" width="20" align="center">
  51. </el-table-column>
  52. <el-table-column prop="suggestionTitle" label="建议">
  53. <template slot="header">
  54. <div style="display: flex;justify-content:space-between;">
  55. <div>建议</div>
  56. <div></div>
  57. </div>
  58. </template>
  59. <template slot-scope="scope">
  60. <div>
  61. <div style="display: flex;" @dblclick="openSymbols(scope.$index, 'suggestionTitle', -1)">
  62. <el-input v-model="scope.row.suggestionTitle" placeholder="请输入建议标题" :ref="scope.row.id"
  63. :id="scope.row.id" :disabled="sumBtnDisabled()">
  64. </el-input>
  65. <el-button type="danger" :icon="scope.row.collapse ? 'el-icon-arrow-down' : 'el-icon-arrow-up'"
  66. style="min-width:21px;height:21px;padding:2px;"
  67. @click="btnCollapse(sumDoctorCheck.suggestionList, scope.$index, scope.row)"
  68. :disabled="sumBtnDisabled('collapse')"></el-button>
  69. <el-button v-show="checkPagePriv(pagePriv.privs, '删除建议')" type="danger" icon="el-icon-delete"
  70. style="margin-left: 2px;min-width:21px;height:21px;padding:2px;" @click="delSugHead(scope.$index)"
  71. :disabled="sumBtnDisabled()"></el-button>
  72. </div>
  73. <div v-show="!scope.row.collapse">
  74. <div style="display: flex;margin-top: 2px;">
  75. <div style="width:60px;">诊断</div>
  76. <el-select v-model="scope.row.diagnosisIds" multiple placeholder="请选择" style="width: 100%;"
  77. :disabled="sumBtnDisabled()" @change="changeDiagnosis" filterable>
  78. <el-option v-for="item in diagnosises" :key="item.id" :value="item.id" :label="item.displayName"
  79. :disabled="disabledDiagnosis(item.id, scope.$index)" />
  80. </el-select>
  81. </div>
  82. <div style="display: flex;margin-top: 2px;">
  83. <div style="width:60px;">医学解释</div>
  84. <el-tooltip content="新增医学解释" placement="top">
  85. <el-button v-show="checkPagePriv(pagePriv.privs, '新增医学解释')" type="success" icon="el-icon-plus"
  86. style="min-width:21px;height:21px;padding:2px;" @click="addSug(scope.$index, 0)"
  87. :disabled="sumBtnDisabled()">
  88. </el-button>
  89. </el-tooltip>
  90. <el-table :id="'0_sug' + scope.row.id" row-key="displayOrder" style="margin-left: 5px;"
  91. :data="scope.row.medicalInterpretations" border @row-click="rowClickSug0" :show-header="false">
  92. <el-table-column width="30">
  93. <template slot-scope="scope2">
  94. <div>{{ scope2.$index + 1 }}).</div>
  95. </template>
  96. </el-table-column>
  97. <el-table-column prop="suggestionContent" label="建议" min-width="200">
  98. <template slot-scope="scope2">
  99. <div @dblclick="openSymbols(scope.$index, 'medicalInterpretations', scope2.$index)">
  100. <el-input type="textarea" v-model="scope2.row.suggestionContent" placeholder="请输入建议内容"
  101. :disabled="sumBtnDisabled()" :autosize="{ minRows: 1, maxRows: 10 }">
  102. </el-input>
  103. </div>
  104. </template>
  105. </el-table-column>
  106. <el-table-column label="操作" width="25">
  107. <template slot-scope="scope2">
  108. <el-button v-show="checkPagePriv(pagePriv.privs, '删除医学解释')" type="danger"
  109. style="min-width:21px;height:21px;padding:2px;" icon="el-icon-delete"
  110. @click="delSug(scope.row.medicalInterpretations, scope2.$index)" :disabled="sumBtnDisabled()"
  111. size="small"></el-button>
  112. </template>
  113. </el-table-column>
  114. </el-table>
  115. </div>
  116. <div style="display: flex;margin-top: 2px;">
  117. <div style="width:60px;">常见原因</div>
  118. <el-tooltip content="新增常见原因" placement="top">
  119. <el-button v-show="checkPagePriv(pagePriv.privs, '新增常见原因')" type="danger" icon="el-icon-plus"
  120. style="min-width:21px;height:21px;padding:2px;" @click="addSug(scope.$index, 1)"
  121. :disabled="sumBtnDisabled()">
  122. </el-button>
  123. </el-tooltip>
  124. <el-table :id="'1_sug' + scope.row.id" row-key="displayOrder" style="margin-left: 5px;"
  125. :data="scope.row.commonReasons" border @row-click="rowClickSug1" :show-header="false">
  126. <el-table-column width="30">
  127. <template slot-scope="scope2">
  128. <div>{{ scope2.$index + 1 }}).</div>
  129. </template>
  130. </el-table-column>
  131. <el-table-column prop="suggestionContent" label="建议" min-width="200">
  132. <template slot-scope="scope2">
  133. <div @dblclick="openSymbols(scope.$index, 'commonReasons', scope2.$index)">
  134. <el-input type="textarea" v-model="scope2.row.suggestionContent" placeholder="请输入建议内容"
  135. :disabled="sumBtnDisabled()" :autosize="{ minRows: 1, maxRows: 10 }">
  136. </el-input>
  137. </div>
  138. </template>
  139. </el-table-column>
  140. <el-table-column label="操作" width="25">
  141. <template slot-scope="scope2">
  142. <el-button v-show="checkPagePriv(pagePriv.privs, '删除常见原因')" type="danger"
  143. style="min-width:21px;height:21px;padding:2px;" icon="el-icon-delete"
  144. @click="delSug(scope.row.commonReasons, scope2.$index)" :disabled="sumBtnDisabled()"
  145. size="small"></el-button>
  146. </template>
  147. </el-table-column>
  148. </el-table>
  149. </div>
  150. <div style="display: flex;margin-top: 2px;">
  151. <div style="width:60px;">健康指导</div>
  152. <el-tooltip content="新增健康指导" placement="top">
  153. <el-button v-show="checkPagePriv(pagePriv.privs, '新增健康指导')" type="danger" icon="el-icon-plus"
  154. style="min-width:21px;height:21px;padding:2px;" @click="addSug(scope.$index, 2)"
  155. :disabled="sumBtnDisabled()">
  156. </el-button>
  157. </el-tooltip>
  158. <el-table :id="'2_sug' + scope.row.id" row-key="displayOrder" style="margin-left: 5px;"
  159. :data="scope.row.healthGuidances" border @row-click="rowClickSug2" :show-header="false">
  160. <el-table-column width="30">
  161. <template slot-scope="scope2">
  162. <div>{{ scope2.$index + 1 }}).</div>
  163. </template>
  164. </el-table-column>
  165. <el-table-column prop="suggestionContent" label="建议" min-width="200">
  166. <template slot-scope="scope2">
  167. <div @dblclick="openSymbols(scope.$index, 'healthGuidances', scope2.$index)">
  168. <el-input type="textarea" v-model="scope2.row.suggestionContent" placeholder="请输入健康指导"
  169. :disabled="sumBtnDisabled()" :autosize="{ minRows: 1, maxRows: 10 }">
  170. </el-input>
  171. </div>
  172. </template>
  173. </el-table-column>
  174. <el-table-column label="操作" width="25">
  175. <template slot-scope="scope2">
  176. <el-button v-show="checkPagePriv(pagePriv.privs, '删除健康指导')" type="danger"
  177. style="min-width:21px;height:21px;padding:2px;" icon="el-icon-delete"
  178. @click="delSug(scope.row.healthGuidances, scope2.$index)" :disabled="sumBtnDisabled()"
  179. size="small"></el-button>
  180. </template>
  181. </el-table-column>
  182. </el-table>
  183. </div>
  184. </div>
  185. </div>
  186. </template>
  187. </el-table-column>
  188. </el-table>
  189. </div>
  190. </div>
  191. <!--弹窗-->
  192. <div>
  193. <!-- 插入特殊符号 -->
  194. <el-dialog title="插入特殊符号" :visible.sync="dialogWinSymbols" width="600px" :close-on-click-modal="false">
  195. <div style="margin-top: -5px;">
  196. <div style="overflow-y:auto; width:100%;display: flex;flex-wrap: wrap;align-content: flex-start;">
  197. <div v-for="item in symbols" :key="item.id" style="margin: 1px; 2px;cursor:pointer;"
  198. @click="insertSymbols(item.displayName)">
  199. <el-tag style="padding: 0 3px;height: 24px;line-height: 24px;font-size: 15px;">
  200. {{ item.displayName }}
  201. </el-tag>
  202. </div>
  203. </div>
  204. <div style="padding: 5px 0;">录入结果</div>
  205. <el-input id="resultBox" style="width: 100%;" type="textarea" :autosize="{ minRows: 4, maxRows: 4 }"
  206. v-model="curResult" />
  207. </div>
  208. <span slot="footer" class="dialog-footer">
  209. <el-button type="primary" @click="btnOkResult"> </el-button>
  210. <el-button @click="dialogWinSymbols = false">关闭</el-button>
  211. </span>
  212. </el-dialog>
  213. </div>
  214. </div>
  215. </template>
  216. <script>
  217. import { mapState } from 'vuex';
  218. import Sortable from "sortablejs";
  219. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  220. import { getPagePriv, checkPagePriv, deepCopy, arrayExistObj } from '../../utlis/proFunc';
  221. export default {
  222. components: {},
  223. props: ["patientRegisterId"],
  224. data() {
  225. return {
  226. pagePriv: {
  227. routeUrlorPageName: 'sumDoctorCheck', //当前页面归属路由或归属页面权限名称
  228. privs: [] // 页面权限
  229. },
  230. sumDetails: [],
  231. suggestionCurRow: 0, //当前操作建议的行
  232. diagnosises: [], // 诊断
  233. collapse: false, // 折叠/展开全部建议
  234. dialogWinSymbols: false,
  235. selection: { // 光标位置
  236. start: 0, end: 0
  237. },
  238. symbols: [], //特殊符号
  239. curResult: "", // 当前输入框内容
  240. dbclObj: { // 输入特殊符号前,双击的对象
  241. index: -1,
  242. colName: '', //
  243. subIndex: -1,
  244. }
  245. };
  246. },
  247. created() {
  248. //获取用户当前页面的权限
  249. let userPriv = window.sessionStorage.getItem('userPriv')
  250. if (userPriv) this.pagePriv.privs = deepCopy(getPagePriv(this.pagePriv.routeUrlorPageName))
  251. },
  252. //挂载完成
  253. mounted() {
  254. this.rowDrop();
  255. this.rowDropSuggestion();
  256. this.dictInit()
  257. // document.addEventListener('DOMContentLoaded', function () {
  258. // const textarea = document.querySelector('textarea');
  259. // textarea.addEventListener('input', function () {
  260. // // 当文本域内容变化时调整大小
  261. // console.log('textarea.addEventListener',textarea.style.height)
  262. // textarea.style.height = 'auto'; // 重置高度
  263. // // textarea.style.height = textarea.scrollHeight + 'px'; // 根据滚动高度调整高度
  264. // });
  265. // });
  266. this.summaryList(this.dataTransOpts.tableS.patient_register.id)
  267. this.suggestionList(this.dataTransOpts.tableS.patient_register.id)
  268. },
  269. computed: {
  270. ...mapState(['window', 'dict', 'dataTransOpts', 'doctorCheck', 'sumDoctorCheck']),
  271. sumHeight() {
  272. let tempHeight = this.window.pageHeight < 600 ? 600 : this.window.pageHeight
  273. return tempHeight - 335
  274. },
  275. },
  276. methods: {
  277. checkPagePriv,
  278. // textareaResize() {
  279. // const textarea = document.querySelectorAll('textarea');
  280. // textarea.forEach(e => {
  281. // e.style.height = 'auto'; // 重置高度
  282. // });
  283. // },
  284. // 获取诊断数据
  285. dictInit() {
  286. // 获取诊断 /api/app/diagnosis/getlistinsuggestion , {}
  287. postapi('/api/app/Diagnosis/GetSimpleDiagnosisWithSuggestions').then(res => {
  288. if (res.code > -1) {
  289. this.diagnosises = res.data
  290. }
  291. })
  292. //获取结果状态提示数据
  293. postapi('/api/app/CommonChar/GetCommonCharList', {}).then(res => {
  294. if (res.code >= 0) {
  295. this.symbols = res.data
  296. }
  297. })
  298. },
  299. //增加建议
  300. addSuggtion() {
  301. let id = String(new Date().getTime())
  302. let pojo = {
  303. id,
  304. patientRegisterId: this.dataTransOpts.tableS.patient_register.id,
  305. diagnosisIds: [],
  306. medicalInterpretations: [
  307. {
  308. sumSuggestionHeaderId: id, // 拖拽用到
  309. diagnosisId: '', // 关联诊断用到
  310. suggestionContent: '',
  311. }
  312. ],
  313. commonReasons: [
  314. {
  315. sumSuggestionHeaderId: id, // 拖拽用到
  316. diagnosisId: '',
  317. suggestionContent: '',
  318. }
  319. ],
  320. healthGuidances: [
  321. {
  322. sumSuggestionHeaderId: id, // 拖拽用到
  323. diagnosisId: '',
  324. suggestionContent: '',
  325. }
  326. ],
  327. }
  328. this.sumDoctorCheck.suggestionList.push(pojo);
  329. this.$nextTick(() => {
  330. this.$refs[id].focus();
  331. })
  332. },
  333. // 单个折叠展开建议
  334. btnCollapseAll() {
  335. this.collapse = !this.collapse
  336. this.sumDoctorCheck.suggestionList.forEach((e, index) => {
  337. e.collapse = this.collapse
  338. this.$set(this.sumDoctorCheck.suggestionList, index, e)
  339. });
  340. },
  341. // 单个折叠展开建议
  342. btnCollapse(data, index, row) {
  343. row.collapse = !row.collapse
  344. this.$set(data, index, row)
  345. // this.sumDoctorCheck.suggestionList[index]['collapse'] = !this.sumDoctorCheck.suggestionList[index]['collapse']
  346. this.$nextTick(() => {
  347. this.$refs['tableSuggestion'].doLayout()
  348. })
  349. },
  350. // 获取人员是否已总检过
  351. getHaveSumData(patientRegisterId) {
  352. this.sumDoctorCheck.summaryList = [];
  353. this.sumDoctorCheck.suggestionList = [];
  354. if (!patientRegisterId) return
  355. if (this.dataTransOpts.tableS.patient_register.completeFlag == '3') {
  356. this.summaryList(patientRegisterId, 'Y')
  357. this.suggestionList(patientRegisterId, 'Y')
  358. return
  359. }
  360. postapi('/api/app/patientregister/GetHaveSumData', { patientRegisterId })
  361. .then(async (res) => {
  362. if (res.code > -1) {
  363. let isGetExistData = res.data
  364. if (res.data == 'Y') {
  365. try {
  366. await this.$confirm('检测到该人员已经生成过总检信息。', '确认信息', {
  367. distinguishCancelAndClose: true,
  368. confirmButtonText: '重新生成总检信息',
  369. cancelButtonText: '获取上次总检信息',
  370. showClose: false
  371. })
  372. isGetExistData = 'N'
  373. } catch (error) {
  374. //console.log()
  375. }
  376. }
  377. this.summaryList(patientRegisterId, isGetExistData)
  378. this.suggestionList(patientRegisterId, isGetExistData)
  379. }
  380. })
  381. },
  382. //获取综述
  383. summaryList(RegisterId, isGetExistData) {
  384. if (!RegisterId) {
  385. this.sumDoctorCheck.summaryList = [];
  386. return
  387. }
  388. // 旧接口: console.log(`/api/app/sumsummaryheader/getsumsummarylist?PatientRegisterId=${RegisterId}`)
  389. let body = {
  390. patientRegisterId: RegisterId,
  391. isGetExistData,
  392. }
  393. postapi('/api/app/sumsummaryheader/getsumsummarylist', body)
  394. .then((res) => {
  395. console.log("summaryList", res.data);
  396. if (res.code > -1) {
  397. let summaryList = []
  398. res.data.forEach((e, i) => {
  399. let details = []
  400. e.details.forEach((e2, i2) => {
  401. details.push({ id: `summaryDetails_${i2}`, summaryContent: ' ' })
  402. });
  403. summaryList.push({ id: `summary_${i}`, summaryTitle: ' ', details })
  404. });
  405. this.sumDoctorCheck.summaryList = deepCopy(summaryList)
  406. // 自动高度有问题,需要这样处理一下
  407. setTimeout(() => {
  408. this.sumDoctorCheck.summaryList = deepCopy(res.data);
  409. this.sumDoctorCheck.summaryList.forEach((e, i) => {
  410. e.id = `summary_${i}`
  411. e.details.forEach((e2, i2) => {
  412. e2.id = `summaryDetails_${i2}`
  413. });
  414. });
  415. }, 10);
  416. // this.sumDoctorCheck.summaryList = res.data;
  417. // this.textareaResize()
  418. }
  419. })
  420. .catch((err) => {
  421. this.$message({ type: "error", message: `操作失败,原因:${err}` });
  422. });
  423. },
  424. //获取建议
  425. suggestionList(RegisterId, isGetExistData) {
  426. if (!RegisterId) {
  427. this.sumDoctorCheck.suggestionList = [];
  428. return;
  429. };
  430. // {
  431. // "patientRegisterId": "3a11ee70-02cb-c5e6-a087-79ecdd0356b6",
  432. // "isGetExistData": "Y"
  433. // }
  434. let body = {
  435. patientRegisterId: RegisterId,
  436. isGetExistData,
  437. }
  438. // 旧接口: console.log(`/api/app/sumsuggestionheader/getsumsuggestionlist?PatientRegisterId=${RegisterId}`)
  439. postapi('/api/app/sumsuggestionheader/getsumsuggestionlist', body)
  440. .then((res) => {
  441. console.log("suggestionList", res.data);
  442. if (res.code > -1) {
  443. this.sumDoctorCheck.suggestionList = res.data;
  444. // 处理拖动排序使用
  445. this.sumDoctorCheck.suggestionList.forEach((e, i) => {
  446. e.id = `suggestion_${i}`
  447. e.collapse = this.collapse
  448. if (e.medicalInterpretations) {
  449. e.medicalInterpretations.forEach((e0, i0) => {
  450. e0.sumSuggestionHeaderId = `suggestion_${i}`
  451. e0.id = `medicalInterpretations_${i0}`
  452. });
  453. }
  454. if (e.commonReasons) {
  455. e.commonReasons.forEach((e0, i0) => {
  456. e0.sumSuggestionHeaderId = `suggestion_${i}`
  457. e0.id = `commonReasons_${i0}`
  458. });
  459. }
  460. if (e.healthGuidances) {
  461. e.healthGuidances.forEach((e0, i0) => {
  462. e0.sumSuggestionHeaderId = `suggestion_${i}`
  463. e0.id = `healthGuidances_${i0}`
  464. });
  465. }
  466. });
  467. }
  468. })
  469. .catch((err) => {
  470. this.$message({ type: "error", message: `操作失败,原因:${err}` });
  471. });
  472. },
  473. // 按钮可用
  474. sumBtnDisabled(btnType) {
  475. let patientRegister = this.dataTransOpts.tableS.patient_register
  476. let ret = true
  477. //' 请选择体检人员'
  478. if (!patientRegister.id) return ret
  479. // '人员已锁定,不可执行此操作'
  480. if (patientRegister.isLock && patientRegister.isLock == 'Y') return ret
  481. if (btnType && btnType == 'collapse') ret = false
  482. if (patientRegister.completeFlag && patientRegister.completeFlag != '3') ret = false
  483. return ret
  484. },
  485. // 可选诊断处理
  486. disabledDiagnosis(diagnosisId, index) {
  487. let ret = false
  488. let diagnosisIds = []
  489. this.sumDoctorCheck.suggestionList.forEach((e, i) => {
  490. if (i != index) {
  491. if (e.diagnosisIds) diagnosisIds = diagnosisIds.concat(e.diagnosisIds)
  492. }
  493. });
  494. if (diagnosisIds.indexOf(diagnosisId) > -1) ret = true
  495. return ret
  496. },
  497. // 诊断选择
  498. changeDiagnosis(v) {
  499. console.log('changeDiagnosis', v)
  500. let suggestionTitle = []
  501. if (v.length == 0) {
  502. this.sumDoctorCheck.suggestionList[this.suggestionCurRow]['suggestionTitle'] = ''
  503. return
  504. }
  505. //先找到是操作的建议行
  506. let lv = `${v}`
  507. let suggestionList = deepCopy(this.sumDoctorCheck.suggestionList)
  508. suggestionList.forEach(e => {
  509. e.diagnosisIds = `${e.diagnosisIds}`
  510. });
  511. let lfind = arrayExistObj(suggestionList, 'diagnosisIds', lv)
  512. if (lfind == -1) return
  513. this.suggestionCurRow = lfind
  514. let sumSuggestionHeaderId = this.sumDoctorCheck.suggestionList[lfind].id
  515. v.forEach(e => {
  516. let ld = arrayExistObj(this.diagnosises, 'id', e)
  517. if (ld > -1) {
  518. suggestionTitle.push(this.diagnosises[ld]["displayName"])
  519. //添加医学解释
  520. let medicalInterpretations = this.diagnosises[ld]['medicalInterpretations']
  521. if (medicalInterpretations) {
  522. if (!this.sumDoctorCheck.suggestionList[lfind]['medicalInterpretations']) this.sumDoctorCheck.suggestionList[lfind]['medicalInterpretations'] = []
  523. medicalInterpretations.forEach(e2 => {
  524. let lf = arrayExistObj(this.sumDoctorCheck.suggestionList[lfind]['medicalInterpretations'], "suggestionContent", e2.suggestionContent)
  525. if (lf == -1) {
  526. this.sumDoctorCheck.suggestionList[lfind]['medicalInterpretations'].push({
  527. sumSuggestionHeaderId,
  528. suggestionContent: e2.suggestionContent,
  529. displayOrder: Math.random(),
  530. })
  531. }
  532. });
  533. }
  534. //添加常见原因
  535. let commonReasons = this.diagnosises[ld]['commonReasons']
  536. if (commonReasons) {
  537. if (!this.sumDoctorCheck.suggestionList[lfind]['commonReasons']) this.sumDoctorCheck.suggestionList[lfind]['commonReasons'] = []
  538. commonReasons.forEach(e2 => {
  539. let lf = arrayExistObj(this.sumDoctorCheck.suggestionList[lfind]['commonReasons'], "suggestionContent", e2.suggestionContent)
  540. if (lf == -1) {
  541. this.sumDoctorCheck.suggestionList[lfind]['commonReasons'].push({
  542. sumSuggestionHeaderId,
  543. suggestionContent: e2.suggestionContent,
  544. displayOrder: Math.random(),
  545. })
  546. }
  547. });
  548. }
  549. //添加常见原因
  550. let healthGuidances = this.diagnosises[ld]['healthGuidances']
  551. if (healthGuidances) {
  552. if (!this.sumDoctorCheck.suggestionList[lfind]['healthGuidances']) this.sumDoctorCheck.suggestionList[lfind]['healthGuidances'] = []
  553. healthGuidances.forEach(e2 => {
  554. let lf = arrayExistObj(this.sumDoctorCheck.suggestionList[lfind]['healthGuidances'], "suggestionContent", e2.suggestionContent)
  555. if (lf == -1) {
  556. this.sumDoctorCheck.suggestionList[lfind]['healthGuidances'].push({
  557. sumSuggestionHeaderId,
  558. suggestionContent: e2.suggestionContent,
  559. displayOrder: Math.random(),
  560. })
  561. }
  562. });
  563. }
  564. }
  565. });
  566. this.sumDoctorCheck.suggestionList[this.suggestionCurRow]['suggestionTitle'] = `${suggestionTitle}`
  567. this.$nextTick(() => {
  568. this.$refs['tableSuggestion'].doLayout()
  569. })
  570. },
  571. //增加建议明细
  572. addSug(index, contentType) {
  573. this.suggestionCurRow = index
  574. let lcontentType = 'healthGuidances'
  575. switch (contentType) {
  576. case 0:
  577. lcontentType = 'medicalInterpretations'
  578. break;
  579. case 1:
  580. lcontentType = 'commonReasons'
  581. break;
  582. default:
  583. break;
  584. }
  585. if (!this.sumDoctorCheck.suggestionList[index][lcontentType]) this.sumDoctorCheck.suggestionList[index][lcontentType] = []
  586. this.sumDoctorCheck.suggestionList[index][lcontentType].push({
  587. sumSuggestionHeaderId: this.sumDoctorCheck.suggestionList[index].id, // 拖拽用到
  588. suggestionContent: '',
  589. displayOrder: Math.random(),
  590. })
  591. this.$nextTick(() => {
  592. this.$refs['tableSuggestion'].doLayout()
  593. })
  594. console.log('this.sumDoctorCheck.suggestionList', index, this.sumDoctorCheck.suggestionList)
  595. },
  596. //删除建议头及明细
  597. delSugHead(index) {
  598. this.$confirm("此操作将删除该记录, 是否继续?", "提示", {
  599. confirmButtonText: "是",
  600. cancelButtonText: "否",
  601. type: "warning",
  602. }).then(() => {
  603. //删除建议
  604. this.sumDoctorCheck.suggestionList.splice(index, 1)
  605. }).catch((err) => {
  606. if (err == 'cancel') {
  607. console.log(`已取消 ${err}`)
  608. } else {
  609. this.$message.error(`操作失败 ${err}`)
  610. }
  611. });
  612. },
  613. //删除建议明细
  614. delSug(details, indexD) {
  615. this.$confirm("此操作将删除该记录, 是否继续?", "提示", {
  616. confirmButtonText: "是",
  617. cancelButtonText: "否",
  618. type: "warning",
  619. }).then(() => {
  620. //删除建议明细
  621. details.splice(indexD, 1);
  622. }).catch((err) => {
  623. if (err == 'cancel') {
  624. console.log(`已取消 ${err}`)
  625. } else {
  626. this.$message.error(`操作失败 ${err}`)
  627. }
  628. });
  629. },
  630. //选择组合项目
  631. rowClick(row) {
  632. console.log('rowClick row', row)
  633. let lfind = arrayExistObj(this.sumDoctorCheck.summaryList, 'id', row.sumSummaryHeaderId)
  634. if (lfind > -1) {
  635. this.sumDetails = this.sumDoctorCheck.summaryList[lfind].details
  636. this.rowDropSumDetail(row.sumSummaryHeaderId)
  637. }
  638. console.log('this.sumDetails', this.sumDetails)
  639. },
  640. //综述明细拖拽
  641. rowDropSumDetail(id) {
  642. this.$nextTick(() => {
  643. const fEl = document.getElementById(id) // document.querySelector(`#${id} tbody`) querySelector为静态方法不支持动态传参;
  644. console.log('rowDropSumDetail tbody', fEl, fEl.children) //el.childNodes,el.children
  645. const el = this.findEl(fEl, 'TBODY')
  646. console.log('rowDropSumDetail tbody', el) //el.childNodes,el.children
  647. const that = this;
  648. Sortable.create(el, {
  649. animation: 150, // ms, number 单位:ms,定义排序动画的时间
  650. //拖拽结束
  651. onEnd({ newIndex, oldIndex }) {
  652. that.isshow = false;
  653. const currRow = that.sumDetails.splice(oldIndex, 1)[0];
  654. that.sumDetails.splice(newIndex, 0, currRow);
  655. },
  656. });
  657. });
  658. },
  659. // 打开特殊符号输入
  660. openSymbols(index, colName, subIndex) {
  661. if (this.dataTransOpts.tableS.patient_register.completeFlag == '3') return
  662. this.dbclObj = { index, colName, subIndex }
  663. switch (colName) {
  664. case 'suggestionTitle':
  665. this.curResult = this.sumDoctorCheck.suggestionList[index][colName]
  666. break;
  667. default:
  668. this.curResult = this.sumDoctorCheck.suggestionList[index][colName][subIndex]['suggestionContent']
  669. break;
  670. }
  671. this.dialogWinSymbols = true
  672. this.watchSelection()
  673. },
  674. // 光标位置插入特殊符号
  675. insertSymbols(symbols) {
  676. let result = this.curResult || ''
  677. if (result) {
  678. result = result.substring(0, this.selection.start) + symbols + result.substring(this.selection.end)
  679. } else {
  680. result = symbols
  681. }
  682. this.curResult = result
  683. this.selection.start++
  684. this.selection.end++
  685. },
  686. // 获取光标位置的函数
  687. getCaretPosition() {
  688. let input = document.getElementById('resultBox');
  689. this.selection.start = input.selectionStart;
  690. this.selection.end = input.selectionEnd;
  691. // console.log('selection',this.selection)
  692. },
  693. watchSelection() {
  694. this.$nextTick(() => {
  695. let that = this
  696. let resultBox = document.getElementById('resultBox'); //用数组可以读取多个标签的元素 //.inline-input
  697. // 绑定键盘事件到文本框
  698. resultBox.addEventListener('click', function (event) {
  699. // 获取光标位置
  700. that.getCaretPosition()
  701. })
  702. resultBox.addEventListener('input', function (event) {
  703. // 获取光标位置
  704. that.getCaretPosition()
  705. })
  706. })
  707. },
  708. btnOkResult() {
  709. switch (this.dbclObj.colName) {
  710. case 'suggestionTitle':
  711. this.sumDoctorCheck.suggestionList[this.dbclObj.index][this.dbclObj.colName] = this.curResult
  712. break;
  713. default:
  714. this.sumDoctorCheck.suggestionList[this.dbclObj.index][this.dbclObj.colName][this.dbclObj.subIndex]['suggestionContent'] = this.curResult
  715. break;
  716. }
  717. this.dialogWinSymbols = false
  718. },
  719. findEl(fEl, nodeName) {
  720. let el = null
  721. for (let i = 0; i < fEl.children.length; i++) {
  722. console.log(fEl.children[i].nodeName)
  723. if (fEl.children[i].nodeName == nodeName) {
  724. el = fEl.children[i]
  725. break
  726. } else {
  727. el = this.findEl(fEl.children[i], nodeName)
  728. }
  729. if (el) break
  730. }
  731. return el
  732. },
  733. rowClickSug0(row) {
  734. this.rowClickSug(row, 0)
  735. },
  736. rowClickSug1(row) {
  737. this.rowClickSug(row, 1)
  738. },
  739. rowClickSug2(row) {
  740. this.rowClickSug(row, 2)
  741. },
  742. rowClickSug(row, contentType) {
  743. console.log('rowClick row', row, contentType)
  744. let lcontentType = 'healthGuidances'
  745. switch (contentType) {
  746. case 0:
  747. lcontentType = 'medicalInterpretations'
  748. break;
  749. case 1:
  750. lcontentType = 'commonReasons'
  751. break;
  752. default:
  753. break;
  754. }
  755. let lfind = arrayExistObj(this.sumDoctorCheck.suggestionList, 'id', row.sumSuggestionHeaderId)
  756. if (lfind > -1) {
  757. this.sugDetails = this.sumDoctorCheck.suggestionList[lfind][lcontentType]
  758. this.rowDropSugDetail(contentType, row.sumSuggestionHeaderId)
  759. }
  760. console.log('this.sumDetails', lfind, this.sugDetails)
  761. },
  762. //建议明细拖拽
  763. rowDropSugDetail(contentType, id) {
  764. this.$nextTick(() => {
  765. const fEl = document.getElementById(`${contentType}_sug${id}`) // document.querySelector(`#${id} tbody`) querySelector为静态方法不支持动态传参;
  766. console.log('rowDropSumDetail tbody', fEl, fEl.children) //el.childNodes,el.children
  767. const el = this.findEl(fEl, 'TBODY')
  768. console.log('rowDropSumDetail tbody', el) //el.childNodes,el.children
  769. const that = this;
  770. if (this.detailsDrag) this.detailsDrag.destroy()
  771. this.detailsDrag = Sortable.create(el, {
  772. animation: 150, // ms, number 单位:ms,定义排序动画的时间
  773. //拖拽结束
  774. onEnd({ newIndex, oldIndex }) {
  775. that.isshow = false;
  776. const currRow = that.sugDetails.splice(oldIndex, 1)[0];
  777. that.sugDetails.splice(newIndex, 0, currRow);
  778. },
  779. });
  780. });
  781. },
  782. //拖拽
  783. rowDrop() {
  784. this.$nextTick(() => {
  785. const el = document.querySelector("#tableSummary tbody");
  786. console.log('tbody', el)
  787. const that = this;
  788. Sortable.create(el, {
  789. animation: 150, // ms, number 单位:ms,定义排序动画的时间
  790. //拖拽结束
  791. onEnd({ newIndex, oldIndex }) {
  792. that.isshow = false;
  793. const currRow = that.sumDoctorCheck.summaryList.splice(oldIndex, 1)[0];
  794. that.sumDoctorCheck.summaryList.splice(newIndex, 0, currRow);
  795. },
  796. });
  797. });
  798. },
  799. //拖拽
  800. rowDropSuggestion() {
  801. this.$nextTick(() => {
  802. const el = document.querySelector("#tableSuggestion tbody");
  803. console.log('tbody', el)
  804. const that = this;
  805. Sortable.create(el, {
  806. animation: 150, // ms, number 单位:ms,定义排序动画的时间
  807. //拖拽结束
  808. onEnd({ newIndex, oldIndex }) {
  809. that.isshow = false;
  810. const currRow = that.sumDoctorCheck.suggestionList.splice(oldIndex, 1)[0];
  811. that.sumDoctorCheck.suggestionList.splice(newIndex, 0, currRow);
  812. },
  813. });
  814. });
  815. },
  816. },
  817. //监听事件
  818. watch: {
  819. // 虚拟表 触发强制刷新 (sumDoctor.M 合并包含:综述、建议、对比、历史等,不包含总检诊断)
  820. "dataTransOpts.refresh.sumDoctor.M": {
  821. // immediate:true,
  822. handler(newVal, oldVal) {
  823. console.log(`watch 总检--综述建议 newVal: ${newVal}, oldVal: ${oldVal} patientRegisterId: ${this.dataTransOpts.tableS.patient_register.id}`);
  824. this.getHaveSumData(this.dataTransOpts.tableS.patient_register.id)
  825. }
  826. },
  827. },
  828. };
  829. </script>
  830. <style scoped>
  831. @import '../../assets/css/global_table.css';
  832. /* 设置单元格内内容顶对齐 */
  833. ::v-deep .el-table__cell {
  834. display: table-cell;
  835. /* 使单元格表现为表格单元 */
  836. vertical-align: top;
  837. /* 顶对齐 el-table_2_column_2 el-table__cell */
  838. }
  839. ::v-deep .el-textarea__inner {
  840. min-height: 23px;
  841. height: 23px;
  842. line-height: 1.25;
  843. padding: 1px 15px 1px 2px;
  844. }
  845. ::v-deep .el-table__empty-text {
  846. line-height: 22px;
  847. }
  848. ::v-deep .el-tag {
  849. color: black;
  850. padding: 0 5px;
  851. font-size: 14px;
  852. }
  853. ::v-deep .el-table__empty-block {
  854. min-height: 22px;
  855. }
  856. ::v-deep .el-input__inner {
  857. min-height: 23px;
  858. height: 23px;
  859. padding: 1px 15px 1px 2px;
  860. }
  861. </style>