checkPage.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
  1. <template>
  2. <view class="Scanning_Result">
  3. <view class="Scanning_top">
  4. <view class="Scanning_top_icon">
  5. <text v-if="workOrder.endDepts">{{workOrder.endDepts[0].dept}}签到—{{noScanNum}}/{{totalNum}}</text>
  6. </view>
  7. </view>
  8. <view class="Scanning_cont">
  9. <scroll-view scroll-y class="scrollContent">
  10. <view class="column" v-for="item in specimenPackageList" :key="item.id">
  11. <view class="row bd">
  12. <view class="name">{{item.deptName}}</view>
  13. <view class="value" :class="{ red: item.sacnState === 0 }">{{item.sacnState === 0 ? '未扫描' : '已扫描'}}</view>
  14. </view>
  15. <view class="row">
  16. <view class="name">{{item.pack_code}}</view>
  17. <view class="value">{{item.count}}</view>
  18. </view>
  19. </view>
  20. </scroll-view>
  21. </view>
  22. <view class="foot_btn_spe">
  23. <view class="column">
  24. <template v-if="!config.drugsEndManual">
  25. <view class="btn" @click="Scanning_again()">继续扫描</view>
  26. <view class="btn" @click="scanCode()">扫一扫核对交接</view>
  27. </template>
  28. <!-- 三个按钮-样式 -->
  29. <template v-else-if="config.drugsEndManual">
  30. <view class="btn" @click="scanCode()">扫一扫核对交接</view>
  31. <view class="btn" @click="fillInManually(config.drugsEndManual.value)">{{config.drugsEndManual.name}}核对交接</view>
  32. <view class="btnW100" @click="Scanning_again()">继续扫描</view>
  33. </template>
  34. </view>
  35. </view>
  36. <!-- 填写交接人工号弹窗 -->
  37. <selectAccount @click.stop.native v-if="hosModels.disjunctor" :disjunctor="hosModels.disjunctor" @ok="hosOk"
  38. @cancel="hosCancel">
  39. </selectAccount>
  40. <!-- 动态密钥 -->
  41. <numberKeyModel v-if="showKey" :keyArr="keyArr" @cancel="showKey = false" @confirm="confirmKey($event)"></numberKeyModel>
  42. </view>
  43. </template>
  44. <script>
  45. import numberKeyModel from "@/components/numberKeyModel/numberKeyModel.vue";
  46. import {
  47. get,
  48. post,
  49. SM,
  50. webHandle
  51. } from "@/http/http.js";
  52. export default {
  53. data() {
  54. return {
  55. hosId: uni.getStorageSync('userData').user.currentHospital.id,
  56. specimenPackageList: [], //标本包列表
  57. queryObj: {}, //路由传递过来的数据
  58. workOrder: {}, //工单信息
  59. config: {}, //配置
  60. SMFlag: true, //控制扫码
  61. // 填写交接人工号弹窗model
  62. hosModels: {
  63. disjunctor: false,
  64. },
  65. showKey:false,
  66. keyNum:4, //密钥位数
  67. isNumberKey:false, //是否开启动态密钥
  68. keyArr: [],
  69. totalNum: 0,//总数量
  70. noScanNum: 0,//未扫描
  71. };
  72. },
  73. components: {
  74. numberKeyModel,
  75. },
  76. onShow() {
  77. this.SMFlag = true;
  78. },
  79. methods: {
  80. // 获取配置
  81. getConfig() {
  82. let postData = {
  83. idx: 0,
  84. sum: 9999,
  85. hospitalConfig:{
  86. hosId:this.hosId,
  87. model:"all"
  88. }
  89. };
  90. post("/simple/data/fetchDataList/hospitalConfig",postData).then((result) => {
  91. if (result.status == 200) {
  92. this.keyArr = []
  93. for(let i of result.list){
  94. if(i.key=='digitalSecretKey'){
  95. if(i.value==1){
  96. this.isNumberKey = true
  97. }else{
  98. this.isNumberKey = false
  99. }
  100. }else if(i.key=='numberDigitalSecretKey'){
  101. this.keyNum = Number(i.value)
  102. }
  103. }
  104. for(let i = 0; i < this.keyNum; i++){
  105. this.keyArr.push({
  106. value:null
  107. })
  108. }
  109. console.log(444,this.keyArr)
  110. }
  111. });
  112. },
  113. confirmKey(data){
  114. this.padChange(data)
  115. this.showKey = false
  116. },
  117. isShowKey(){
  118. this.showKey = true
  119. },
  120. padChange(scannerCode){
  121. if(!this.isNumberKey){
  122. scannerCode = scannerCode.replace('\n','')
  123. }
  124. this.bigScan(scannerCode);
  125. },
  126. // 手动填写
  127. fillInManually(value){
  128. if(value == 1){
  129. // 填写工号
  130. this.showSelectAccount();
  131. }else if(value == 2){
  132. // 动态密钥
  133. this.isShowKey();
  134. }
  135. },
  136. // 填写交接人工号-确认
  137. hosOk(data) {
  138. console.log(data);
  139. const {
  140. accountName,
  141. account,
  142. accountId
  143. } = data;
  144. if (!accountName && !account) {
  145. //没有填写交接人
  146. uni.showModal({
  147. title: "提示",
  148. content: "请填写交接人工号!",
  149. showCancel: false,
  150. success: function(res) {
  151. if (res.confirm) {
  152. console.log("用户点击确定");
  153. } else if (res.cancel) {
  154. console.log("用户点击取消");
  155. }
  156. },
  157. });
  158. return;
  159. } else if ((!accountName && account) || (accountName && !account)) {
  160. //没有填写交接人
  161. uni.showModal({
  162. title: "提示",
  163. content: "请填写正确的交接人工号!",
  164. showCancel: false,
  165. success: function(res) {
  166. if (res.confirm) {
  167. console.log("用户点击确定");
  168. } else if (res.cancel) {
  169. console.log("用户点击取消");
  170. }
  171. },
  172. });
  173. return;
  174. }
  175. this.hosModels.disjunctor = false;
  176. this.validateAccount(data);
  177. },
  178. // 填写交接人工号-取消
  179. hosCancel() {
  180. this.hosModels.disjunctor = false;
  181. this.flag = true;
  182. },
  183. // 填写交接人工号弹窗
  184. showSelectAccount() {
  185. this.hosModels = {
  186. disjunctor: true,
  187. };
  188. },
  189. // 手动填写工号校验
  190. validateAccount(accountObj){
  191. const {
  192. accountName,
  193. account,
  194. accountId
  195. } = accountObj;
  196. uni.showLoading({
  197. title: "加载中",
  198. mask: true,
  199. });
  200. let postData = {
  201. extraType: 'inputAccountValid',
  202. type: this.queryObj.packageType,
  203. orderStateValue: this.workOrder.gdState.value,
  204. userId: accountId,
  205. orderId: this.workOrder.id,
  206. }
  207. post("/transflow/extra", postData)
  208. .then((res) => {
  209. uni.hideLoading();
  210. if(res.state == 200){
  211. if(res.data){
  212. if (res.data.codeBean) {
  213. if(res.data.codeBean.valid){
  214. this.pageNavigateByConfig(this.config, this.workOrder, this.queryObj, { id: accountId, name: accountName }, res.data.codeBean.departmentDTO);
  215. }else{
  216. uni.showToast({
  217. icon: "none",
  218. title: res.data.codeBean.msg || "接口获取数据失败!",
  219. });
  220. }
  221. } else {
  222. uni.showToast({
  223. icon: "none",
  224. title: "接口获取数据失败!",
  225. });
  226. }
  227. }else{
  228. uni.showToast({
  229. icon: "none",
  230. title: "接口获取数据失败!",
  231. });
  232. }
  233. }else{
  234. uni.showToast({
  235. icon: "none",
  236. title: res.msg || "接口获取数据失败!",
  237. });
  238. }
  239. });
  240. },
  241. // 工单完成
  242. completeOrder(workOrder, queryObj, accountObj){
  243. uni.showLoading({
  244. title: "加载中",
  245. mask: true,
  246. });
  247. let postData = {
  248. "orderId": -1,
  249. "type": queryObj.packageType,
  250. "packageIds": this.specimenPackageList.map(v => v.packageId).toString(),
  251. "handover": accountObj ? accountObj.id : undefined,
  252. };
  253. post('/transflow/complete', postData).then(res => {
  254. uni.hideLoading();
  255. if(res.state == 200){
  256. uni.showToast({
  257. icon: "none",
  258. title: workOrder.gdState.value == 4 ? "交接成功,请尽快送达科室!" : (workOrder.gdState.value == 5 ? "交接成功,完成配送!" : ""),
  259. duration: 60000,
  260. mask: true,
  261. complete(){
  262. setTimeout(() => {
  263. uni.hideToast();
  264. uni.redirectTo({
  265. url: `/pages/receiptpage/receiptpage`,
  266. });
  267. }, 2000)
  268. }
  269. });
  270. }else{
  271. uni.showToast({
  272. icon: "none",
  273. title: res.msg || "接口获取数据失败!",
  274. });
  275. }
  276. })
  277. },
  278. // 根据配置跳转页面
  279. pageNavigateByConfig(config, workOrder, queryObj, accountObj, departmentDTO){
  280. console.log(accountObj, departmentDTO);
  281. let packageType = queryObj.packageType;
  282. let orderId = workOrder.id;
  283. if(workOrder.gdState.value == 4){
  284. // 待到达
  285. if(config.drugsStartPhoto === 1){
  286. // 起点科室支持拍照留存
  287. uni.navigateTo({
  288. url: `/pages/newDrug/photoRetention/photoRetention?packageType=${packageType}&orderId=${orderId}&accountId=${accountObj ? accountObj.id : ''}&accountName=${accountObj ? accountObj.name : ''}&accountDeptName=${departmentDTO ? departmentDTO.dept : ''}`,
  289. });
  290. }else{
  291. // 起点科室不支持拍照留存
  292. this.completeOrder(workOrder, queryObj, accountObj);
  293. }
  294. }else if(workOrder.gdState.value == 5){
  295. // 待送达
  296. if(config.drugsEndPhoto === 1){
  297. // 起点科室支持拍照留存
  298. uni.navigateTo({
  299. url: `/pages/newDrug/photoRetention/photoRetention?packageType=${packageType}&orderId=${orderId}&accountId=${accountObj ? accountObj.id : ''}&accountName=${accountObj ? accountObj.name : ''}&accountDeptName=${departmentDTO ? departmentDTO.dept : ''}`,
  300. });
  301. }else{
  302. // 起点科室不支持拍照留存
  303. this.completeOrder(workOrder, queryObj, accountObj);
  304. }
  305. }
  306. },
  307. // 扫一扫交接
  308. scanCode(){
  309. if (!this.SMFlag) {
  310. return;
  311. }
  312. this.SMFlag = false;
  313. SM().then((content) => {
  314. uni.showLoading({
  315. title: "加载中",
  316. mask: true,
  317. });
  318. this.bigScan(content);
  319. }).catch(err => {
  320. this.SMFlag = true;
  321. });
  322. },
  323. // 扫码
  324. bigScan(content){
  325. let postData = {
  326. type: this.queryObj.packageType,
  327. orderStateValue: this.workOrder.gdState.value,
  328. code: content,
  329. orderId: this.workOrder.id,
  330. }
  331. post("/transflow/bigScan", postData)
  332. .then((res) => {
  333. this.SMFlag = true;
  334. uni.hideLoading();
  335. if (res.codeBean) {
  336. if(res.codeBean.valid){
  337. this.pageNavigateByConfig(this.config, this.workOrder, this.queryObj, res.codeBean.userDTO, res.codeBean.departmentDTO);
  338. }else{
  339. uni.showToast({
  340. icon: "none",
  341. title: res.codeBean.msg || "接口获取数据失败!",
  342. });
  343. }
  344. } else {
  345. uni.showToast({
  346. icon: "none",
  347. title: "接口获取数据失败!",
  348. });
  349. }
  350. });
  351. },
  352. // 继续扫描
  353. Scanning_again(isFlag = false) {
  354. if (!this.SMFlag) {
  355. return;
  356. }
  357. this.SMFlag = false;
  358. SM().then((ress1) => {
  359. this.hand_scanning_common(ress1, 'scan', isFlag);
  360. }).catch(err => {
  361. this.SMFlag = true;
  362. });
  363. },
  364. // 手动输入和扫码公共方法
  365. hand_scanning_common(ress1, type, isFlag = false) {
  366. // ----------------
  367. uni.showLoading({
  368. title: "加载中",
  369. mask: true,
  370. });
  371. //检验二维码的有效性
  372. post("/dept/scanning", {
  373. content: ress1,
  374. }).then((result) => {
  375. this.SMFlag = true;
  376. if (result.state == 200 || result.state == 201) {
  377. let codes = result.code;
  378. if (codes) {
  379. this.input_common(ress1, type, isFlag);
  380. } else {
  381. uni.hideLoading();
  382. }
  383. } else {
  384. uni.hideLoading();
  385. uni.showToast({
  386. icon: "none",
  387. title: result.info || "接口获取数据失败!",
  388. });
  389. }
  390. });
  391. // ------------------------------
  392. },
  393. // 录入到工单
  394. input_common(ress1, type, isFlag = false){
  395. uni.showLoading({
  396. title: "加载中",
  397. mask: true,
  398. });
  399. post("/transflow/scanBind", { type: this.queryObj.packageType, orderId: this.queryObj.orderId, code: ress1 }).then((ress) => {
  400. uni.hideLoading();
  401. if (ress.state == 200) {
  402. if(ress.data.msg){
  403. uni.showToast({
  404. icon: "none",
  405. title: ress.data.msg || "接口获取数据失败!",
  406. });
  407. }else{
  408. uni.redirectTo({
  409. url: `/pages/specimenPackage/checkPage/checkPage?packageType=${this.queryObj.packageType}&packageId=${ress.data.dto.id}&orderId=${this.queryObj.orderId}&scanOrHand=${type}`,
  410. });
  411. }
  412. } else {
  413. uni.showToast({
  414. icon: "none",
  415. title: ress.msg || "接口获取数据失败!",
  416. });
  417. }
  418. });
  419. },
  420. // 初始化
  421. init(){
  422. uni.showLoading({
  423. title: "加载中",
  424. mask: true,
  425. });
  426. let info$ = post(`/transflow/extra`, {type: this.queryObj.packageType, extraType: 'orderInfo', orderId: +this.queryObj.orderId, checkComplete: '1'});
  427. let config$ = post(`/simple/data/fetchDataList/taskTypeConfig`, {
  428. "idx": 0,
  429. "sum": 1,
  430. "taskTypeConfig": {
  431. "taskTypeDTO": {
  432. "hosId": {
  433. "id": this.hosId
  434. },
  435. "ordinaryField": {
  436. "key": "ordinary_field",
  437. "value": this.queryObj.packageType
  438. }
  439. }
  440. }
  441. });
  442. Promise.all([info$, config$]).then(result => {
  443. let [info, config] = result || [];
  444. if(info.state == 200){
  445. if(info.data){
  446. this.workOrder = info.data.workOrder || {};
  447. }
  448. }else{
  449. uni.hideLoading();
  450. uni.showToast({
  451. icon: "none",
  452. title: info.msg || "接口获取数据失败!",
  453. });
  454. }
  455. if(config.status == 200){
  456. let list = config.list || [];
  457. this.config = list.length ? list[0] : {};
  458. }else{
  459. uni.hideLoading();
  460. uni.showToast({
  461. icon: "none",
  462. title: config.msg || "接口获取数据失败!",
  463. });
  464. }
  465. post(`/nurse/specimen/getSpePackageScanCount`, {endDeptId: this.workOrder.endDepts[0].id}).then((ress) => {
  466. uni.hideLoading();
  467. if(ress.state == 200){
  468. this.specimenPackageList = ress.data || [];
  469. this.noScanNum = this.specimenPackageList.filter(v => v.sacnState !== 0).length;
  470. this.totalNum = this.specimenPackageList.length;
  471. }else{
  472. uni.showToast({
  473. icon: "none",
  474. title: ress.msg || "接口获取数据失败!",
  475. });
  476. }
  477. });
  478. })
  479. },
  480. },
  481. onLoad(options) {
  482. console.log(options, "options");
  483. this.queryObj = options;
  484. this.init();
  485. this.getConfig();
  486. // #ifdef APP-PLUS
  487. webHandle("no", "app");
  488. // #endif
  489. // #ifdef H5
  490. webHandle("no", "wx");
  491. // #endif
  492. },
  493. };
  494. </script>
  495. <style lang="less" scoped>
  496. .Scanning_Result {
  497. background: #FAFBFD;
  498. padding: 0 24rpx;
  499. display: flex;
  500. flex-direction: column;
  501. height: 100vh;
  502. .Scanning_top {
  503. margin: 24rpx auto;
  504. .Scanning_top_icon {
  505. font-size: 38rpx;
  506. font-weight: bold;
  507. .newicon{
  508. margin: 0 32rpx;
  509. }
  510. }
  511. }
  512. .Scanning_cont {
  513. flex: 1;
  514. min-height: 0;
  515. display: flex;
  516. flex-direction: column;
  517. .scrollContent{
  518. flex: 1;
  519. min-height: 0;
  520. }
  521. .column{
  522. font-size: 30rpx;
  523. padding: 24rpx;
  524. background: #FAFBFD;
  525. border: 1rpx solid #E1E1E1;
  526. margin-top: 16rpx;
  527. border-radius: 8rpx;
  528. .row{
  529. display: flex;
  530. justify-content: space-between;
  531. align-items: center;
  532. margin-top: 24rpx;
  533. &:first-of-type{
  534. margin-top: 0;
  535. }
  536. }
  537. .bd{
  538. font-weight: bold;
  539. }
  540. &:first-of-type{
  541. margin-top: 0;
  542. }
  543. &.head{
  544. font-size: 30rpx;
  545. color: #000000;
  546. border: 1rpx solid #D9D9D9;
  547. box-shadow: 0rpx 3rpx 6rpx 1rpx rgba(0,0,0,0.16);
  548. background: #FBFCFE;
  549. }
  550. .value1{
  551. flex: 2;
  552. text-align: left;
  553. word-break: break-all;
  554. flex-shrink: 0;
  555. }
  556. .value2,.value3{
  557. flex: 1;
  558. text-align: center;
  559. word-break: break-all;
  560. flex-shrink: 0;
  561. }
  562. }
  563. }
  564. .foot_btn_spe {
  565. margin: 24rpx 0;
  566. display: flex;
  567. flex-direction: column;
  568. align-items: center;
  569. gap: 24rpx;
  570. font-weight: bold;
  571. .column{
  572. width: 100%;
  573. display: flex;
  574. justify-content: space-between;
  575. gap: 24rpx;
  576. flex-wrap: wrap;
  577. .btn {
  578. height: 78rpx;
  579. width: calc(50% - 24rpx);
  580. background: linear-gradient( 90deg, #6FC073 0%, #3DB197 100%);
  581. color: #fff;
  582. border-radius: 4rpx;
  583. font-size: 30rpx;
  584. display: flex;
  585. justify-content: center;
  586. align-items: center;
  587. }
  588. .btnW100 {
  589. height: 78rpx;
  590. width: 100%;
  591. background: linear-gradient( 90deg, #6FC073 0%, #3DB197 100%);
  592. color: #fff;
  593. border-radius: 4rpx;
  594. font-size: 30rpx;
  595. display: flex;
  596. justify-content: center;
  597. align-items: center;
  598. }
  599. }
  600. }
  601. }
  602. </style>