PatientSidebar.vue 7.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. <template>
  2. <div>
  3. <div class="patient-menu">
  4. <el-autocomplete
  5. style="margin:16px 5px"
  6. popper-class="my-autocomplete"
  7. v-model.trim="value"
  8. :fetch-suggestions="querySearchAsync"
  9. :trigger-on-focus="false"
  10. placeholder="病人名字或者透析号"
  11. @select="handleSelect"
  12. >
  13. <i class="el-icon-search el-input__icon" slot="suffix"> </i>
  14. <template slot-scope="{ item }">
  15. <div class="name">{{ item.name }}</div>
  16. </template>
  17. </el-autocomplete>
  18. <el-select
  19. v-model="selectID"
  20. style="margin:0 5px 0px 5px;text-align: center;"
  21. @change="changePatient"
  22. placeholder="请选择"
  23. >
  24. <el-option
  25. v-for="item in patientsList"
  26. :key="item.id"
  27. :label="item.name"
  28. :value="item.id"
  29. >
  30. </el-option>
  31. </el-select>
  32. <el-tree
  33. :data="treeData"
  34. accordion
  35. node-key="name"
  36. :key="treeKey"
  37. :current-node-key="treeKey"
  38. :default-expanded-keys="[defaultActive]"
  39. @node-click="handleNodeClick"
  40. >
  41. </el-tree>
  42. </div>
  43. <div class="patient-app-container ">
  44. <span class="patient-name"
  45. >姓名:{{ currentPatient.name }} &nbsp;&nbsp; 性别:{{
  46. tranSex(currentPatient.gender)
  47. }}
  48. &nbsp;&nbsp; 年龄:{{ getAge(currentPatient) }} &nbsp;&nbsp; 透析号:{{
  49. currentPatient.dialysis_no
  50. }}
  51. </span>
  52. </div>
  53. </div>
  54. </template>
  55. <script>
  56. import { fetchAllList, PostSearch } from '@/api/patient'
  57. import { jsGetAge, uParseTime } from '@/utils/tools'
  58. export default {
  59. name: 'patientSidebar',
  60. value: '',
  61. searchArray: [],
  62. props: {
  63. id: 0,
  64. defaultActive: {
  65. type: String,
  66. default: '1-1'
  67. }
  68. },
  69. data() {
  70. return {
  71. thedefaultActive: 1,
  72. patientsList: null,
  73. currentPatient: {},
  74. selectID: 0,
  75. keyword: '',
  76. value: '',
  77. treeKey: '',
  78. treeData: [
  79. {
  80. name: '1',
  81. label: '电子病历',
  82. children: [
  83. {
  84. name: '1-1',
  85. label: '基本信息'
  86. },
  87. {
  88. name: '1-4',
  89. label: '医嘱管理'
  90. },
  91. {
  92. name: '1-6',
  93. label: '干体重'
  94. },
  95. {
  96. name: '1-2',
  97. label: '病程管理'
  98. },
  99. {
  100. name: '1-3',
  101. label: '检验检查'
  102. },
  103. {
  104. name: '1-5',
  105. label: '抢救记录'
  106. }
  107. ]
  108. },
  109. {
  110. name: '2',
  111. label: '透析管理',
  112. children: [
  113. {
  114. name: '2-1',
  115. label: '长期透析处方'
  116. },
  117. {
  118. name: '2-2',
  119. label: '透析记录'
  120. },
  121. {
  122. name: '2-4',
  123. label: '排班信息'
  124. },
  125. {
  126. name: '2-5',
  127. label: '宣教信息'
  128. }
  129. ]
  130. }
  131. ]
  132. }
  133. },
  134. methods: {
  135. handleNodeClick(data) {
  136. var name = data.name
  137. if (name == '1-1') {
  138. this.$router.push({ path: '/patients/patient/' + this.id })
  139. } else if (name == '1-2') {
  140. this.$router.push({ path: '/patients/course?id=' + this.id })
  141. } else if (name == '1-3') {
  142. this.$router.push({ path: '/patients/inspection?id=' + this.id })
  143. } else if (name == '1-4') {
  144. this.$router.push({
  145. path: '/patients/patient/' + this.id + '/doctorAdvice'
  146. })
  147. } else if (name == '1-6') {
  148. this.$router.push({
  149. path: '/patients/patient/' + this.id + '/dryWeight'
  150. })
  151. } else if (name == '1-5') {
  152. this.$router.push({ path: '/patients/rescue?id=' + this.id })
  153. } else if (name == '2-1') {
  154. this.$router.push({
  155. path: '/patients/patient/' + this.id + '/dialysisSolution'
  156. })
  157. } else if (name == '2-2') {
  158. this.$router.push({
  159. path: '/patients/patient/' + this.id + '/dialysisRecord'
  160. })
  161. } else if (name == '2-4') {
  162. this.$router.push({
  163. path: '/patients/patient/' + this.id + '/scheduling'
  164. })
  165. } else if (name == '2-5') {
  166. this.$router.push({
  167. path: '/patients/patient/' + this.id + '/proeducation'
  168. })
  169. }
  170. },
  171. changePatient(value) {
  172. console.log(value)
  173. this.$router.push('/patients/patient/' + value)
  174. },
  175. getList() {
  176. fetchAllList().then(response => {
  177. if (response.data.state == 1) {
  178. this.patientsList = response.data.data.patients
  179. var len = this.patientsList.length
  180. if (len > 0) {
  181. for (let index = 0; index < len; index++) {
  182. if (this.patientsList[index].id == this.id) {
  183. this.currentPatient = this.patientsList[index]
  184. // console.log("curr", this.currentPatient);
  185. this.selectID = this.patientsList[index].id
  186. this.$emit('tran-patient', this.currentPatient)
  187. break
  188. }
  189. }
  190. }
  191. }
  192. })
  193. },
  194. tranAge(birthday) {
  195. var birth = uParseTime(birthday, '{y}-{m}-{d}')
  196. return jsGetAge(birth, '-')
  197. },
  198. tranSex(gender) {
  199. var sex = '未知'
  200. switch (gender) {
  201. case 1:
  202. sex = '男'
  203. break
  204. case 2:
  205. sex = '女'
  206. break
  207. default:
  208. break
  209. }
  210. return sex
  211. },
  212. querySearchAsync(keyword, cb) {
  213. let key = ''
  214. if (keyword != undefined) {
  215. key = keyword
  216. }
  217. let searchArray = []
  218. PostSearch(key).then(response => {
  219. if (response.data.state == 1) {
  220. searchArray = response.data.data.patient
  221. cb(searchArray)
  222. } else {
  223. this.$message.error(response.data.msg)
  224. cb([])
  225. }
  226. })
  227. },
  228. handleSelect(val) {
  229. this.$router.push('/patients/patient/' + val.id)
  230. },
  231. getAge: function(val) {
  232. if (val.id_card_no == undefined) {
  233. return false
  234. }
  235. var thisLen = val.id_card_no.length
  236. var birth = ''
  237. if (thisLen == 15) {
  238. birth = '19' + val.id_card_no.substr(6, 6)
  239. } else {
  240. birth = val.id_card_no.substr(6, 8)
  241. }
  242. var birthtwo =
  243. birth.substr(0, 4) +
  244. '-' +
  245. birth.substr(4, 2) +
  246. '-' +
  247. birth.substr(6, 2)
  248. var age = jsGetAge(birthtwo, '-')
  249. return age
  250. }
  251. },
  252. created() {
  253. this.treeKey = this.defaultActive
  254. this.getList()
  255. }
  256. }
  257. </script>
  258. <style>
  259. .patient-menu .el-tree-node__content {
  260. font-size: 14px;
  261. height: 40px;
  262. font-weight: 400;
  263. }
  264. .patient-menu .el-tree-node__label:hover {
  265. color: #409eff;
  266. }
  267. .patient-menu .el-tree-node:focus > .el-tree-node__content {
  268. color: #409eff;
  269. }
  270. .patient-menu .el-tree-node .el-tree-node.is-current > .el-tree-node__content {
  271. color: #409eff;
  272. }
  273. .patient-menu .el-tree {
  274. background: #f6f8f9;
  275. }
  276. .patient-menu {
  277. -webkit-transition: width 0.28s;
  278. transition: width 0.28s;
  279. width: 180px !important;
  280. height: 100%;
  281. position: relative;
  282. font-size: 0px;
  283. top: 0;
  284. float: left;
  285. bottom: 0;
  286. left: 0;
  287. /* z-index: 99; */
  288. overflow: hidden;
  289. }
  290. .patient-center-menu .el-icon-arrow-down:before {
  291. content: "";
  292. }
  293. </style>