scan.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  1. <template>
  2. <view class="content">
  3. <view class="info">
  4. <view class="header">
  5. <view class="title" :class="list.length < infoData.specimenNum?'par-top1':'par-top2'">{{list.length}}/{{infoData.specimenNum}}</view>
  6. <view class="tip" v-if="list.length < infoData.specimenNum">请继续扫描标本!</view>
  7. </view>
  8. <view>
  9. <view class="list" v-for="(item, index) in list" :key="index">
  10. <view class="df-list">
  11. <view class="list-title">标本名称:</view>
  12. <view class="no-center">{{item.specimenName}}</view>
  13. </view>
  14. <view class="df-list">
  15. <view class="list-title">条码号:</view>
  16. <view class="no-center">{{item.specimenCode}}</view>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="list list-top" v-if="infoData">
  21. <view class="df-list">
  22. <view class="list-title">患者姓名:</view>
  23. <view class="no-center">{{infoData.patientName}}({{infoData.patientDTO.bedNum}}床)</view>
  24. </view>
  25. <view class="df-list">
  26. <view class="list-title">住院号:</view>
  27. <view class="no-center">{{infoData.patientDTO.barCode}}</view>
  28. </view>
  29. <view class="df-list">
  30. <view class="list-title">科室名称:</view>
  31. <view class="no-center">{{infoData.patientDTO.department.dept}}</view>
  32. </view>
  33. <view class="df-list">
  34. <view class="list-title">申请单号:</view>
  35. <view class="no-center">{{infoData.applyCode}}</view>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="btn-view" v-if="list.length < infoData.specimenNum">
  40. <button class="back-btn" @click="back">返回</button>
  41. </view>
  42. <view class="btn-view df-sb" v-if="list.length == infoData.specimenNum">
  43. <button class="back-btn2" @click="back">返回</button>
  44. <button class="back-btn3" @click="fixation">标本固定存放</button>
  45. </view>
  46. <!-- PDA扫描 -->
  47. <scanner></scanner>
  48. <!-- 标本固定 -->
  49. <uni-popup ref="popup" type="dialog" background-color="#fff" :mask-click="false">
  50. <view class="pop-content">
  51. <view class="pop-title">提示</view>
  52. <view class="pop-tip">您标本已扫描完成,请填写固定信息。</view>
  53. <uni-forms ref="baseForm" :model="form" label-width="110px">
  54. <uni-forms-item label="工号" required>
  55. <uni-easyinput v-model="form.code" :clearable="false" @input="inputChange" primaryColor='#49b856' placeholder="请输入工号" />
  56. </uni-forms-item>
  57. <uni-forms-item label="姓名" required>
  58. <view class="text-left">{{form.name}}</view>
  59. </uni-forms-item>
  60. <uni-forms-item label="固体液类型" required class="select">
  61. <uni-data-picker placeholder="请选择固体液类型" :clear-icon="false" :localdata="fixedData" v-model="form.fixative"
  62. :map="{text:'name',value:'id'}">
  63. </uni-data-picker>
  64. </uni-forms-item>
  65. <uni-forms-item label="固定时间" required class="time">
  66. <uni-datetime-picker type="datetime" :clear-icon="false" placeholder="请选择固定时间" v-model="form.fixationTime"/>
  67. </uni-forms-item>
  68. </uni-forms>
  69. <view class="pou-btn">
  70. <view class="btn border-right" @click="fixationClose">取消</view>
  71. <view class="btn confirm" @click="dialogConfirm">固定标本</view>
  72. </view>
  73. </view>
  74. </uni-popup>
  75. </view>
  76. </template>
  77. <script>
  78. import {
  79. get,
  80. post
  81. } from "../../http/http.js";
  82. import scanner from "../../components/scanner/scanner.vue";
  83. export default {
  84. data(){
  85. return{
  86. infoData:null,
  87. list:[],
  88. SMFlag:true,
  89. fixationModal:false,
  90. fixedData:[],
  91. styles:{
  92. borderColor: '#49b856',
  93. },
  94. userInfo:uni.getStorageSync('userData').user,
  95. hosId: uni.getStorageSync('userData').user.currentHospital.id,
  96. form:{
  97. name:'',
  98. code:'',
  99. fixationTime:'',
  100. fixative:'',
  101. handoverUserId:''
  102. },
  103. pathologyFormId:null
  104. }
  105. },
  106. components: {
  107. scanner
  108. },
  109. methods:{
  110. // 时间格式化
  111. yyTimeFilter(timestamp) {
  112. var date = new Date(timestamp); // 时间戳为毫秒级别
  113. var year = date.getFullYear();
  114. var month = date.getMonth() + 1;
  115. var day = date.getDate();
  116. var hours = date.getHours();
  117. var minutes = date.getMinutes();
  118. var seconds = date.getSeconds();
  119. // 格式化月份、日期、小时、分钟、秒
  120. month = month < 10 ? '0' + month : month;
  121. day = day < 10 ? '0' + day : day;
  122. hours = hours < 10 ? '0' + hours : hours;
  123. minutes = minutes < 10 ? '0' + minutes : minutes;
  124. seconds = seconds < 10 ? '0' + seconds : seconds;
  125. return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  126. },
  127. inputChange(e){
  128. console.log(e)
  129. if(e.length < 3) {
  130. return
  131. }
  132. let query = {
  133. account: e
  134. };
  135. post('/data/isRepeat',query).then((data) => {
  136. if(data.status==200){
  137. this.form.name = data.userName;
  138. this.form.handoverUserId = data.userId
  139. }else{
  140. this.form.name = '';
  141. this.form.handoverUserId =null
  142. }
  143. });
  144. },
  145. back(){
  146. // this.padChange('86386627710976\n')
  147. uni.setStorageSync('pathologyFormId', null)
  148. uni.navigateTo({
  149. url: `/pages/specimenPort/specimenPort?backType=detail`
  150. });
  151. },
  152. // 标本固定
  153. fixation(){
  154. this.form={
  155. name:'',
  156. code:'',
  157. fixationTime: Date.now() - 2*24*1000,
  158. fixative:this.fixedData[0].id,
  159. handoverUserId:''
  160. }
  161. // this.form.fixationTime = Date.now() - 2*24*1000
  162. this.$refs.popup.open()
  163. },
  164. // 获取固定液类型
  165. getFixation(){
  166. post('/common/common/getDictionary', {
  167. key: "fixing_liquid_type",
  168. type: "list"
  169. }).then((res) => {
  170. this.fixedData = res
  171. });
  172. },
  173. fixationClose(){
  174. this.$refs.popup.close()
  175. },
  176. // 确定固定标本
  177. dialogConfirm(){
  178. if(!this.form.code){
  179. uni.showToast({
  180. title: '工号不能为空',
  181. duration: 1000,
  182. icon:'none'
  183. });
  184. return
  185. }
  186. if(!this.form.name){
  187. uni.showToast({
  188. title: '姓名不能为空',
  189. duration: 1000,
  190. icon:'none'
  191. });
  192. return
  193. }
  194. if(!this.form.fixative){
  195. uni.showToast({
  196. title: '固体液类型不能为空',
  197. duration: 1000,
  198. icon:'none'
  199. });
  200. return
  201. }
  202. if(!this.form.fixationTime){
  203. uni.showToast({
  204. title: '固定时间不能为空',
  205. duration: 1000,
  206. icon:'none'
  207. });
  208. return
  209. }
  210. let time = null
  211. if(Number.isInteger(this.form.fixationTime) && this.form.fixationTime > 0){
  212. time = this.yyTimeFilter(this.form.fixationTime)
  213. }else{
  214. time = this.form.fixationTime
  215. }
  216. uni.showLoading({
  217. title: "加载中",
  218. mask: true,
  219. });
  220. let query={
  221. hosId:this.hosId,
  222. id:this.infoData.id,
  223. specimenFixingLiquid:{
  224. id:this.form.fixative
  225. },
  226. handoverUserId:this.form.handoverUserId,
  227. fixationTime:time,
  228. specimenDeptId:this.userInfo.dept.id
  229. }
  230. post('/simple/data/addData/pathologyForm',query).then((res) => {
  231. uni.hideLoading();
  232. this.$refs.popup.close()
  233. uni.showToast({
  234. title: '固定成功',
  235. duration: 1000
  236. });
  237. setTimeout(_=>{
  238. this.back()
  239. },1000)
  240. });
  241. },
  242. // PDA扫描
  243. padChange(scannerCode){
  244. scannerCode = scannerCode.replace('\n','')
  245. if (!this.SMFlag) {
  246. return;
  247. }
  248. this.SMFlag = false;
  249. uni.showLoading({
  250. title: "加载中",
  251. mask: true,
  252. });
  253. this.pathologyFormId = uni.getStorageSync('pathologyFormId');
  254. let query={
  255. barcode:scannerCode,
  256. pathologyFormId:this.pathologyFormId,
  257. platform:"app"
  258. }
  259. if(!this.pathologyFormId){
  260. delete query.pathologyFormId
  261. }
  262. post("/pathology/scanCode", query).then((res) => {
  263. this.SMFlag = true
  264. uni.hideLoading();
  265. if(res.status==200){
  266. uni.setStorageSync('pathologyFormId', res.data[0].id);
  267. if(res.data[0].status.name=='标本离体'){
  268. uni.navigateTo({
  269. url: `/pages/specimenPort/scan?data=${JSON.stringify(res.data[0])}&type=${res.type}`
  270. });
  271. }else{
  272. uni.showToast({
  273. title: '查询到标本申请单信息',
  274. duration: 1000,
  275. icon:'none'
  276. });
  277. setTimeout(_=>{
  278. uni.navigateTo({
  279. url: `/pages/specimenPort/detail?detailId=${res.data[0].id}`
  280. });
  281. },800)
  282. }
  283. }else{
  284. uni.showModal({
  285. title: "提示",
  286. content: `${res.msg} \n 扫描内容:${scannerCode}`,
  287. confirmColor:'#49b856',
  288. success: (res) => {
  289. if (res.confirm) {
  290. console.log("用户点击确定");
  291. } else if (res.cancel) {
  292. console.log("用户点击取消");
  293. }
  294. },
  295. });
  296. }
  297. })
  298. }
  299. },
  300. onBackPress(e) {
  301. // backbutton:物理按键返回
  302. if (e.from === 'backbutton') {
  303. this.back()
  304. return true
  305. }
  306. },
  307. onShow() {
  308. let that = this
  309. // #ifdef APP-PLUS
  310. uni.$off('scan') // 每次进来先 移除全局自定义事件监听器
  311. uni.$on('scan', function(data) {
  312. that.padChange(data)
  313. })
  314. // #endif
  315. },
  316. onLoad(option){
  317. let data = JSON.parse(option.data)
  318. this.infoData = data
  319. this.type = option.type
  320. this.list = data.pathologySpecimenDTOList?data.pathologySpecimenDTOList:[]
  321. if(this.list.length == this.infoData.specimenNum){
  322. uni.showToast({
  323. title: '您标本已扫描完成,请填写固定信息',
  324. duration: 2000,
  325. icon:'none'
  326. });
  327. }
  328. this.getFixation()
  329. }
  330. }
  331. </script>
  332. <style scoped>
  333. >>> .uni-forms-item__content{
  334. display: flex;
  335. align-items: center;
  336. }
  337. >>>.uni-easyinput__content-input,
  338. >>>.uni-input-wrapper,
  339. >>>.uni-input-placeholder{
  340. display: flex;
  341. align-items: center;
  342. line-height: 1;
  343. height: 35px;
  344. }
  345. .select >>>.dialog-close{
  346. /* display: flex !important; */
  347. }
  348. .select >>>.dialog-close-plus{
  349. }
  350. .select >>>.dialog-close-rotate{
  351. top: 20.8px;
  352. left: 14px;
  353. }
  354. .time >>>.dialog-close-rotate{
  355. top: 24px;
  356. left: 24.5px;
  357. }
  358. </style>
  359. <style lang="less" scoped>
  360. page {
  361. background: #F8F8F8;
  362. }
  363. .content {
  364. .header {
  365. width: 100%;
  366. height: 450rpx;
  367. text-align: center;
  368. .title{
  369. color: red;
  370. font-size: 70rpx;
  371. font-weight: bold;
  372. }
  373. .par-top1{
  374. padding-top: 100rpx;
  375. }
  376. .par-top2{
  377. padding-top: 150rpx;
  378. }
  379. .tip{
  380. font-size: 30rpx;
  381. font-weight: bold;
  382. padding: 40rpx 0;
  383. }
  384. }
  385. .info{
  386. // padding: 0 20rpx;
  387. // background: #fff;
  388. height: calc(100vh - 120rpx);
  389. overflow-y: auto;
  390. background: #F8F8F8;
  391. .info-list{
  392. padding: 14rpx 0;
  393. display: flex;
  394. font-size: 28rpx;
  395. color: #555555;
  396. .info-title{
  397. color: #000;
  398. }
  399. .info-content{
  400. flex: 1;
  401. }
  402. }
  403. }
  404. .height-list {
  405. height: 44px;
  406. }
  407. .list {
  408. background: #fff;
  409. border-bottom: 1px solid #D2D2D2;
  410. .df-list {
  411. display: flex;
  412. align-items: center;
  413. padding: 14rpx 20rpx;
  414. font-size: 28rpx;
  415. color: #555555;
  416. .no-center{
  417. align-items: baseline;
  418. line-height: 1;
  419. }
  420. .list-title{
  421. color: #000;
  422. line-height: 1;
  423. }
  424. }
  425. }
  426. .list-top{
  427. margin-top: 20rpx;
  428. }
  429. .info-log{
  430. background: #fff;
  431. height: calc(100vh - 80rpx);
  432. }
  433. .df {
  434. display: flex;
  435. height: 80rpx;
  436. align-items: center;
  437. padding: 0 20rpx;
  438. border-bottom: 1px solid #D2D2D2;
  439. }
  440. .execFilterMask{
  441. .execFilter{
  442. position: relative;
  443. background-color: #fff;
  444. height: calc(100vh - 80rpx);
  445. .execFilterHeader{
  446. height: 70rpx;
  447. display: flex;
  448. justify-content: center;
  449. align-items: center;
  450. border-bottom: 2rpx solid #ccc;
  451. }
  452. .execFilterBody{
  453. .execFilterItem{
  454. padding: 32rpx;
  455. border-bottom: 2rpx dashed #ccc;
  456. &:last-of-type{
  457. border-bottom: none;
  458. }
  459. .execFilterItemHeader{}
  460. .execFilterItemBody{
  461. display: flex;
  462. flex-wrap: wrap;
  463. padding: 32rpx 0 0;
  464. justify-content: space-between;
  465. text-align: left;
  466. .execFilterItemBox{
  467. width: 200rpx;
  468. height: 80rpx;
  469. text-align: center;
  470. line-height: 80rpx;
  471. background-color: #f6f6f6;
  472. margin-bottom: 20rpx;
  473. &.active{
  474. color: #fff;
  475. background-color: #49b856;
  476. }
  477. }
  478. .deptName {
  479. height: 80rpx;
  480. background-color: #f6f6f6;
  481. padding: 0 20rpx;
  482. width: 100%;
  483. }
  484. }
  485. }
  486. }
  487. }
  488. }
  489. .btn-view{
  490. width: 100%;
  491. bottom: 20rpx;
  492. position: fixed;
  493. .back-btn{
  494. background: #49B856;
  495. border-radius: 10rpx;
  496. color: #fff;
  497. font-size: 30rpx;
  498. text-align: center;
  499. line-height: 80rpx;
  500. width: 95%;
  501. }
  502. .back-btn2{
  503. background: #8F939C;
  504. border-radius: 10rpx;
  505. color: #fff;
  506. font-size: 30rpx;
  507. text-align: center;
  508. line-height: 80rpx;
  509. width: 45%;
  510. }
  511. .back-btn3{
  512. background: #49B856;
  513. border-radius: 10rpx;
  514. color: #fff;
  515. font-size: 30rpx;
  516. text-align: center;
  517. line-height: 80rpx;
  518. width: 45%;
  519. }
  520. }
  521. .df-sb{
  522. display: flex;
  523. justify-content: space-between;
  524. }
  525. .pop-content{
  526. text-align: center;
  527. .pop-title{
  528. font-size: 32rpx;
  529. color: #000;
  530. margin-top: 20rpx;
  531. }
  532. .pop-tip{
  533. font-size: 28rpx;
  534. color: #6C6C6C;
  535. margin-top: 10rpx;
  536. }
  537. .uni-forms{
  538. padding: 20rpx 20rpx 0 20rpx;
  539. }
  540. .text-left{
  541. text-align: left;
  542. }
  543. .pou-btn{
  544. color: #000;
  545. font-size: 30rpx;
  546. border-top: 1px solid #E3E3E3;
  547. display: flex;
  548. padding: 0 20rpx;
  549. .btn{
  550. text-align: center;
  551. line-height: 80rpx;
  552. width: 50%;
  553. }
  554. }
  555. .border-right{
  556. border-right: 1px solid #E3E3E3;
  557. }
  558. .confirm{
  559. color: #49B856 !important;
  560. }
  561. }
  562. }
  563. </style>