search.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. <template>
  2. <view class="search">
  3. <view class="search-box">
  4. <seiminSearch class="mSearch-input-box" :mode="2" button="inside" placeholder="请输入标本编码/检查单号/患者编码"
  5. @input="debounceInp" v-model="keyword" ref="search"></seiminSearch>
  6. </view>
  7. <view class="search-keyword">
  8. <!-- 患者 -->
  9. <view class="head" v-if="searchList.patientList.length">患者</view>
  10. <view class="orderList_listItem" v-for="search in searchList.patientList" :key="search.id"
  11. @click="toDetail(search,'patient')">
  12. <view class="orderList_listItem_header">
  13. <view class="orderList_listItem_header_title">
  14. <block v-if="search.illnessState">
  15. <view class="associationType_icon red" v-if="search.illnessState.value === '2'">危</view>
  16. <view class="associationType_icon red" v-else-if="search.illnessState.value === '3'">重</view>
  17. </block>
  18. <block v-if="search.careLevel">
  19. <view class="associationType_icon red" v-if="search.careLevel.value === '0'">特</view>
  20. <view class="associationType_icon red" v-else-if="search.careLevel.value === '1'">1</view>
  21. <view class="associationType_icon green" v-else-if="search.careLevel.value === '2'">2</view>
  22. <view class="associationType_icon green" v-else-if="search.careLevel.value === '3'">3</view>
  23. </block>
  24. <view class="taskNameAndWorkerName">
  25. <text class="workerName">{{search.patientName || '暂无'}}</text>
  26. </view>
  27. </view>
  28. <text class="orderList_listItem_header_more">{{search.bedNum }}床</text>
  29. </view>
  30. <view class="orderList_listItem_item">
  31. <view class="orderList_listItem_item_content">
  32. <text class="orderList_listItem_item_name">{{search.residenceNo || '暂无'}}</text>
  33. <text class="orderList_listItem_item_time">待检{{search.watingCount}}</text>
  34. </view>
  35. </view>
  36. </view>
  37. <!-- 标本 -->
  38. <view class="head" v-if="searchList.specimenList.length">标本</view>
  39. <view class="orderList_listItem" v-for="search in searchList.specimenList" :key="search.id"
  40. @click="toDetail(search,'specimen')">
  41. <view class="orderList_listItem_header">
  42. <view class="orderList_listItem_header_title">
  43. <view class="taskNameAndWorkerName">
  44. <text class="workerName">{{search.specimenDesc || '暂无'}}</text>
  45. </view>
  46. </view>
  47. <text class="orderList_listItem_header_more">{{search.scode || '暂无' }}</text>
  48. </view>
  49. <view class="orderList_listItem_item">
  50. <view class="orderList_listItem_item_content">
  51. <text class="orderList_listItem_item_name">{{search.patientName || '暂无'}}
  52. <block v-if="search.bedNum">({{search.bedNum}}床)</block>
  53. </text>
  54. <text class="orderList_listItem_item_time">{{search.speState?search.speState.name:'暂无'}}</text>
  55. </view>
  56. </view>
  57. </view>
  58. <!-- 检查 -->
  59. <view class="head" v-if="searchList.inspectList.length">检查</view>
  60. <view class="orderList_listItem" v-for="search in searchList.inspectList" :key="search.id"
  61. @click="toDetail(search,'inspect')">
  62. <view class="orderList_listItem_header">
  63. <view class="orderList_listItem_header_title">
  64. <view class="taskNameAndWorkerName">
  65. <text class="workerName">{{search.inspectName || '暂无'}}</text>
  66. </view>
  67. </view>
  68. <text class="orderList_listItem_header_more">{{search.bedNum }}床</text>
  69. </view>
  70. <view class="orderList_listItem_item">
  71. <view class="orderList_listItem_item_content no">
  72. <view class="no_item">
  73. <text class="orderList_listItem_item_name">{{search.inspectCode || '暂无'}}</text>
  74. <text class="orderList_listItem_item_time"></text>
  75. </view>
  76. <view class="no_item">
  77. <text class="orderList_listItem_item_name">{{search.patientName || '暂无'}}
  78. <block v-if="search.bedNum">({{search.bedNum}}床)</block>
  79. </text>
  80. <text class="orderList_listItem_item_time">{{search.yyTime||'暂无'}}</text>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. </view>
  86. <seiminFooterBtn :btns="btns"></seiminFooterBtn>
  87. <seiminModel ref="seiminModel"></seiminModel>
  88. </view>
  89. </template>
  90. <script>
  91. import {
  92. backPress,
  93. } from '../../utils/index.js';
  94. import {
  95. debounce
  96. } from 'lodash/function';
  97. import {
  98. reqSmartScan,
  99. } from "../../request/api.js";
  100. import {
  101. mapState,
  102. mapMutations,
  103. } from "vuex";
  104. import {
  105. ASSOCIATION_TYPES
  106. } from '../../utils/enum.association_types.js';
  107. export default {
  108. onBackPress() {
  109. backPress();
  110. },
  111. data() {
  112. return {
  113. reFresh: '',
  114. queryParams: {}, //路由参数
  115. ASSOCIATION_TYPES,
  116. checkedShowMsg: {}, //当前选中的任务类型的buildtrip信息
  117. selectedPatient: {}, //当前选中的患者
  118. taskTypeListResource: [], //任务类型列表(请求的原始数据)
  119. taskTypeList: [], //任务类型列表
  120. pickerTitle: "", //一键建单picker的title
  121. debounceInp: null,
  122. keyword: "",
  123. searchList: {
  124. patientList: [],
  125. specimenList: [],
  126. inspectList: [],
  127. },
  128. //底部按钮
  129. btns: [{
  130. name: "返回首页",
  131. type: "default",
  132. click: () => {
  133. uni.navigateTo({
  134. url: '/pages/index/index'
  135. })
  136. },
  137. }],
  138. };
  139. },
  140. computed: {
  141. ...mapState("login", ["loginInfo"]),
  142. ...mapState('other', ["deptDisplay"]),
  143. },
  144. methods: {
  145. ...mapMutations('other', ['changeQucikCreateOrderType', 'clearPatientBuildData', 'changePatientBuildData']),
  146. // 跳转患者详情
  147. toDetail(search, type) {
  148. switch (type) {
  149. case 'patient':
  150. uni.navigateTo({
  151. url: `/pages/patientDetail/patientDetail?patientCode=${search.patientCode}&patientName=${search.patientName}`
  152. })
  153. break;
  154. case 'specimen':
  155. uni.navigateTo({
  156. url: `/pages/detail/detail?id=${search.id}&associationType=specimen&scode=${search.scode}`
  157. })
  158. break;
  159. case 'inspect':
  160. uni.navigateTo({
  161. url: `/pages/detail/detail?id=${search.id}&associationType=inspect`
  162. })
  163. break;
  164. }
  165. },
  166. //监听输入
  167. inputChange(event = '') {
  168. let keyWord = event.detail ? event.detail.value : event;
  169. // 长度小于等于0,返回空数组
  170. // 长度小于等于4,只搜索床号
  171. // 长度大于4,搜索患者住院号,患者二维码,标本码,检查单号
  172. if (!keyWord.length) {
  173. this.searchList = {
  174. patientList: [],
  175. specimenList: [],
  176. inspectList: [],
  177. }
  178. return;
  179. }
  180. let postData = {
  181. deptId: this.loginInfo.user.dept.id,
  182. code: keyWord
  183. };
  184. uni.showLoading({
  185. title: "加载中",
  186. });
  187. reqSmartScan(postData).then((res) => {
  188. uni.hideLoading();
  189. uni.stopPullDownRefresh();
  190. if (res.state == 200) {
  191. Object.assign(this.searchList, res.data);
  192. console.log(this.searchList)
  193. } else {
  194. this.$refs.seiminModel.show({
  195. skin: "toast",
  196. icon: "error",
  197. content: res.msg || "获取数据失败",
  198. });
  199. throw new Error(res.msg || "获取数据失败");
  200. }
  201. });
  202. },
  203. },
  204. onReachBottom() {
  205. this.reachBottom();
  206. },
  207. onPullDownRefresh() {
  208. this.inputChange(this.keyword)
  209. },
  210. created() {
  211. this.debounceInp = debounce(this.inputChange, 500);
  212. },
  213. beforeDestroy() {
  214. this.debounceInp.cancel()
  215. },
  216. onLoad(queryParams) {
  217. this.queryParams = queryParams;
  218. this.keyword = queryParams.txt;
  219. this.inputChange(queryParams.txt);
  220. },
  221. mounted() {
  222. this.$refs.search.inputVal = this.queryParams.txt;
  223. }
  224. };
  225. </script>
  226. <style lang="scss" scoped>
  227. .search {
  228. padding-bottom: 108rpx;
  229. .search-box {
  230. background-color: rgb(242, 242, 242);
  231. padding: 15rpx 2.5%;
  232. position: fixed;
  233. z-index: 99;
  234. width: 100%;
  235. @include flex(space-between);
  236. .mSearch-input-box {
  237. width: 100%;
  238. }
  239. .input-box {
  240. width: 85%;
  241. flex-shrink: 1;
  242. @include flex(center, center);
  243. &>input {
  244. width: 100%;
  245. height: 60rpx;
  246. font-size: 32rpx;
  247. border: 0;
  248. border-radius: 60rpx;
  249. appearance: none;
  250. padding: 0 3%;
  251. margin: 0;
  252. background-color: #ffffff;
  253. }
  254. }
  255. .search-btn {
  256. width: 15%;
  257. margin: 0 0 0 2%;
  258. flex-shrink: 0;
  259. font-size: 28rpx;
  260. color: #fff;
  261. background: linear-gradient(to right, #ff9801, #ff570a);
  262. border-radius: 60rpx;
  263. @include flex(center, center);
  264. }
  265. }
  266. .search-keyword {
  267. padding: 88rpx 24rpx 0;
  268. .head {
  269. font-weight: bold;
  270. }
  271. // 列表项
  272. .orderList_listItem {
  273. width: 702rpx;
  274. min-height: 232rpx;
  275. background-color: #fff;
  276. position: relative;
  277. margin-top: 8rpx;
  278. border-radius: 8rpx;
  279. padding: 0 24rpx;
  280. font-size: 32rpx;
  281. @include border;
  282. @include semicircle(#F9FAFB, 82rpx);
  283. @include flex(flex-start, stretch, column);
  284. .orderList_listItem_header {
  285. height: 86rpx;
  286. @include border($directive:bottom, $style:dashed);
  287. @include flex(space-between, center);
  288. .orderList_listItem_header_title {
  289. color: #333;
  290. flex: 1;
  291. @include flex(flex-start, center);
  292. .associationType_icon {
  293. width: 48rpx;
  294. height: 48rpx;
  295. border-radius: 50%;
  296. font-size: 24rpx;
  297. margin-right: 8rpx;
  298. @include border($color:#39b199);
  299. @include flex(center, center);
  300. &.green {
  301. color: $defaultColor;
  302. border: 1px solid $defaultColor;
  303. background-color: rgba(73, 184, 86, 0.1);
  304. }
  305. &.red {
  306. color: #FF3B53;
  307. border: 1px solid #FF3B53;
  308. background-color: #FFE8EB;
  309. }
  310. }
  311. .taskNameAndWorkerName {
  312. flex: 1;
  313. @include flex;
  314. .taskName {
  315. max-width: 10em;
  316. @include clamp;
  317. }
  318. .workerName {
  319. flex: 1;
  320. @include clamp;
  321. }
  322. }
  323. }
  324. .orderList_listItem_header_more {
  325. color: #333;
  326. font-weight: bold;
  327. @include clamp;
  328. }
  329. }
  330. .orderList_listItem_item {
  331. height: 88rpx;
  332. color: #333;
  333. font-size: 30rpx;
  334. flex: 1;
  335. @include border(bottom);
  336. @include flex(flex-start, stretch, column);
  337. &:last-of-type {
  338. border-bottom: none;
  339. }
  340. .orderList_listItem_item_content {
  341. min-height: 143rpx;
  342. flex: 1;
  343. @include flex(space-between, center);
  344. &.no {
  345. @include flex($flexDirection: column);
  346. .no_item {
  347. flex: 1;
  348. @include flex(space-between, center);
  349. }
  350. }
  351. .orderList_listItem_item_name {
  352. font-size: 34rpx;
  353. }
  354. .orderList_listItem_item_time {
  355. color: #333;
  356. font-size: 34rpx;
  357. font-weight: bold;
  358. }
  359. }
  360. }
  361. }
  362. }
  363. }
  364. </style>