sickHistory.vue 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557
  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="3-1"></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="70%" 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-input v-model="title" style="width: 150px"></el-input>
  86. <label class="title"><span class="name">日期</span> : </label>
  87. <el-date-picker v-model="sick_history_time" prefix-icon="el-icon-date" :editable="false"
  88. style="width: 150px;"
  89. type="datetime" placeholder="选择日期时间" align="right" format="yyyy-MM-dd HH:mm:ss"
  90. value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
  91. <label class="title"><span class="name">肾移植史</span> : </label>
  92. <el-select style="width: 150px;" v-model="is_shenyizhishi" placeholder="选择肾移植史" @change="didSelectTemplate">
  93. <el-option label="无" value="0"></el-option>
  94. <el-option label="有" value="1"></el-option>
  95. </el-select>
  96. </div>
  97. <div class="cell clearfix">
  98. <label class="title"><span class="name">腹膜透析史</span> : </label>
  99. <el-select style="width: 150px;" v-model="is_fumotouxishi" placeholder="选择腹膜透析史" @change="didSelectTemplate">
  100. <el-option label="无" value="0"></el-option>
  101. <el-option label="有" value="1"></el-option>
  102. </el-select>
  103. <label class="title"><span class="name">医生</span> : </label>
  104. <el-select style="width: 100px;" v-model="doctor_id" placeholder="请选择医生">
  105. <el-option v-for="(item,index) in doctorOptions" :label="item.name" :value="item.id" :key="index"></el-option>
  106. </el-select>
  107. <label class="title"><span class="name">过敏药物</span> : </label>
  108. <el-select style="width: 100px;" v-model="is_guominyaowu" placeholder="选择过敏药物" @change="didSelectTemplate">
  109. <el-option label="无" value="0"></el-option>
  110. <el-option label="有" value="1"></el-option>
  111. </el-select>
  112. <el-input v-if="is_guominyaowu == 1" v-model="guominyaowu_desc"></el-input>
  113. </div>
  114. <div class="cell clearfix">
  115. <label class="title"><span class="name">病史模版</span> : </label>
  116. <el-select v-model="select_template" placeholder="选择病史模板" @change="didSelectTemplate">
  117. <el-option v-for="(option, index) in templates" :key="index" :label="option.title"
  118. :value="option.content"></el-option>
  119. </el-select>
  120. </div>
  121. <div class="textarea_panel">
  122. <keep-alive>
  123. <editor ref="editor"
  124. id="editors"
  125. style="width: 600px"
  126. v-bind:r_content="new_content"
  127. >
  128. </editor>
  129. </keep-alive>
  130. </div>
  131. <div style="text-align: right; padding-right: 0px; padding-top: 10px; padding-bottom: 10px;">
  132. <el-button @click="show_dialog = false">取消</el-button>
  133. <el-button :disabled="$store.getters.xt_user.subscibe.state==3?true:false" type="primary"
  134. @click="createAction" :loading="uploading_new_record">保存
  135. </el-button>
  136. </div>
  137. </div>
  138. </div>
  139. </el-dialog>
  140. <el-dialog title="修改病程记录" width="50%" top="5vh" :visible.sync="show_edit_dialog">
  141. <div>
  142. <div class="new_record_form">
  143. <div class="cell clearfix">
  144. <label class="title"><span class="name">病程日期</span> : </label>
  145. <el-date-picker v-model="edit_course_of_disease_time" prefix-icon="el-icon-date" :editable="false"
  146. style="width: 200px;"
  147. type="datetime"
  148. placeholder="选择日期时间" align="right" format="yyyy-MM-dd HH:mm:ss"
  149. value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
  150. <label class="title"><span class="name">日常病程</span> : </label>
  151. <el-select v-model="select_template" placeholder="可选择病程模板" @change="didEditSelectTemplate">
  152. <el-option v-for="(option, index) in templates" :key="index" :label="option.title"
  153. :value="option.content"></el-option>
  154. </el-select>
  155. </div>
  156. <div class="cell clearfix" style="margin-top: 10px">
  157. <label class="title"><span class="name">病程标题</span> : </label>
  158. <el-input v-model="edit_title" style="width: 420px"></el-input>
  159. </div>
  160. <div class="textarea_panel">
  161. <!--<el-input v-model="edit_new_content" type="textarea" rows="6" resize="none"></el-input>-->
  162. <keep-alive>
  163. <editor ref="edit_neditor"
  164. id="edit_editor"
  165. style="width: 600px"
  166. v-bind:r_content="edit_new_content">
  167. </editor>
  168. </keep-alive>
  169. </div>
  170. <div style="text-align: right; padding-right: 0px; padding-top: 10px; padding-bottom: 10px;">
  171. <el-button @click="show_edit_dialog = false">取消</el-button>
  172. <el-button :disabled="$store.getters.xt_user.subscibe.state==3?true:false" type="primary"
  173. @click="modifyAction" :loading="uploading_new_record">保存
  174. </el-button>
  175. </div>
  176. </div>
  177. </div>
  178. </el-dialog>
  179. </div>
  180. </div>
  181. <!-- </div> -->
  182. </template>
  183. <script>
  184. import PatientSidebar from './components/PatientSidebar'
  185. import Editor from '@/components/Editor'
  186. import { fetchAllDoctorAndNurse } from "@/api/doctor";
  187. import {
  188. createCourseOfDiseaseRecord,
  189. deleteCourseOfDiseaseRecords,
  190. getCourseOfDiseaseRecords,
  191. modifyCourseOfDiseaseRecord,
  192. GetCoursePrintData
  193. } from '@/api/patient'
  194. import { parseTime } from '@/utils'
  195. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  196. export default {
  197. name: 'CourseOfDisease',
  198. components: {
  199. PatientSidebar,
  200. BreadCrumb,
  201. Editor
  202. },
  203. data() {
  204. return {
  205. loading: false,
  206. title: '',
  207. patient_id: 0,
  208. date: [],
  209. start_time: '',
  210. end_time: '',
  211. sick_history_time: '',
  212. is_shenyizhishi:'',
  213. is_fumotouxishi:'',
  214. is_guominyaowu:'',
  215. guominyaowu_desc:"",
  216. doctor_id:"",
  217. doctorOptions:null,
  218. records: [],
  219. doctors: [],
  220. current_select_record: null,
  221. show_dialog: false,
  222. show_edit_dialog: false,
  223. uploading_new_record: false,
  224. templates: this.$store.getters.configlist.sick_history,
  225. new_content: '',
  226. edit_new_content: '',
  227. edit_course_of_disease_time: '',
  228. selectingRows: [],
  229. table_current_index: -1,
  230. edit_current_id: 0,
  231. edit_title: '',
  232. ids:"",
  233. idArr:[],
  234. }
  235. },
  236. created() {
  237. this.patient_id = parseInt(this.$route.query.id)
  238. if (isNaN(this.patient_id) || this.patient_id <= 0) {
  239. this.$notify.error({
  240. title: '错误',
  241. message: '无效的id'
  242. })
  243. this.$router.push('/patients/patients')
  244. return
  245. }
  246. var now = new Date()
  247. this.date = [now.getTime() - (7 * 24 * 60 * 60 * 1000), now.getTime()]
  248. var nowDate = new Date()
  249. var nowYear = nowDate.getFullYear()
  250. var nowMonth = nowDate.getMonth() + 1
  251. var nowDay = nowDate.getDate()
  252. this.end_time =
  253. nowYear +
  254. '-' +
  255. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  256. '-' +
  257. (nowDay < 10 ? '0' + nowDay : nowDay)
  258. nowDate.setMonth(nowDate.getMonth() - 1)
  259. nowYear = nowDate.getFullYear()
  260. nowMonth = nowDate.getMonth() + 1
  261. nowDay = nowDate.getDate()
  262. this.start_time =
  263. nowYear +
  264. '-' +
  265. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  266. '-' +
  267. (nowDay < 10 ? '0' + nowDay : nowDay)
  268. this.requestCourseRecords()
  269. this.fetchAllDoctorAndNurse()
  270. },
  271. methods: {
  272. fetchAllDoctorAndNurse() {
  273. fetchAllDoctorAndNurse().then(response => {
  274. if (response.data.state == 1) {
  275. this.doctorOptions = response.data.data.doctors;
  276. }
  277. });
  278. },
  279. requestCourseRecords: function() {
  280. this.loading = true
  281. getCourseOfDiseaseRecords(this.patient_id, this.start_time, this.end_time).then(rs => {
  282. this.loading = false
  283. var resp = rs.data
  284. if (resp.state == 1) {
  285. this.current_select_record = null
  286. this.records = resp.data.records
  287. console.log("records232322332323232323223",this.records)
  288. this.doctors = resp.data.doctors
  289. } else {
  290. this.$message.error(resp.msg)
  291. }
  292. }).catch(error => {
  293. this.loading = false
  294. this.$message.error(error)
  295. })
  296. },
  297. didChangeCurrentRecord: function(record) {
  298. this.current_select_record = record
  299. },
  300. recordTime: function(timestamp) {
  301. var time = new Date(timestamp * 1000)
  302. return parseTime(time, '{y}-{m}-{d} {h}:{i}:{s}')
  303. },
  304. doctorName: function(doctor_id) {
  305. for (let index = 0; index < this.doctors.length; index++) {
  306. const doctor = this.doctors[index]
  307. if (doctor.id == doctor_id) {
  308. return doctor.name
  309. }
  310. }
  311. return ''
  312. },
  313. modifyAction: function() {
  314. this.edit_new_content = this.$refs.edit_neditor.content
  315. if (this.edit_new_content.length == 0) {
  316. this.$message.error('请填写病程内容')
  317. return
  318. }
  319. this.uploading_new_record = true
  320. modifyCourseOfDiseaseRecord(this.patient_id, this.edit_new_content, this.edit_course_of_disease_time, this.edit_current_id, this.edit_title).then(rs => {
  321. this.uploading_new_record = false
  322. var resp = rs.data
  323. if (resp.state == 1) {
  324. this.records[this.table_current_index].content = resp.data.record.content
  325. this.records[this.table_current_index].record_time = resp.data.record.record_time
  326. this.records[this.table_current_index].recorder = resp.data.record.recorder
  327. this.records[this.table_current_index].title = resp.data.record.title
  328. this.show_edit_dialog = false
  329. this.edit_new_content = ''
  330. this.table_current_index = -1
  331. } else {
  332. this.table_current_index = -1
  333. this.$message.error(resp.msg)
  334. }
  335. }).catch(error => {
  336. this.table_current_index = -1
  337. this.uploading_new_record = false
  338. this.$message.error(error)
  339. })
  340. },
  341. createAction: function() {
  342. this.new_content = this.$refs.editor.content
  343. console.log("hhhhh2h3h232323232",this.new_content)
  344. if (this.new_content.length == 0) {
  345. this.$message.error('请填写病程内容')
  346. return
  347. }
  348. this.uploading_new_record = true
  349. createCourseOfDiseaseRecord(this.patient_id, this.new_content, this.course_of_disease_time, this.title).then(rs => {
  350. this.uploading_new_record = false
  351. var resp = rs.data
  352. if (resp.state == 1) {
  353. this.records.unshift(resp.data.record)
  354. // this.$refs.record_table.setCurrentRow()
  355. // this.$refs.record_table.setCurrentRow(this.records[0])
  356. // this.current_select_record = this.records[0]
  357. this.show_dialog = false
  358. this.new_content = ''
  359. this.title = ''
  360. } else {
  361. this.$message.error(resp.msg)
  362. }
  363. }).catch(error => {
  364. this.uploading_new_record = false
  365. this.$message.error(error)
  366. })
  367. },
  368. didSelectTemplate: function(templateContent) {
  369. this.new_content = this.new_content.length > 0 ? (this.new_content + templateContent) : templateContent
  370. }, didEditSelectTemplate: function(templateContent) {
  371. this.edit_new_content = this.edit_new_content.length > 0 ? (this.edit_new_content + templateContent) : templateContent
  372. },
  373. didSelectionChange: function(selectRows) {
  374. var arr = []
  375. for(let i=0;i<selectRows.length;i++){
  376. arr.push(selectRows[i].id)
  377. }
  378. var newArr = arr.join(',')
  379. this.ids = newArr
  380. console.log("select23322332",this.ids)
  381. this.selectingRows = selectRows
  382. },
  383. deleteAction: function() {
  384. if (this.selectingRows.length == 0) {
  385. return
  386. }
  387. var ids = []
  388. for (let index = 0; index < this.selectingRows.length; index++) {
  389. const row = this.selectingRows[index]
  390. ids.push(row.id)
  391. }
  392. var ids_str = ids.join(',')
  393. this.loading = true
  394. deleteCourseOfDiseaseRecords(this.patient_id, ids_str).then(rs => {
  395. var resp = rs.data
  396. if (resp.state == 1) {
  397. for (let id_index = 0; id_index < ids.length; id_index++) {
  398. for (let record_index = 0; record_index < this.records.length; record_index++) {
  399. if (ids[id_index] == this.records[record_index].id) {
  400. this.records.splice(record_index, 1)
  401. break
  402. }
  403. }
  404. }
  405. this.selectingRows = []
  406. this.$message.success('已删除')
  407. } else {
  408. this.$message.error(resp.msg)
  409. }
  410. this.loading = false
  411. }).catch(err => {
  412. this.loading = false
  413. this.$message.error(err)
  414. })
  415. }, startTimeChange(val) {
  416. this.requestCourseRecords()
  417. }, endTimeChange(val) {
  418. this.requestCourseRecords()
  419. }, showEdit() {
  420. if (this.table_current_index == -1) {
  421. this.$message.error('请选择要修改的病程内容')
  422. return
  423. }
  424. this.show_edit_dialog = true
  425. this.edit_course_of_disease_time = this.recordTime(this.records[this.table_current_index].record_time)
  426. this.edit_new_content = this.records[this.table_current_index].content
  427. this.edit_current_id = this.records[this.table_current_index].id
  428. this.edit_title = this.records[this.table_current_index].title
  429. this.$refs.record_table.setCurrentRow(null)
  430. }, tableRow({ row, rowIndex }) {
  431. // 把每一行的索引放进row
  432. row.index = rowIndex
  433. }, onRowClick(row, event, column) {
  434. this.table_current_index = row.index
  435. },
  436. print(){
  437. // if (this.table_current_index == -1) {
  438. // this.$message.error('请选择要打印的病程')
  439. // return
  440. // }
  441. if(this.ids.length == 0){
  442. this.$message.error('请选择要打印的病程')
  443. return
  444. }
  445. this.$router.push({ path: "/course/print?ids="+this.ids+"&patient_id="+this.patient_id});
  446. }
  447. }
  448. }
  449. </script>
  450. <style rel="stylesheet/css" lang="scss" scoped>
  451. .container {
  452. margin-left: 180px;
  453. padding: 20px;
  454. background: #fff;
  455. min-height: calc(100vh - 173px);
  456. margin-bottom: 15px;
  457. .record {
  458. padding-top: 20px;
  459. }
  460. }
  461. .record_content_panel {
  462. border-width: 1px;
  463. border-style: solid;
  464. border-color: #ebeef5;
  465. min-height: 200px;
  466. .title {
  467. font-size: 14px;
  468. font-weight: 500;
  469. color: #909399;
  470. line-height: 44px;
  471. height: 44px;
  472. text-align: center;
  473. border-bottom-width: 1px;
  474. border-bottom-style: solid;
  475. border-bottom-color: #ebeef5;
  476. }
  477. .content {
  478. padding: 12px 15px;
  479. font-size: 15px;
  480. color: gray;
  481. line-height: 22px;
  482. }
  483. }
  484. .new_record_form {
  485. /*/ / padding: 10 px, 25 px;*/
  486. .textarea_panel {
  487. margin-top: 10px;
  488. }
  489. }
  490. </style>
  491. <style>
  492. .el-table td,
  493. .el-table th.is-leaf,
  494. .el-table--border,
  495. .el-table--group {
  496. border-color: #d0d3da;
  497. }
  498. .el-table--border::after,
  499. .el-table--group::after,
  500. .el-table::before {
  501. background-color: #d0d3da;
  502. }
  503. </style>