DealZk.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <template>
  2. <el-container>
  3. <el-header>
  4. <el-row :gutter="3" style="width: 100%">
  5. <el-col :span="5">
  6. <el-select filterable v-model="queryParam.wardCode" style="width: 130px;" size="small" @change="wardChange">
  7. <el-option v-for="item in ward" :key="item.code" :label="item.name" :value="item.code">
  8. <span style="color: #8492a6; font-size: 12px">{{ item.code }}</span>
  9. <el-divider direction="vertical"></el-divider>
  10. <span>{{ item.name }}</span>
  11. </el-option>
  12. </el-select>
  13. </el-col>
  14. <el-col :span="5">
  15. 输入码:<el-input v-model="queryParam.keyWard" style="width: 150px" clearable placeholder="支持住院号或姓名" >
  16. <template #append>
  17. <el-button icon="Search" @click="queryInfo" title="查询" />
  18. </template>
  19. </el-input>
  20. </el-col>
  21. <el-col :span="5">
  22. 转科病房:<el-popover :visible="visible" width="400" placement="right-end" trigger="click">
  23. <template #reference>
  24. <el-input v-model="queryParam.zkWardCode" @click="visible = true" style="width: 100px" clearable />
  25. </template>
  26. <div style="width: 380px;">
  27. <div style="text-align: right">
  28. <el-button title="关闭" icon="CloseBold" @click="visible = false"></el-button>
  29. </div>
  30. <el-table :data="zkWard" @row-click="fetchZkWard" height="400">
  31. <el-table-column property="dept_name" label="科室名称" />
  32. <el-table-column property="name" label="病房名称" />
  33. </el-table>
  34. </div>
  35. </el-popover>
  36. </el-col>
  37. <el-col :span="5">
  38. 小科室:<el-select filterable v-model="queryParam.smallWardCode" clearable style="width: 130px;" size="small" >
  39. <el-option v-for="item in smallWard" :key="item.code" :label="item.name" :value="item.code">
  40. <span style="color: #8492a6; font-size: 12px">{{ item.code }}</span>
  41. <el-divider direction="vertical"></el-divider>
  42. <span>{{ item.name }}</span>
  43. </el-option>
  44. </el-select>
  45. </el-col>
  46. <el-col :span="4">
  47. <el-button type="success" @click="saveData"> 保存</el-button>
  48. </el-col>
  49. </el-row>
  50. </el-header>
  51. <el-main>
  52. <div :style="divStyle">
  53. <div style="width: 55%;border: 1px #6b778c solid">
  54. <div style="margin-left: 20px">
  55. <el-tag>在院病人列表</el-tag>
  56. </div>
  57. <div>
  58. <el-table :data="zyPatientList" highlight-current-row style="width: 100%" @row-click="selectZkPatient" :height="windowHeight-95">
  59. <el-table-column property="inpatientNo" label="住院号" />
  60. <el-table-column property="bedNo" label="床号" />
  61. <el-table-column property="name" label="姓名" />
  62. <el-table-column property="fileStatus" label="状态" />
  63. <el-table-column property="wardName" label="病房" />
  64. <el-table-column property="zkWardName" show-overflow-tooltip label="待转病房" />
  65. <el-table-column label="入院日期" width="110" >
  66. <template #default="scope">
  67. {{getFormatDatetime(scope.row.admissDate,'YYYY-MM-DD')}}
  68. </template>
  69. </el-table-column>
  70. <el-table-column property="admissTimes" label="住院次数" />
  71. </el-table>
  72. </div>
  73. </div>
  74. <div :style="centerDive" class="centerClass">
  75. <div >
  76. <el-button size="large" icon="DArrowRight" @click="addRight"/>
  77. </div>
  78. <div style="margin-top: 10px">
  79. <el-button size="large" icon="DArrowLeft" @click="addLeft"/>
  80. </div>
  81. </div>
  82. <div style="width: 37% ;border: 1px #6b778c solid">
  83. <div style="margin-left: 20px">
  84. <el-tag>待转科病人列表</el-tag>
  85. </div>
  86. <div>
  87. <el-table :data="dZkPatientList" highlight-current-row style="width: 100%" @row-click="cancelZkPatient" :height="windowHeight-95">
  88. <el-table-column property="bedNo" label="床号" />
  89. <el-table-column property="inpatientNo" label="住院号" />
  90. <el-table-column property="name" label="姓名" />
  91. <el-table-column property="admissTimes" label="次数" />
  92. <el-table-column property="wardName" label="病房" />
  93. </el-table>
  94. </div>
  95. </div>
  96. </div>
  97. </el-main>
  98. </el-container>
  99. </template>
  100. <script setup lang="ts">
  101. import {onMounted, ref} from "vue";
  102. import {getAllWards} from "@/api/zhu-yuan-yi-sheng/resident-doctor";
  103. import {querySmallWard,queryZyWard} from "@/api/medical-advice/medical-common";
  104. import {queryZkPatient,queryZkBedVo,checkZk,saveZkData,createPatientDoor} from "@/api/medical-advice/patient-info";
  105. import {ElMessage,ElMessageBox} from "element-plus";
  106. import {stringIsBlank} from "@/utils/blank-utils"
  107. import { getFormatDatetime } from "@/utils/date";
  108. const windowHeight = window.innerHeight
  109. interface QueryType{
  110. wardCode:string,
  111. keyWard:string,
  112. zkWardCode:string,
  113. smallWardCode:string,
  114. }
  115. const queryParam = ref<QueryType>({
  116. wardCode:'',
  117. keyWard:'',
  118. zkWardCode:'',
  119. smallWardCode:'',
  120. })
  121. //病室
  122. const ward = ref<any>([])
  123. // 转科病房
  124. const zkWard = ref([])
  125. // 小科室
  126. const smallWard = ref([])
  127. const visible = ref<boolean>(false)
  128. // 左边在院病人列表
  129. const zyPatientList=ref([])
  130. //右边待转科病人列表
  131. const dZkPatientList = ref([])
  132. onMounted(()=>{
  133. getAllWards().then((res:any)=>{
  134. ward.value =res
  135. queryParam.value.wardCode = res[0].code
  136. queryInfo()
  137. })
  138. queryZyWard().then((res:any)=>{
  139. zkWard.value = res
  140. })
  141. })
  142. const selectionLeftData = ref({})
  143. // 选择在院列表数据
  144. const selectZkPatient = (row,index)=>{
  145. selectionLeftData.value = row
  146. }
  147. const selectionRightData = ref({})
  148. // 取消需要转科的人
  149. const cancelZkPatient =(row)=>{
  150. selectionRightData.value = row
  151. }
  152. const wardChange = ()=>{
  153. if(dZkPatientList.value.length > 0){
  154. queryZkBedVo({wardCode:selectionZkWard.value.code}).then((res:any)=>{
  155. dZkPatientList.value = res
  156. })
  157. }
  158. tempSelectionLeftData.value = []
  159. queryInfo()
  160. }
  161. const queryInfo =()=>{
  162. queryZkPatient(queryParam.value).then((res:any)=>{
  163. zyPatientList.value = res
  164. })
  165. }
  166. const saveData = () => {
  167. let param = dZkPatientList.value.filter(item => !stringIsBlank(item.inpatientNo))
  168. saveZkData(param).then((res: any) => {
  169. createPatientDoor(param).then((res:any)=>{})
  170. wardChange()
  171. })
  172. }
  173. const selectionZkWard = ref({})
  174. const fetchZkWard = (row)=>{
  175. selectionZkWard.value= row
  176. queryParam.value.zkWardCode = row.name
  177. visible.value = false
  178. queryParam.value.smallWardCode = ''
  179. querySmallWard({code:row.dept_code}).then((res:any)=>{
  180. smallWard.value = res
  181. })
  182. queryZkBedVo({wardCode:row.code}).then((res:any)=>{
  183. dZkPatientList.value = res
  184. })
  185. }
  186. const addRight = ()=>{
  187. if(stringIsBlank(queryParam.value.wardCode)){
  188. ElMessage.error('请选择病室')
  189. return
  190. }
  191. if(stringIsBlank(queryParam.value.zkWardCode)){
  192. ElMessage.error('请选择转科病房')
  193. return
  194. }
  195. if(stringIsBlank(queryParam.value.smallWardCode)){
  196. ElMessage.error('请选择小科室')
  197. return
  198. }
  199. if(queryParam.value.smallWardCode == selectionLeftData.value.zkWard){
  200. ElMessage.error('原科室不能与转科室相同')
  201. return
  202. }
  203. ElMessageBox.confirm(
  204. `确定将病人:${selectionLeftData.value.name}值为转科状态吗?`,
  205. '',
  206. {
  207. distinguishCancelAndClose: true,
  208. confirmButtonText: '确定',
  209. cancelButtonText: '取消',
  210. }
  211. )
  212. .then(() => {
  213. let param = {
  214. inpatientNo : selectionLeftData.value.inpatientNo,
  215. admissTimes : selectionLeftData.value.admissTimes,
  216. wardCode : selectionLeftData.value.ward,
  217. zkDept : queryParam.value.smallWardCode,
  218. deptCode: selectionZkWard.value.code,
  219. }
  220. checkZk(param).then((res:any)=>{
  221. // 没有就添加
  222. if(tempSelectionLeftData.value.findIndex(item=>item.inpatientNo==selectionLeftData.value.inpatientNo)==-1){
  223. tempSelectionLeftData.value.push(selectionLeftData.value)
  224. }
  225. let index = dZkPatientList.value.findIndex(item=>stringIsBlank(item.inpatientNo))
  226. zyPatientList.value.splice(zyPatientList.value.findIndex(item=>item.inpatientNo==selectionLeftData.value.inpatientNo),1)
  227. dZkPatientList.value[index].inpatientNo= selectionLeftData.value.inpatientNo
  228. dZkPatientList.value[index].name= selectionLeftData.value.name
  229. dZkPatientList.value[index].admissTimes= selectionLeftData.value.admissTimes
  230. dZkPatientList.value[index].origDept= selectionLeftData.value.ward
  231. dZkPatientList.value[index].origWard= selectionLeftData.value.zkWard
  232. dZkPatientList.value[index].origBed= selectionLeftData.value.bedNo
  233. dZkPatientList.value[index].consultPhysician= selectionLeftData.value.consultPhysician
  234. dZkPatientList.value[index].deptDirector= selectionLeftData.value.deptDirector
  235. dZkPatientList.value[index].referPhysician= selectionLeftData.value.referPhysician
  236. dZkPatientList.value[index].zkDept= queryParam.value.smallWardCode
  237. })
  238. })
  239. }
  240. // 左边选择的数据用于取消转科的数据
  241. const tempSelectionLeftData = ref([])
  242. const addLeft=()=>{
  243. if(stringIsBlank(selectionRightData.value.inpatientNo)){
  244. ElMessage.error('选择的数据不能为空')
  245. return
  246. }
  247. let temp = tempSelectionLeftData.value[tempSelectionLeftData.value.findIndex(item=>item.inpatientNo==selectionRightData.value.inpatientNo)]
  248. clearDZkPatientList(dZkPatientList.value.findIndex(item=>item.inpatientNo==selectionRightData.value.inpatientNo))
  249. zyPatientList.value.splice(0,0,temp)
  250. zyPatientList.value.sort(function (a, b) {
  251. let aBedNo = Number(a.bedNo) ? Number(a.bedNo) :100000
  252. let bBedNo = Number(b.bedNo) ? Number(b.bedNo) :100000
  253. if(aBedNo >= bBedNo){
  254. return 1
  255. }
  256. return -1
  257. })
  258. }
  259. // 取消清空左边的数据
  260. function clearDZkPatientList(index){
  261. dZkPatientList.value[index].inpatientNo= ''
  262. dZkPatientList.value[index].name= ''
  263. dZkPatientList.value[index].admissTimes= null
  264. dZkPatientList.value[index].origDept= ''
  265. dZkPatientList.value[index].origWard= ''
  266. dZkPatientList.value[index].origBed= ''
  267. dZkPatientList.value[index].consultPhysician= ''
  268. dZkPatientList.value[index].deptDirector= ''
  269. dZkPatientList.value[index].referPhysician= ''
  270. dZkPatientList.value[index].zkDept= ''
  271. }
  272. const divStyle = ref<any>({
  273. width:'100%',
  274. height:(windowHeight-70)+'px',
  275. display: 'flex'
  276. })
  277. const centerDive = ref<any>({
  278. width:'8%',
  279. padding:`${windowHeight/2-70}px 0`
  280. })
  281. </script>
  282. <style scoped lang="scss">
  283. .dsd{
  284. border: 1px red solid;
  285. display: flex;
  286. text-align: center;
  287. }
  288. .centerClass{
  289. text-align: center;
  290. }
  291. </style>