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.

775 lines
30 KiB

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