search.vue 12 KB

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