Elizabeth's proactive approach involves introducing urinal toilet attachment , an ingenious concept that optimizes space and functionality.

courseOfDisease.vue 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498
  1. <template>
  2. <!-- <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb></bread-crumb>
  5. </div> -->
  6. <div class="patient-container">
  7. <patient-sidebar :id="patient_id" defaultActive="1-2"></patient-sidebar>
  8. <!-- <div class="app-container"> -->
  9. <div v-loading="loading">
  10. <div class="patient-app-container advice-container app-container">
  11. <div>
  12. <span style="margin-left: 10px;float:right;">
  13. <el-button type="primary" icon="el-icon-circle-plus-outline" size="small"
  14. @click="show_dialog = true">新增</el-button>
  15. <el-button type="primary" icon="el-icon-edit-outline" size="small"
  16. @click="showEdit">修改</el-button>
  17. <el-button type="primary" icon="el-icon-printer" size="small"
  18. @click="print">打印</el-button>
  19. <el-button size="small" v-show="selectingRows.length > 0" type="danger"
  20. @click="deleteAction">删除</el-button>
  21. </span>
  22. <!--<span class="filter_title">日期查询</span>-->
  23. <!--<el-date-picker size="small" v-model="date" type="daterange" range-separator="至" start-placeholde="开始日期" end-placeholde="结束日期" value-format="timestamp" :clearable="false" @change="requestCourseRecords()"></el-date-picker>-->
  24. </div>
  25. <!--<div></div>-->
  26. <div class="cell clearfix">
  27. <label class="title"><span class="name">日期查询</span> : </label>
  28. <el-date-picker v-model="start_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
  29. type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
  30. value-format="yyyy-MM-dd" @change="startTimeChange"></el-date-picker>
  31. <span class="">-</span>
  32. <el-date-picker v-model="end_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
  33. type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
  34. value-format="yyyy-MM-dd" @change="endTimeChange"></el-date-picker>
  35. </div>
  36. <div class="record">
  37. <el-row :gutter="15">
  38. <el-col :span="10">
  39. <el-table :header-cell-style="{
  40. backgroundColor: 'rgb(245, 247, 250)',
  41. color: '#606266'
  42. }"
  43. :row-style="{ color: '#303133' }" ref="record_table" :data="records"
  44. border highlight-current-row @current-change="didChangeCurrentRecord"
  45. @selection-change="didSelectionChange"
  46. :row-class-name="tableRow"
  47. @row-click="onRowClick"
  48. >
  49. <el-table-column type="selection" width="40" align="center"></el-table-column>
  50. <el-table-column label="病程标题" align="center">
  51. <template slot-scope="scope">
  52. {{ scope.row.title}}
  53. </template>
  54. </el-table-column>
  55. <el-table-column label="记录时间" align="center">
  56. <template slot-scope="scope">
  57. {{ recordTime(scope.row.record_time) }}
  58. </template>
  59. </el-table-column>
  60. <el-table-column label="记录医生" align="center">
  61. <template slot-scope="scope">
  62. {{ doctorName(scope.row.recorder) }}
  63. </template>
  64. </el-table-column>
  65. </el-table>
  66. </el-col>
  67. <el-col :span="14">
  68. <div class="record_content_panel">
  69. <div style="background-color:rgb(245, 247, 250)" class="title">病程内容</div>
  70. <div class="content">
  71. <span v-if="current_select_record" v-html="current_select_record.content">{{current_select_record.content }}</span>
  72. <span v-else></span>
  73. </div>
  74. </div>
  75. </el-col>
  76. </el-row>
  77. </div>
  78. </div>
  79. <!-- </div> -->
  80. <el-dialog title="新增病程记录" width="50%" top="5vh" :visible.sync="show_dialog">
  81. <div>
  82. <div class="new_record_form">
  83. <div class="cell clearfix">
  84. <label class="title"><span class="name">病程日期</span> : </label>
  85. <el-date-picker v-model="course_of_disease_time" prefix-icon="el-icon-date" :editable="false"
  86. style="width: 200px;"
  87. type="datetime" placeholder="选择日期时间" align="right" format="yyyy-MM-dd HH:mm"
  88. value-format="yyyy-MM-dd HH:mm"></el-date-picker>
  89. <label class="title"><span class="name">日常病程</span> : </label>
  90. <el-select v-model="select_template" placeholder="可选择病程模板" @change="didSelectTemplate">
  91. <el-option v-for="(option, index) in templates" :key="index" :label="option.title"
  92. :value="option.content"></el-option>
  93. </el-select>
  94. </div>
  95. <div class="cell clearfix" style="margin-top: 10px">
  96. <label class="title"><span class="name">病程标题</span> : </label>
  97. <el-input v-model="title" style="width: 420px"></el-input>
  98. </div>
  99. <div class="textarea_panel">
  100. <keep-alive>
  101. <editor ref="editor"
  102. id="editors"
  103. style="width: 600px"
  104. v-bind:r_content="new_content"
  105. >
  106. </editor>
  107. </keep-alive>
  108. </div>
  109. <div style="text-align: right; padding-right: 0px; padding-top: 10px; padding-bottom: 10px;">
  110. <el-button @click="show_dialog = false">取消</el-button>
  111. <el-button :disabled="$store.getters.xt_user.subscibe.state==3?true:false" type="primary"
  112. @click="createAction" :loading="uploading_new_record">保存
  113. </el-button>
  114. </div>
  115. </div>
  116. </div>
  117. </el-dialog>
  118. <el-dialog title="修改病程记录" width="50%" top="5vh" :visible.sync="show_edit_dialog">
  119. <div>
  120. <div class="new_record_form">
  121. <div class="cell clearfix">
  122. <label class="title"><span class="name">病程日期</span> : </label>
  123. <el-date-picker v-model="edit_course_of_disease_time" prefix-icon="el-icon-date" :editable="false"
  124. style="width: 200px;"
  125. type="datetime"
  126. placeholder="选择日期时间" align="right" format="yyyy-MM-dd HH:mm"
  127. value-format="yyyy-MM-dd HH:mm"></el-date-picker>
  128. <label class="title"><span class="name">日常病程</span> : </label>
  129. <el-select v-model="select_template" placeholder="可选择病程模板" @change="didEditSelectTemplate">
  130. <el-option v-for="(option, index) in templates" :key="index" :label="option.title"
  131. :value="option.content"></el-option>
  132. </el-select>
  133. </div>
  134. <div class="cell clearfix" style="margin-top: 10px">
  135. <label class="title"><span class="name">病程标题</span> : </label>
  136. <el-input v-model="edit_title" style="width: 420px"></el-input>
  137. </div>
  138. <div class="textarea_panel">
  139. <!--<el-input v-model="edit_new_content" type="textarea" rows="6" resize="none"></el-input>-->
  140. <keep-alive>
  141. <editor ref="edit_neditor"
  142. id="edit_editor"
  143. style="width: 600px"
  144. v-bind:r_content="edit_new_content">
  145. </editor>
  146. </keep-alive>
  147. </div>
  148. <div style="text-align: right; padding-right: 0px; padding-top: 10px; padding-bottom: 10px;">
  149. <el-button @click="show_edit_dialog = false">取消</el-button>
  150. <el-button :disabled="$store.getters.xt_user.subscibe.state==3?true:false" type="primary"
  151. @click="modifyAction" :loading="uploading_new_record">保存
  152. </el-button>
  153. </div>
  154. </div>
  155. </div>
  156. </el-dialog>
  157. </div>
  158. </div>
  159. <!-- </div> -->
  160. </template>
  161. <script>
  162. import PatientSidebar from './components/PatientSidebar'
  163. import Editor from '@/components/Editor'
  164. import {
  165. createCourseOfDiseaseRecord,
  166. deleteCourseOfDiseaseRecords,
  167. getCourseOfDiseaseRecords,
  168. modifyCourseOfDiseaseRecord,
  169. GetCoursePrintData
  170. } from '@/api/patient'
  171. import { parseTime } from '@/utils'
  172. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  173. export default {
  174. name: 'CourseOfDisease',
  175. components: {
  176. PatientSidebar,
  177. BreadCrumb,
  178. Editor
  179. },
  180. data() {
  181. return {
  182. loading: false,
  183. title: '',
  184. patient_id: 0,
  185. date: [],
  186. start_time: '',
  187. end_time: '',
  188. course_of_disease_time: '',
  189. records: [],
  190. doctors: [],
  191. current_select_record: null,
  192. show_dialog: false,
  193. show_edit_dialog: false,
  194. uploading_new_record: false,
  195. templates: this.$store.getters.configlist.course_disease,
  196. select_template: '',
  197. new_content: '',
  198. edit_new_content: '',
  199. edit_course_of_disease_time: '',
  200. selectingRows: [],
  201. table_current_index: -1,
  202. edit_current_id: 0,
  203. edit_title: ''
  204. }
  205. },
  206. created() {
  207. this.patient_id = parseInt(this.$route.query.id)
  208. if (isNaN(this.patient_id) || this.patient_id <= 0) {
  209. this.$notify.error({
  210. title: '错误',
  211. message: '无效的id'
  212. })
  213. this.$router.push('/patients/patients')
  214. return
  215. }
  216. var now = new Date()
  217. this.date = [now.getTime() - (7 * 24 * 60 * 60 * 1000), now.getTime()]
  218. var nowDate = new Date()
  219. var nowYear = nowDate.getFullYear()
  220. var nowMonth = nowDate.getMonth() + 1
  221. var nowDay = nowDate.getDate()
  222. this.end_time =
  223. nowYear +
  224. '-' +
  225. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  226. '-' +
  227. (nowDay < 10 ? '0' + nowDay : nowDay)
  228. nowDate.setMonth(nowDate.getMonth() - 1)
  229. nowYear = nowDate.getFullYear()
  230. nowMonth = nowDate.getMonth() + 1
  231. nowDay = nowDate.getDate()
  232. this.start_time =
  233. nowYear +
  234. '-' +
  235. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  236. '-' +
  237. (nowDay < 10 ? '0' + nowDay : nowDay)
  238. this.requestCourseRecords()
  239. },
  240. methods: {
  241. requestCourseRecords: function() {
  242. this.loading = true
  243. getCourseOfDiseaseRecords(this.patient_id, this.start_time, this.end_time).then(rs => {
  244. this.loading = false
  245. var resp = rs.data
  246. if (resp.state == 1) {
  247. this.current_select_record = null
  248. this.records = resp.data.records
  249. this.doctors = resp.data.doctors
  250. } else {
  251. this.$message.error(resp.msg)
  252. }
  253. }).catch(error => {
  254. this.loading = false
  255. this.$message.error(error)
  256. })
  257. },
  258. didChangeCurrentRecord: function(record) {
  259. this.current_select_record = record
  260. },
  261. recordTime: function(timestamp) {
  262. var time = new Date(timestamp * 1000)
  263. return parseTime(time, '{y}-{m}-{d} {h}:{m}')
  264. },
  265. doctorName: function(doctor_id) {
  266. for (let index = 0; index < this.doctors.length; index++) {
  267. const doctor = this.doctors[index]
  268. if (doctor.id == doctor_id) {
  269. return doctor.name
  270. }
  271. }
  272. return ''
  273. },
  274. modifyAction: function() {
  275. this.edit_new_content = this.$refs.edit_neditor.content
  276. if (this.edit_new_content.length == 0) {
  277. this.$message.error('请填写病程内容')
  278. return
  279. }
  280. this.uploading_new_record = true
  281. modifyCourseOfDiseaseRecord(this.patient_id, this.edit_new_content, this.edit_course_of_disease_time, this.edit_current_id, this.edit_title).then(rs => {
  282. this.uploading_new_record = false
  283. var resp = rs.data
  284. if (resp.state == 1) {
  285. this.records[this.table_current_index].content = resp.data.record.content
  286. this.records[this.table_current_index].record_time = resp.data.record.record_time
  287. this.records[this.table_current_index].recorder = resp.data.record.recorder
  288. this.records[this.table_current_index].title = resp.data.record.title
  289. this.show_edit_dialog = false
  290. this.edit_new_content = ''
  291. this.table_current_index = -1
  292. } else {
  293. this.table_current_index = -1
  294. this.$message.error(resp.msg)
  295. }
  296. }).catch(error => {
  297. this.table_current_index = -1
  298. this.uploading_new_record = false
  299. this.$message.error(error)
  300. })
  301. },
  302. createAction: function() {
  303. this.new_content = this.$refs.editor.content
  304. if (this.new_content.length == 0) {
  305. this.$message.error('请填写病程内容')
  306. return
  307. }
  308. this.uploading_new_record = true
  309. createCourseOfDiseaseRecord(this.patient_id, this.new_content, this.course_of_disease_time, this.title).then(rs => {
  310. this.uploading_new_record = false
  311. var resp = rs.data
  312. if (resp.state == 1) {
  313. this.records.unshift(resp.data.record)
  314. // this.$refs.record_table.setCurrentRow()
  315. // this.$refs.record_table.setCurrentRow(this.records[0])
  316. // this.current_select_record = this.records[0]
  317. this.show_dialog = false
  318. this.new_content = ''
  319. this.title = ''
  320. } else {
  321. this.$message.error(resp.msg)
  322. }
  323. }).catch(error => {
  324. this.uploading_new_record = false
  325. this.$message.error(error)
  326. })
  327. },
  328. didSelectTemplate: function(templateContent) {
  329. this.new_content = this.new_content.length > 0 ? (this.new_content + templateContent) : templateContent
  330. }, didEditSelectTemplate: function(templateContent) {
  331. this.edit_new_content = this.edit_new_content.length > 0 ? (this.edit_new_content + templateContent) : templateContent
  332. },
  333. didSelectionChange: function(selectRows) {
  334. this.selectingRows = selectRows
  335. },
  336. deleteAction: function() {
  337. if (this.selectingRows.length == 0) {
  338. return
  339. }
  340. var ids = []
  341. for (let index = 0; index < this.selectingRows.length; index++) {
  342. const row = this.selectingRows[index]
  343. ids.push(row.id)
  344. }
  345. var ids_str = ids.join(',')
  346. this.loading = true
  347. deleteCourseOfDiseaseRecords(this.patient_id, ids_str).then(rs => {
  348. var resp = rs.data
  349. if (resp.state == 1) {
  350. for (let id_index = 0; id_index < ids.length; id_index++) {
  351. for (let record_index = 0; record_index < this.records.length; record_index++) {
  352. if (ids[id_index] == this.records[record_index].id) {
  353. this.records.splice(record_index, 1)
  354. break
  355. }
  356. }
  357. }
  358. this.selectingRows = []
  359. this.$message.success('已删除')
  360. } else {
  361. this.$message.error(resp.msg)
  362. }
  363. this.loading = false
  364. }).catch(err => {
  365. this.loading = false
  366. this.$message.error(err)
  367. })
  368. }, startTimeChange(val) {
  369. this.requestCourseRecords()
  370. }, endTimeChange(val) {
  371. this.requestCourseRecords()
  372. }, showEdit() {
  373. if (this.table_current_index == -1) {
  374. this.$message.error('请选择要修改的病程内容')
  375. return
  376. }
  377. this.show_edit_dialog = true
  378. this.edit_course_of_disease_time = this.recordTime(this.records[this.table_current_index].record_time)
  379. this.edit_new_content = this.records[this.table_current_index].content
  380. this.edit_current_id = this.records[this.table_current_index].id
  381. this.edit_title = this.records[this.table_current_index].title
  382. this.$refs.record_table.setCurrentRow(null)
  383. }, tableRow({ row, rowIndex }) {
  384. // 把每一行的索引放进row
  385. row.index = rowIndex
  386. }, onRowClick(row, event, column) {
  387. this.table_current_index = row.index
  388. },print(){
  389. if (this.table_current_index == -1) {
  390. this.$message.error('请选择要打印的病程')
  391. return
  392. }
  393. this.$router.push({ path: "/course/print?id="+this.records[this.table_current_index].id});
  394. }
  395. }
  396. }
  397. </script>
  398. <style rel="stylesheet/css" lang="scss" scoped>
  399. .container {
  400. margin-left: 180px;
  401. padding: 20px;
  402. background: #fff;
  403. min-height: calc(100vh - 173px);
  404. margin-bottom: 15px;
  405. .record {
  406. padding-top: 20px;
  407. }
  408. }
  409. .record_content_panel {
  410. border-width: 1px;
  411. border-style: solid;
  412. border-color: #ebeef5;
  413. min-height: 200px;
  414. .title {
  415. font-size: 14px;
  416. font-weight: 500;
  417. color: #909399;
  418. line-height: 44px;
  419. height: 44px;
  420. text-align: center;
  421. border-bottom-width: 1px;
  422. border-bottom-style: solid;
  423. border-bottom-color: #ebeef5;
  424. }
  425. .content {
  426. padding: 12px 15px;
  427. font-size: 15px;
  428. color: gray;
  429. line-height: 22px;
  430. }
  431. }
  432. .new_record_form {
  433. /*/ / padding: 10 px, 25 px;*/
  434. .textarea_panel {
  435. margin-top: 10px;
  436. }
  437. }
  438. </style>
  439. <style>
  440. .el-table td,
  441. .el-table th.is-leaf,
  442. .el-table--border,
  443. .el-table--group {
  444. border-color: #d0d3da;
  445. }
  446. .el-table--border::after,
  447. .el-table--group::after,
  448. .el-table::before {
  449. background-color: #d0d3da;
  450. }
  451. </style>