patientList.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  1. <template>
  2. <view class="patientList">
  3. <view class="search-box">
  4. <seiminSearch class="mSearch-input-box" :mode="2" button="inside" placeholder="输入床号或姓名支持拼音检索" @input="debounceInp"
  5. v-model="keyword"></seiminSearch>
  6. </view>
  7. <view class="search-keyword">
  8. <view class="orderList_listItem" v-for="patient in patientList" :key="patient.id">
  9. <view class="orderList_listItem_header">
  10. <view class="orderList_listItem_header_title">
  11. <block v-if="patient.illnessState">
  12. <view class="associationType_icon red" v-if="patient.illnessState.value === '2'">危</view>
  13. <view class="associationType_icon red" v-else-if="patient.illnessState.value === '3'">重</view>
  14. </block>
  15. <block v-if="patient.careLevel">
  16. <view class="associationType_icon red" v-if="patient.careLevel.value === '0'">特</view>
  17. <view class="associationType_icon red" v-else-if="patient.careLevel.value === '1'">1</view>
  18. <view class="associationType_icon green" v-else-if="patient.careLevel.value === '2'">2</view>
  19. <view class="associationType_icon green" v-else-if="patient.careLevel.value === '3'">3</view>
  20. </block>
  21. <view class="taskNameAndWorkerName">
  22. <text class="workerName">{{patient.patientName || '暂无'}}</text>
  23. </view>
  24. </view>
  25. <text class="orderList_listItem_header_more">{{patient.bedNum }}床</text>
  26. </view>
  27. <view class="orderList_listItem_item">
  28. <view class="orderList_listItem_item_content">
  29. <text class="orderList_listItem_item_name">{{patient.residenceNo || '暂无'}}</text>
  30. <text class="orderList_listItem_item_time">待检{{patient.watingCount}}</text>
  31. </view>
  32. <view class="orderList_listItem_item_btns">
  33. <button type="primary" class="btn" @click.stop="toDetail(patient.patientCode)">患者详情</button>
  34. <button type="primary" class="btn" @click.stop="buildOrder(patient)">一键建单</button>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. <seiminFooterNav></seiminFooterNav>
  40. <seiminModel ref="seiminModel"></seiminModel>
  41. <seiminPicker ref="sPicker" :title="pickerTitle" titleColor="#808080" titleFontSize="28rpx" confirmColor="#333"
  42. confirmFontSize="38rpx" confirmFontWeight="500" itemFontSize="28rpx" @onClose="closePicker"
  43. @onConfirm="confirmPicker" :pickerList="taskTypeList">
  44. </seiminPicker>
  45. </view>
  46. </template>
  47. <script>
  48. import {
  49. debounce
  50. } from 'lodash/function';
  51. import {
  52. reqFetchDataList,
  53. reqDeptTSPTaskType,
  54. reqBuildTrip,
  55. } from "../../request/api.js";
  56. import {
  57. mapState,
  58. mapMutations,
  59. } from "vuex";
  60. import {
  61. ASSOCIATION_TYPES
  62. } from '../../utils/enum.association_types.js';
  63. export default {
  64. data() {
  65. return {
  66. ASSOCIATION_TYPES,
  67. checkedShowMsg: {}, //当前选中的任务类型的buildtrip信息
  68. selectedPatient: {}, //当前选中的患者
  69. taskTypeListResource: [], //任务类型列表(请求的原始数据)
  70. taskTypeList: [], //任务类型列表
  71. pickerTitle: "", //一键建单picker的title
  72. debounceInp: null,
  73. keyword: "",
  74. patientList: [],
  75. totalNum: 0, //工单总数量
  76. idx: 0, //页码
  77. };
  78. },
  79. computed: {
  80. ...mapState("login", ["loginInfo"]),
  81. ...mapState('other', ["deptDisplay"]),
  82. },
  83. methods: {
  84. ...mapMutations('other', ['changeQucikCreateOrderType']),
  85. //关闭
  86. closePicker() {
  87. this.$refs.sPicker._close();
  88. },
  89. //打开
  90. openPicker() {
  91. this.$refs.sPicker._open();
  92. },
  93. //确定:接收子组件传来的参数
  94. confirmPicker(checkedObj) {
  95. console.log(checkedObj);
  96. // 2,获取buildTrip信息
  97. let postData = {
  98. "taskTypeId": checkedObj.value,
  99. "patientCode": this.selectedPatient.patientCode
  100. };
  101. uni.showLoading({
  102. mask: true,
  103. title: '加载中'
  104. })
  105. reqBuildTrip(postData).then(res => {
  106. uni.hideLoading();
  107. let taskType = this.taskTypeListResource.find(v => v.id == checkedObj.value);
  108. let patientTaskType = taskType || {};
  109. if (patientTaskType.associationType.value == this.ASSOCIATION_TYPES['患者其他服务业务']) {
  110. // 患者其他服务业务--无法用status判断,运输过程“默认患者所在科室”没有返回status==200,估计是后端漏掉了这种情况,如果后期后端可以返回status,则可以根据status判断。
  111. if (res.start && res.end) {
  112. if (res.status == 100013 || res.status == 100014 || res.status == 100015) {
  113. this.checkedShowMsg = res.data;
  114. //需要选择起点科室和目标科室
  115. this.changeQucikCreateOrderType({
  116. type: "patient",
  117. taskTypeId: checkedObj.value,
  118. patientTaskType,
  119. selectedPatient: this.selectedPatient,
  120. patientBuildTrip: res,
  121. });
  122. uni.navigateTo({
  123. url: "/pages/quickCreateOrder/quickCreateOrder",
  124. });
  125. } else {
  126. //无需选择科室
  127. this.checkedShowMsg = res.data;
  128. this.changeQucikCreateOrderType({
  129. type: "patient",
  130. taskTypeId: checkedObj.value,
  131. patientTaskType,
  132. selectedPatient: this.selectedPatient,
  133. patientBuildTrip: res,
  134. });
  135. uni.navigateTo({
  136. url: "/pages/patientBuild/patientBuild",
  137. });
  138. }
  139. } else {
  140. this.$refs.seiminModel.show({
  141. skin: "toast",
  142. icon: "error",
  143. content: res.msg || "获取数据失败",
  144. });
  145. throw new Error(res.msg || '获取数据失败');
  146. }
  147. } else if (patientTaskType.associationType.value == this.ASSOCIATION_TYPES['患者陪检业务']) {
  148. // 患者陪检业务
  149. if (res.status == 200) {
  150. this.checkedShowMsg = res.data;
  151. this.changeQucikCreateOrderType({
  152. type: "patient",
  153. taskTypeId: checkedObj.value,
  154. patientTaskType,
  155. selectedPatient: this.selectedPatient,
  156. patientBuildTrip: res,
  157. });
  158. uni.navigateTo({
  159. url: "/pages/appointmentInspect/appointmentInspect",
  160. });
  161. } else {
  162. this.$refs.seiminModel.show({
  163. skin: "toast",
  164. icon: "error",
  165. content: res.msg || "获取数据失败",
  166. });
  167. throw new Error(res.msg || '获取数据失败');
  168. }
  169. }
  170. })
  171. },
  172. // 一键建单
  173. buildOrder(patient) {
  174. this.selectedPatient = patient;
  175. // 1,请求任务类型列表
  176. uni.showLoading({
  177. mask: true,
  178. title: '加载中'
  179. })
  180. reqDeptTSPTaskType().then(res => {
  181. uni.hideLoading();
  182. if (res.status == 200) {
  183. res.data = res.data || [];
  184. this.taskTypeListResource = res.data;
  185. this.taskTypeList = res.data.map((v) => ({
  186. value: v.id,
  187. label: v.taskName,
  188. }));
  189. this.pickerTitle = `您选择了<b class="green">${patient.patientName}</b>患者,请选择下方具体服务项`;
  190. this.openPicker();
  191. } else {
  192. this.$refs.seiminModel.show({
  193. skin: "toast",
  194. icon: "error",
  195. content: res.msg || "获取数据失败",
  196. });
  197. throw new Error(res.msg || "获取数据失败");
  198. }
  199. })
  200. },
  201. // 跳转患者详情
  202. toDetail(patientCode) {
  203. uni.navigateTo({
  204. url: `/pages/patientDetail/patientDetail?patientCode=${patientCode}`
  205. })
  206. },
  207. //监听输入
  208. inputChange(event = '', idxPlus = false) {
  209. let keyWord = event.detail ? event.detail.value : event;
  210. if (idxPlus) {
  211. //累加
  212. ++this.idx;
  213. } else {
  214. this.idx = 0;
  215. }
  216. let postData = {
  217. "idx": this.idx,
  218. "sum": 9999,
  219. "patient": {
  220. keyWord,
  221. "department": {
  222. "id": this.loginInfo.user.dept.id
  223. }
  224. }
  225. };
  226. uni.showLoading({
  227. title: "加载中",
  228. mask: true,
  229. });
  230. reqFetchDataList("nurse", "patient", postData).then((res) => {
  231. uni.hideLoading();
  232. if (res.status == 200) {
  233. res.list = res.list || [];
  234. if (idxPlus) {
  235. //累加
  236. this.patientList = this.patientList.concat(res.list);
  237. } else {
  238. this.patientList = res.list;
  239. }
  240. this.totalNum = res.totalNum || 0;
  241. } else {
  242. this.$refs.seiminModel.show({
  243. skin: "toast",
  244. icon: "error",
  245. content: res.msg || "获取数据失败",
  246. });
  247. throw new Error(res.msg || "获取数据失败");
  248. }
  249. });
  250. },
  251. // 查询最新列表(上拉)
  252. reachBottom() {
  253. //没有更多
  254. if (this.patientList.length == this.totalNum) {
  255. uni.showToast({
  256. icon: 'none',
  257. title: '没有更多数据了'
  258. })
  259. return;
  260. }
  261. this.inputChange(this.keyword, true);
  262. },
  263. },
  264. onReachBottom() {
  265. this.reachBottom();
  266. },
  267. created() {
  268. this.debounceInp = debounce(this.inputChange, 500);
  269. },
  270. beforeDestroy() {
  271. this.debounceInp.cancel()
  272. },
  273. onLoad() {
  274. this.inputChange('');
  275. },
  276. };
  277. </script>
  278. <style lang="scss" scoped>
  279. .patientList {
  280. padding-bottom: 108rpx;
  281. .search-box {
  282. background-color: rgb(242, 242, 242);
  283. padding: 15rpx 2.5%;
  284. position: fixed;
  285. z-index: 99;
  286. width: 100%;
  287. @include flex(space-between);
  288. .mSearch-input-box {
  289. width: 100%;
  290. }
  291. .input-box {
  292. width: 85%;
  293. flex-shrink: 1;
  294. @include flex(center, center);
  295. &>input {
  296. width: 100%;
  297. height: 60rpx;
  298. font-size: 32rpx;
  299. border: 0;
  300. border-radius: 60rpx;
  301. appearance: none;
  302. padding: 0 3%;
  303. margin: 0;
  304. background-color: #ffffff;
  305. }
  306. }
  307. .search-btn {
  308. width: 15%;
  309. margin: 0 0 0 2%;
  310. flex-shrink: 0;
  311. font-size: 28rpx;
  312. color: #fff;
  313. background: linear-gradient(to right, #ff9801, #ff570a);
  314. border-radius: 60rpx;
  315. @include flex(center, center);
  316. }
  317. }
  318. .search-keyword {
  319. padding: 88rpx 24rpx 0;
  320. // 列表项
  321. .orderList_listItem {
  322. width: 702rpx;
  323. min-height: 320rpx;
  324. background-color: #fff;
  325. position: relative;
  326. margin-top: 8rpx;
  327. border-radius: 8rpx;
  328. padding: 0 24rpx;
  329. font-size: 32rpx;
  330. @include border;
  331. @include semicircle(#F9FAFB, 82rpx);
  332. @include flex(flex-start, stretch, column);
  333. .orderList_listItem_header {
  334. height: 86rpx;
  335. @include border($directive:bottom, $style:dashed);
  336. @include flex(space-between, center);
  337. .orderList_listItem_header_title {
  338. color: #333;
  339. flex: 1;
  340. @include flex(flex-start, center);
  341. .associationType_icon {
  342. width: 48rpx;
  343. height: 48rpx;
  344. border-radius: 50%;
  345. font-size: 24rpx;
  346. margin-right: 8rpx;
  347. @include border($color:#39b199);
  348. @include flex(center, center);
  349. &.green {
  350. color: $defaultColor;
  351. border: 1px solid $defaultColor;
  352. background-color: rgba(73, 184, 86, 0.1);
  353. }
  354. &.red {
  355. color: #FF3B53;
  356. border: 1px solid #FF3B53;
  357. background-color: #FFE8EB;
  358. }
  359. }
  360. .taskNameAndWorkerName {
  361. flex: 1;
  362. @include flex;
  363. .taskName {
  364. max-width: 10em;
  365. @include clamp;
  366. }
  367. .workerName {
  368. flex: 1;
  369. @include clamp;
  370. }
  371. }
  372. }
  373. .orderList_listItem_header_more {
  374. color: #333;
  375. font-weight: bold;
  376. @include clamp;
  377. }
  378. }
  379. .orderList_listItem_item {
  380. height: 88rpx;
  381. color: #333;
  382. font-size: 30rpx;
  383. flex: 1;
  384. @include border(bottom);
  385. @include flex(flex-start, stretch, column);
  386. &:last-of-type {
  387. border-bottom: none;
  388. }
  389. .orderList_listItem_item_content {
  390. min-height: 143rpx;
  391. flex: 1;
  392. @include flex(space-between, center);
  393. .orderList_listItem_item_name {
  394. font-size: 34rpx;
  395. }
  396. .orderList_listItem_item_time {
  397. color: #333;
  398. font-size: 34rpx;
  399. font-weight: bold;
  400. }
  401. }
  402. .orderList_listItem_item_btns {
  403. position: relative;
  404. left: -24rpx;
  405. width: 698rpx;
  406. height: 88rpx;
  407. @include btn_background;
  408. @include flex;
  409. .btn {
  410. flex: 1;
  411. background-color: transparent;
  412. position: relative;
  413. @include flex(center, center);
  414. &::before {
  415. content: '';
  416. position: absolute;
  417. right: 0;
  418. top: 0;
  419. width: 1px;
  420. height: 100%;
  421. @include border(right, #fff);
  422. }
  423. &:last-of-type::before {
  424. border-right: none;
  425. }
  426. &::after {
  427. border: none;
  428. }
  429. }
  430. }
  431. }
  432. }
  433. }
  434. }
  435. </style>