bigScreen.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  1. <template>
  2. <view class="toolbar" :class="!isNumberKey?'fixed-class':''" @click="Scanning()" hover-class="seimin-btn-hover">
  3. <text class="toolbar-icon newicon newicon-saoma"></text>
  4. <text class="toolbar-sao">扫一扫</text>
  5. <!-- 填写交接人工号弹窗 -->
  6. <selectAccount @click.stop.native v-if="hosModels.disjunctor" :disjunctor="hosModels.disjunctor" @ok="hosOk"
  7. @cancel="hosCancel">
  8. </selectAccount>
  9. </view>
  10. </template>
  11. <script>
  12. import {
  13. post,
  14. SM
  15. } from "../../http/http.js";
  16. export default {
  17. data() {
  18. return {
  19. hosId: uni.getStorageSync('userData').user.currentHospital.id,
  20. // 填写交接人工号弹窗model
  21. hosModels: {
  22. disjunctor: false,
  23. },
  24. userId: {
  25. ids: [],
  26. },
  27. workData: [],
  28. infoDATA: {},
  29. tabType: "", //当前选中项
  30. selectArr: [], //选中项
  31. code: "",
  32. currentCode: '', //当前小扫描的科室二维码
  33. SMFlag: true,
  34. }
  35. },
  36. props:{
  37. isNumberKey:Boolean
  38. },
  39. methods: {
  40. // 填写交接人工号-确认
  41. hosOk(data) {
  42. console.log(data);
  43. const {
  44. accountName,
  45. account,
  46. accountId
  47. } = data;
  48. if (!accountName && !account) {
  49. //没有填写交接人
  50. uni.showModal({
  51. title: "提示",
  52. content: "请填写交接人工号!",
  53. showCancel: false,
  54. success: function(res) {
  55. if (res.confirm) {
  56. console.log("用户点击确定");
  57. } else if (res.cancel) {
  58. console.log("用户点击取消");
  59. }
  60. },
  61. });
  62. return;
  63. } else if ((!accountName && account) || (accountName && !account)) {
  64. //没有填写交接人
  65. uni.showModal({
  66. title: "提示",
  67. content: "请填写正确的交接人工号!",
  68. showCancel: false,
  69. success: function(res) {
  70. if (res.confirm) {
  71. console.log("用户点击确定");
  72. } else if (res.cancel) {
  73. console.log("用户点击取消");
  74. }
  75. },
  76. });
  77. return;
  78. }
  79. this.hosModels.disjunctor = false;
  80. this.orderDeptHandler(false, data);
  81. },
  82. // 填写交接人工号-取消
  83. hosCancel() {
  84. this.hosModels.disjunctor = false;
  85. this.flag = true;
  86. },
  87. // 填写交接人工号弹窗
  88. showSelectAccount() {
  89. this.hosModels = {
  90. disjunctor: true,
  91. };
  92. },
  93. // 标本配送-待送达-运输过程-标本数字交接,则,科室签到不需要填写交接人
  94. validateHandoverSpecimen(){
  95. return post("/simple/data/fetchDataList/taskType", {
  96. "idx": 0,
  97. "sum": 1,
  98. "taskType": {
  99. "hosId": {
  100. "id": this.hosId
  101. },
  102. "associationType": {
  103. "key": "association_types",
  104. "value": "specimen"
  105. }
  106. }
  107. });
  108. },
  109. //科室签到
  110. //trueBigScanner----判断是否大扫描
  111. //bigScanner----判断是否需要交接人
  112. //accountObj----弹窗填写的交接人信息
  113. async orderDeptHandler(bigScanner, accountObj) {
  114. console.log(this.infoDATA);
  115. uni.showLoading({
  116. title: "加载中",
  117. mask: true,
  118. });
  119. if(this.tabType === 'specimen' && this.infoDATA.specimen && this.infoDATA.specimen[0].gdState.value == 5){
  120. let result = await this.validateHandoverSpecimen();
  121. if (result.status == 200) {
  122. if(result.list.length){
  123. // 标本-运送过程-终点科室-标本数字交接
  124. if(result.list[0].carryingCourses[1].checkoutMethod.value == 3){
  125. bigScanner = false;
  126. }
  127. }else{
  128. uni.showToast({
  129. icon: "none",
  130. title: "请配置标本配送任务类型!",
  131. });
  132. uni.hideLoading();
  133. return;
  134. }
  135. }
  136. }
  137. let type = "orderSign/" + this.code;
  138. let list = {
  139. ids: this.userId.ids,
  140. trueBigScanner: ['666']
  141. };
  142. bigScanner && (list.bigScanner = ['666']);
  143. if (accountObj) {
  144. list.handover = [accountObj.accountId];
  145. }
  146. post("/workerOrder/" + type, list).then((res) => {
  147. console.log(this.tabType)
  148. uni.hideLoading();
  149. if (res.status == 200) {
  150. if (this.tabType == 'specimenPlan') {
  151. // -----------------------------
  152. console.log(this.selectArr, '选中工单')
  153. let gd = this.infoDATA.specimenPlan.find(v => v.id == this.selectArr[0]);
  154. let startDeptId = gd.startDept.id; //起点科室id
  155. let isDigitalHandover = gd.taskType.isDigitalHandover; //是否数字交接开关
  156. let signDeptId = res.deptId; //签到的科室id
  157. let gdId = gd.id;
  158. let gdState = gd.gdState.value;
  159. let endDepts = gd.endDepts.map(v => v.id).toString();
  160. uni.navigateTo({
  161. url: `../scanning_djEnd/scanning_djEnd?type=${
  162. this.tabType
  163. }&type1=${res.type}&code=${this.code}&dept=${
  164. res.dept
  165. }&ids=${encodeURIComponent(
  166. JSON.stringify(this.userId.ids)
  167. )}&model=${encodeURIComponent(JSON.stringify(res))}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}&deptId=${res.deptId}&startDeptId=${startDeptId}&isDigitalHandover=${isDigitalHandover}&signDeptId=${signDeptId}&gdId=${gdId}&gdState=${gdState}&endDepts=${endDepts}`,
  168. });
  169. } else if (this.tabType == 'specimen') {
  170. // 同济是false
  171. if (res.deptType && res.deptType.value === 'middleRoom') {
  172. // if (false) {
  173. // 如果是中转科室
  174. uni.navigateTo({
  175. url: `../checkAfterBigScreen/checkAfterBigScreen?type=${
  176. this.tabType
  177. }&type1=${res.type}&code=${this.code}&dept=${
  178. res.dept
  179. }&ids=${encodeURIComponent(
  180. JSON.stringify(this.userId.ids)
  181. )}&model=${encodeURIComponent(JSON.stringify(res))}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}&deptId=${res.deptId}`,
  182. });
  183. } else if(res.type === 'spe-dsd-4'){
  184. // 检验方式是标本数字交接
  185. uni.navigateTo({
  186. url: `/pages/specimenHandoverNew/specimenHandoverNew?type=${
  187. this.tabType
  188. }&type1=${res.type}&code=${this.code}&dept=${
  189. res.dept
  190. }&ids=${encodeURIComponent(
  191. JSON.stringify(this.userId.ids)
  192. )}&model=${encodeURIComponent(JSON.stringify(res))}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}&deptId=${res.deptId}`,
  193. });
  194. } else{
  195. uni.navigateTo({
  196. url: `../scanning_djEnd/scanning_djEnd?type=${
  197. this.tabType
  198. }&type1=${res.type}&code=${this.code}&dept=${
  199. res.dept
  200. }&ids=${encodeURIComponent(
  201. JSON.stringify(this.userId.ids)
  202. )}&model=${encodeURIComponent(JSON.stringify(res))}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}&deptId=${res.deptId}`,
  203. });
  204. }
  205. }
  206. } else if (res.status == "0000") {
  207. this.showSelectAccount();
  208. } else {
  209. this.flag = true;
  210. uni.navigateTo({
  211. url: `../scanning_djEnd/scanning_djEnd?type=${this.tabType}&type1=${
  212. res.type
  213. }&code=${this.code}&dept=${res.dept}&ids=${encodeURIComponent(
  214. JSON.stringify(this.userId.ids)
  215. )}&model=${encodeURIComponent(JSON.stringify(res))}&deptId=${res.deptId}`,
  216. });
  217. }
  218. });
  219. },
  220. // 底部扫描
  221. Scanning(qrcodePrefix = '') {
  222. if (!this.SMFlag) {
  223. return;
  224. }
  225. this.SMFlag = false;
  226. SM().then((content) => {
  227. uni.showLoading({
  228. title: "加载中",
  229. mask: true,
  230. });
  231. //检验二维码的有效性(扫码前必须验证)
  232. post("/dept/scanning", {
  233. content,
  234. })
  235. .then((result) => {
  236. this.currentCode = result.code;
  237. this.SMFlag = true;
  238. // 200检测通过,201没有有效期也通过。
  239. if (result.state == 200 || result.state == 201) {
  240. let data = {
  241. code: result.code, //二维码
  242. };
  243. //微信—大扫描(科室码,患者码,标本码,快捷建单码,药包码)
  244. let code = result.code.includes(qrcodePrefix) ? result.code : qrcodePrefix + result.code;
  245. post("/workerOrder/scanCode", { code, hosId: this.hosId })
  246. .then((res) => {
  247. uni.hideLoading();
  248. if (res.status == 200) {
  249. // 扫描标本码
  250. if (res.type == "specimen") {
  251. let infoDATA = {
  252. stype: res.data.stype,
  253. scode: res.data.scode,
  254. patientName: res.data.patientName,
  255. sickRoom: res.data.sickRoom ?
  256. res.data.sickRoom.dept : "-",
  257. checkDept: res.data.checkDept ?
  258. res.data.checkDept.dept : "-",
  259. bedNum: res.data.bedNum,
  260. };
  261. uni.navigateTo({
  262. url: `../scanning_B/scanning_B?res=${encodeURIComponent(
  263. JSON.stringify(res)
  264. )}&infoDATA=${encodeURIComponent(
  265. JSON.stringify(infoDATA)
  266. )}`,
  267. });
  268. } else if (res.type == "patient") {
  269. //如果是患者腕带码
  270. // code: data.code //二维码
  271. res.workOrder = res.workOrder ? res.workOrder : []; //liao
  272. uni.navigateTo({
  273. url: `../scanning_ins/scanning_ins?code=${
  274. data.code
  275. }&infoDATA=${encodeURIComponent(
  276. JSON.stringify(res.data)
  277. )}&workData=${encodeURIComponent(
  278. JSON.stringify(res.workOrder)
  279. )}&patientOrders=${encodeURIComponent(
  280. JSON.stringify(res.patientOrders)
  281. )}`,
  282. });
  283. } else if (res.type == "quickOrder") {
  284. //快捷建单
  285. if(res.data.isDigitalHandover == 1){
  286. uni.navigateTo({
  287. url: `../specimenChecking/specimenChecking?infoDATA=${encodeURIComponent(
  288. JSON.stringify(res.data)
  289. )}`,
  290. });
  291. }else{
  292. uni.navigateTo({
  293. url: `../shortcutbuildOrders/shortcutbuildOrders?infoDATA=${encodeURIComponent(
  294. JSON.stringify(res.data)
  295. )}`,
  296. });
  297. }
  298. } else if (res.type == "dept") {
  299. // 扫描科室码
  300. // code: data.code //二维码
  301. let infoDATA = res.data;
  302. console.log(infoDATA)
  303. // 判断是否是标本配送,并且仅仅只有这一种业务类型,默认全选,并跳转到下一步;
  304. // 判断是否是标本轮巡 ,并且仅仅只有这一种业务类型,并且只有一个工单,默认选中,并跳转到下一步;
  305. if(Object.keys(infoDATA).length === 1 && (infoDATA.specimen || (infoDATA.specimenPlan && infoDATA.specimenPlan.length === 1))){
  306. this.infoDATA = infoDATA;
  307. this.workData = infoDATA.specimen || infoDATA.specimenPlan;
  308. this.tabType = infoDATA.specimen ? 'specimen' : 'specimenPlan';
  309. this.code = data.code;
  310. this.selectArr = [];
  311. for (var i = 0; i < this.workData.length; i++) {
  312. this.selectArr.push(this.workData[i].id);
  313. }
  314. this.userId.ids = this.selectArr;
  315. this.orderDeptHandler(true);
  316. }else if(res.deptHandoverType && res.deptHandoverType.value == 'clinicalWaste'){
  317. // 医废
  318. uni.navigateTo({
  319. url: `/pages/medicalWaste/medicalWasteSignIn/medicalWasteSignIn?code=${data.code}&deptName=${res.deptName}&deptId=${res.deptId}`,
  320. });
  321. }else{
  322. uni.navigateTo({
  323. url: `../scanning_all/scanning_all?infoDATA=${encodeURIComponent(
  324. JSON.stringify(infoDATA)
  325. )}&code=${data.code}&deptName=${res.deptName}&deptId=${res.deptId}`,
  326. });
  327. }
  328. } else if (res.type == 'drugsBag') {
  329. //扫药包码
  330. uni.navigateTo({
  331. url: `/pages/scanning_drug/scanning_drug?drugsBagId=${res.drugsBagId}&drugsBagBatchNo=${res.drugsBagBatchNo}`,
  332. });
  333. } else if (res.type == 'nucleicAcid') {
  334. //扫核酸码
  335. uni.navigateTo({
  336. url: `/pages/scanning_nucleicAcid/scanning_nucleicAcid?qrcode=${data.code}`,
  337. });
  338. } else if (res.type == 'blood') {
  339. //扫血制品
  340. // 判断size,多个则进入新页面选择
  341. if(res.size > 1){
  342. uni.navigateTo({
  343. url: `/pages/bloodSelect/bloodSelect?qrcode=${data.code}&navigateTo=scanning_blood`,
  344. });
  345. } else {
  346. uni.navigateTo({
  347. url: `/pages/scanning_blood/scanning_blood?qrcode=${data.code}`,
  348. });
  349. }
  350. } else if (res.type == 'receiveOrder') {
  351. //扫快捷接单
  352. uni.showModal({
  353. title: "提示",
  354. content: `您本次接单包括${res.names.join('、')},一共含有${res.data.length}个工单,是否确认接单?`,
  355. success: function(result) {
  356. if (result.confirm) {
  357. uni.showLoading({
  358. title: "加载中",
  359. mask: true,
  360. });
  361. post("/workerOrder/receiveOrders", {ids: res.data.toString()}).then((result) => {
  362. uni.hideLoading();
  363. if (result.status == 200) {
  364. uni.showModal({
  365. title: "提示",
  366. content: `本次接单包括${res.names.join('、')},${res.data.length}个工单已接单完成`,
  367. showCancel: false,
  368. success: function(res) {
  369. if (res.confirm) {
  370. console.log("用户点击确定");
  371. uni.redirectTo({
  372. url: "../receiptpage/receiptpage",
  373. });
  374. } else if (res.cancel) {
  375. console.log("用户点击取消");
  376. }
  377. },
  378. });
  379. } else {
  380. uni.showToast({
  381. icon: "none",
  382. title: result.msg || "接口获取数据失败!",
  383. });
  384. }
  385. });
  386. } else if (result.cancel) {
  387. console.log("用户点击取消");
  388. }
  389. },
  390. });
  391. } else if (res.type == 'bloodTake') {
  392. if(res.data){
  393. //新血制品-扫科室
  394. uni.navigateTo({
  395. url: `/pages/newBlood/startOrderSignBlood/startOrderSignBlood?deptId=${res.deptId}&deptName=${res.deptName}&taskTypeId=${res.taskTypeId}`,
  396. });
  397. }else{
  398. // 走type是dept的流程
  399. // 扫描科室码
  400. // code: data.code //二维码
  401. let infoDATA = res.data;
  402. console.log(infoDATA)
  403. // 判断是否是标本配送,并且仅仅只有这一种业务类型,默认全选,并跳转到下一步;
  404. // 判断是否是标本轮巡 ,并且仅仅只有这一种业务类型,并且只有一个工单,默认选中,并跳转到下一步;
  405. if(Object.keys(infoDATA).length === 1 && (infoDATA.specimen || (infoDATA.specimenPlan && infoDATA.specimenPlan.length === 1))){
  406. this.infoDATA = infoDATA;
  407. this.workData = infoDATA.specimen || infoDATA.specimenPlan;
  408. this.tabType = infoDATA.specimen ? 'specimen' : 'specimenPlan';
  409. this.code = data.code;
  410. this.selectArr = [];
  411. for (var i = 0; i < this.workData.length; i++) {
  412. this.selectArr.push(this.workData[i].id);
  413. }
  414. this.userId.ids = this.selectArr;
  415. this.orderDeptHandler(true);
  416. }else{
  417. uni.navigateTo({
  418. url: `../scanning_all/scanning_all?infoDATA=${encodeURIComponent(
  419. JSON.stringify(infoDATA)
  420. )}&code=${data.code}&deptName=${res.deptName}&deptId=${res.deptId}`,
  421. });
  422. }
  423. }
  424. } else if(res.type == 'clinicalWaste'){
  425. // 医废
  426. if(res.wasteDetails){
  427. uni.navigateTo({
  428. url: `/pages/medicalWaste/medicalWasteDetail/medicalWasteDetail?qrcode=${res.code}`,
  429. });
  430. }else{
  431. uni.navigateTo({
  432. url: `/pages/medicalWaste/medicalWasteBind/medicalWasteBind?qrcode=${res.code}`,
  433. });
  434. }
  435. }
  436. } else {
  437. if(res.bigScanSpecialMsg){
  438. uni.navigateTo({
  439. url: `../scanning_big_Result/scanning_big_Result?msg=${res.msg || ''}&qrcode=${this.currentCode}&bigScanSpecialMsg=${encodeURIComponent(JSON.stringify(res.bigScanSpecialMsg))}`,
  440. });
  441. }else{
  442. uni.navigateTo({
  443. url: `../scanning_Result/scanning_Result?status=${res.status}&msg=${res.msg}&qrcode=${this.currentCode}`,
  444. });
  445. }
  446. }
  447. });
  448. } else {
  449. uni.hideLoading();
  450. uni.showToast({
  451. icon: "none",
  452. title: result.info || "接口获取数据失败!",
  453. });
  454. }
  455. })
  456. }).catch(err => {
  457. this.SMFlag = true;
  458. });
  459. },
  460. },
  461. onShow() {
  462. this.SMFlag = true;
  463. }
  464. };
  465. </script>
  466. <style lang="less">
  467. // 底部扫一扫
  468. .fixed-class{
  469. position: fixed;
  470. }
  471. .toolbar {
  472. // position: fixed;
  473. left: 0;
  474. right: 0;
  475. bottom: 30rpx;
  476. z-index: 999;
  477. height: 88rpx;
  478. display: flex;
  479. justify-content: center;
  480. align-items: center;
  481. box-sizing: border-box;
  482. border-radius: 4rpx;
  483. // box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.24);
  484. // background-color: #e5e9ed;
  485. .toolbar-icon {
  486. font-size: 52rpx;
  487. margin-right: 16rpx;
  488. color: #07863c;
  489. }
  490. .toolbar-sao {
  491. font-size: 36rpx;
  492. color: #333;
  493. }
  494. }
  495. </style>