scanning_B.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. <template>
  2. <view class="Scanning_B">
  3. <view class="Scanning_top" v-if="res.status == 200 || res.status == 666">
  4. <view class="Scanning_top_icon">
  5. <text class="cubeic-ok icon_transport transport-duigou"></text>
  6. </view>
  7. <view class="Scanning_top_text">
  8. <view class="text1" v-if="res.status == 200">扫描成功</view>
  9. <view class="text1" v-else-if="res.status == 666">查询成功</view>
  10. </view>
  11. </view>
  12. <view class="Scanning_top" v-if="res.status != 200 && res.status != 666">
  13. <view class="Scanning_top_icon">
  14. <text class="cubeic-close icon_transport transport-shibai"></text>
  15. </view>
  16. <view class="Scanning_top_text">
  17. <view class="text1">扫描失败</view>
  18. </view>
  19. </view>
  20. <view class="Scanning_cont" v-if="res.status == 200 || res.status == 666">
  21. <view>标本类型 : {{ infoDATA.stype.name || "-" }}</view>
  22. <view>标本编码 : {{ infoDATA.scode || "-" }}</view>
  23. <view>标本状态 : {{ res.data.speState ? res.data.speState.name : "-" }}</view>
  24. <view>申请科室 : {{ infoDATA.sickRoom || "-" }}</view>
  25. <view>检验科室 : {{ infoDATA.checkDept || "-" }}</view>
  26. <view>检验项目 : {{ res.data.specimenDesc || "-" }}</view>
  27. <view>患者姓名 : {{ res.data.patientName}}<text v-if="res.data.bedNum">({{res.data.bedNum}})</text></view>
  28. <view>住院号 : {{ res.data.residenceNo || "-" }}</view>
  29. </view>
  30. <view class="Scanning_cont" v-else>
  31. <view>{{ res.msg }}</view>
  32. </view>
  33. <view class="foot_btn">
  34. <view class="btn3" @click="showAlert()">知道了</view>
  35. <block v-if="res.scanCodeSpecimenOrderSign == 1">
  36. <view class="btn3" @click="specimenAssignAndSign(res.workOrder.id)" v-if="res.workOrder&&(res.workOrder.gdState.value == 2||res.workOrder.gdState.value == 4)">接单并签到</view>
  37. <view class="btn3" @click="orderSign(res.workOrder)" v-if="res.workOrder&&res.workOrder.gdState.value != 2&&res.workOrder.gdState.value != 4">执行工单</view>
  38. <view class="btn3" @click="buildAndOrderSign(res.data.id)" v-if="!res.workOrder && res.data">建单并签到</view>
  39. </block>
  40. </view>
  41. <!-- 填写交接人账号弹窗 -->
  42. <selectAccount v-if="hosModels.disjunctor" :title="hosModels.title" :disjunctor="hosModels.disjunctor" @ok="hosOk"
  43. @cancel="hosCancel">
  44. </selectAccount>
  45. </view>
  46. </template>
  47. <script>
  48. import {
  49. post,
  50. webHandle
  51. } from "../../http/http.js";
  52. export default {
  53. data() {
  54. return {
  55. infoDATA: {},
  56. res: {},
  57. // 填写交接人账号弹窗model
  58. hosModels: {
  59. disjunctor: false,
  60. },
  61. currentCode: "",
  62. type: "", //类型,orderSign|buildAndOrderSign
  63. };
  64. },
  65. methods: {
  66. // 如果不是患者陪检或患者转运或其他
  67. // 科室签到
  68. nextDeptOrder_s(data, accountObj) {
  69. console.log(data, accountObj);
  70. let ids = [];
  71. let id = data.id;
  72. ids.push(id);
  73. let code = "";
  74. let postData = {
  75. ids,
  76. };
  77. if (this.type === 'orderSign') {
  78. postData.specimenOrderSign = data.specimenSet.map(v => v.id); //破坏性,必须扫标本
  79. }
  80. if (accountObj) {
  81. postData.handover = [accountObj.accountId];
  82. }
  83. if (this.currentCode) {
  84. code = this.currentCode;
  85. // 科室签到
  86. post("/workerOrder/orderSign/" + code, postData).then((res) => {
  87. uni.hideLoading();
  88. if (res.status == 200) {
  89. // 跳转到扫描科室
  90. // type1: res.type, //type类型
  91. // id: data.id, //工单ID
  92. // deptCode: code, //二维码
  93. // dept: res.dept //科室名称
  94. uni.navigateTo({
  95. url: `/pages/scanning_code/scanning_code?type=${
  96. data.taskType.associationType.value
  97. }&type1=${res.type}&id=${data.id}&deptCode=${code}&dept=${
  98. res.dept
  99. }&accountObj=${encodeURIComponent(
  100. JSON.stringify(accountObj)
  101. )}&deptId=${res.deptId}`,
  102. });
  103. } else {
  104. uni.navigateTo({
  105. url: `/pages/scanning_Result/scanning_Result?type=${data.taskType.associationType.value}&type1=${res.type}&id=${data.id}&status=600&msg=${res.msg}&isKs=1&qrcode=${this.currentCode}`,
  106. });
  107. }
  108. });
  109. }
  110. },
  111. // 执行工单
  112. orderSign(workOrder) {
  113. this.type = 'orderSign';
  114. uni.showLoading({
  115. title: "加载中",
  116. mask: true,
  117. });
  118. let postData = {
  119. content: workOrder.startDept.qrcode,
  120. taskTypeId: workOrder.taskType.id,
  121. gdState: workOrder.gdState.id,
  122. };
  123. //检验二维码的有效性
  124. post("/dept/scanning", postData).then((result) => {
  125. this.currentCode = result.code;
  126. if (result.state == 200 || result.state == 201) {
  127. if (result.account) {
  128. this.nextDeptOrder_s(workOrder, {
  129. account: result.account,
  130. accountName: result.name,
  131. accountId: result.id,
  132. });
  133. } else {
  134. this.nextDeptOrder_s(workOrder);
  135. }
  136. } else if (result.state == "0000") {
  137. uni.hideLoading();
  138. this.showSelectAccount();
  139. } else {
  140. uni.hideLoading();
  141. uni.showToast({
  142. icon: "none",
  143. title: "请求失败!",
  144. });
  145. }
  146. });
  147. },
  148. // 接单并签到workorderId
  149. specimenAssignAndSign(orderId) {
  150. this.type = 'specimenAssignAndSign';
  151. uni.showLoading({
  152. title: "加载中",
  153. mask: true,
  154. });
  155. post("/workerOrder/specimenAssignAndSign", {
  156. orderId,
  157. }).then((res) => {
  158. if (res.state == 200 || res.state == 201) {
  159. uni.hideLoading();
  160. if (res.status == 200) {
  161. // 跳转到扫描科室
  162. // type1: res.type, //type类型
  163. // id: data.id, //工单ID
  164. // deptCode: code, //二维码
  165. // dept: res.dept //科室名称
  166. uni.navigateTo({
  167. url: `/pages/scanning_code/scanning_code?type=${
  168. res.workOrder.taskType.associationType.value
  169. }&type1=${res.type}&id=${res.workOrder.id}&deptCode=${
  170. this.currentCode
  171. }&dept=${res.dept}&accountObj=${encodeURIComponent(
  172. JSON.stringify(undefined)
  173. )}&deptId=${res.deptId}`,
  174. });
  175. } else {
  176. uni.navigateTo({
  177. url: `/pages/scanning_Result/scanning_Result?type=${res.workOrder.taskType.associationType.value}&type1=${res.type}&id=${res.workOrder.id}&status=600&msg=${res.msg}&isKs=1`,
  178. });
  179. }
  180. } else if (res.state == "0000") {
  181. uni.hideLoading();
  182. this.currentCode = res.code;
  183. this.res.workOrder = res.workOrder;
  184. this.showSelectAccount();
  185. } else {
  186. uni.hideLoading();
  187. uni.showToast({
  188. icon: "none",
  189. title: res.msg || "请求失败!",
  190. });
  191. }
  192. });
  193. },
  194. // 建单并签到
  195. buildAndOrderSign(speId) {
  196. this.type = 'buildAndOrderSign';
  197. uni.showLoading({
  198. title: "加载中",
  199. mask: true,
  200. });
  201. post("/workerOrder/specimenCreateAndSign", {
  202. speId,
  203. }).then((res) => {
  204. if (res.state == 200 || res.state == 201) {
  205. uni.hideLoading();
  206. if (res.status == 200) {
  207. // 跳转到扫描科室
  208. // type1: res.type, //type类型
  209. // id: data.id, //工单ID
  210. // deptCode: code, //二维码
  211. // dept: res.dept //科室名称
  212. uni.navigateTo({
  213. url: `/pages/scanning_code/scanning_code?type=${
  214. res.workOrder.taskType.associationType.value
  215. }&type1=${res.type}&id=${res.workOrder.id}&deptCode=${
  216. this.currentCode
  217. }&dept=${res.dept}&accountObj=${encodeURIComponent(
  218. JSON.stringify(undefined)
  219. )}&deptId=${res.deptId}`,
  220. });
  221. } else {
  222. uni.navigateTo({
  223. url: `/pages/scanning_Result/scanning_Result?type=${res.workOrder.taskType.associationType.value}&type1=${res.type}&id=${res.workOrder.id}&status=600&msg=${res.msg}&isKs=1`,
  224. });
  225. }
  226. } else if (res.state == "0000") {
  227. uni.hideLoading();
  228. this.currentCode = res.code;
  229. this.res.workOrder = res.workOrder;
  230. this.showSelectAccount();
  231. } else {
  232. uni.hideLoading();
  233. uni.showToast({
  234. icon: "none",
  235. title: res.msg || "请求失败!",
  236. });
  237. }
  238. });
  239. },
  240. // 填写交接人账号-确认
  241. hosOk(data) {
  242. console.log(data);
  243. const {
  244. accountName,
  245. account,
  246. accountId
  247. } = data;
  248. if (!accountName && !account) {
  249. //没有填写交接人
  250. uni.showModal({
  251. title: "提示",
  252. content: "请填写交接人账号!",
  253. showCancel: false,
  254. success: function(res) {
  255. if (res.confirm) {
  256. console.log("用户点击确定");
  257. } else if (res.cancel) {
  258. console.log("用户点击取消");
  259. }
  260. },
  261. });
  262. return;
  263. } else if ((!accountName && account) || (accountName && !account)) {
  264. //没有填写交接人
  265. uni.showModal({
  266. title: "提示",
  267. content: "请填写正确的交接人账号!",
  268. showCancel: false,
  269. success: function(res) {
  270. if (res.confirm) {
  271. console.log("用户点击确定");
  272. } else if (res.cancel) {
  273. console.log("用户点击取消");
  274. }
  275. },
  276. });
  277. return;
  278. }
  279. this.hosModels.disjunctor = false;
  280. uni.showLoading({
  281. title: "加载中",
  282. mask: true,
  283. });
  284. this.nextDeptOrder_s(this.res.workOrder, data);
  285. },
  286. // 填写交接人账号-取消
  287. hosCancel() {
  288. this.hosModels.disjunctor = false;
  289. },
  290. // 填写交接人账号弹窗
  291. showSelectAccount() {
  292. this.hosModels = {
  293. title: "填写交接人账号",
  294. disjunctor: true,
  295. };
  296. },
  297. // 知道了
  298. showAlert() {
  299. uni.navigateTo({
  300. url: "../receiptpage/receiptpage",
  301. });
  302. },
  303. },
  304. onLoad(options) {
  305. this.res = JSON.parse(options.res);
  306. this.infoDATA = JSON.parse(options.infoDATA); //详细信息
  307. console.log(this.infoDATA);
  308. // #ifdef APP-PLUS
  309. webHandle("no", "app");
  310. // #endif
  311. // #ifdef H5
  312. webHandle("no", "wx");
  313. // #endif
  314. },
  315. };
  316. </script>
  317. <style lang="less">
  318. .Scanning_B {
  319. padding: 0px 74rpx;
  320. .uni-modal__btn_primary {
  321. color: #49b856 !important;
  322. }
  323. .Scanning_top {
  324. height: 270rpx;
  325. .Scanning_top_icon {
  326. width: 140rpx;
  327. height: 140rpx;
  328. margin: 0 auto;
  329. margin-top: 116rpx;
  330. border-radius: 50%;
  331. line-height: 140rpx;
  332. text-align: center;
  333. .cubeic-ok {
  334. font-size: 140rpx;
  335. color: #35b34a;
  336. }
  337. .cubeic-close {
  338. font-size: 140rpx;
  339. color: #ff3b53;
  340. }
  341. }
  342. .Scanning_top_text {
  343. .text1 {
  344. margin-top: 40rpx;
  345. font-size: 48rpx;
  346. text-align: center;
  347. }
  348. }
  349. }
  350. .Scanning_cont {
  351. font-size: 32rpx;
  352. view {
  353. margin-bottom: 16rpx;
  354. text-align: center;
  355. }
  356. .text {
  357. margin-top: 24rpx;
  358. color: #35b34a;
  359. }
  360. .text1 {
  361. margin-top: 24rpx;
  362. color: #ff3b53;
  363. }
  364. }
  365. .foot_btn {
  366. line-height: 88rpx;
  367. height: 100rpx;
  368. margin-top: 40rpx;
  369. display: flex;
  370. justify-content: center;
  371. .btn3 {
  372. flex: 1;
  373. height: 88rpx;
  374. background-image: linear-gradient(to right, #72c172, #3bb197);
  375. color: #fff;
  376. border-radius: 8rpx;
  377. font-size: 32rpx;
  378. margin-top: 16rpx;
  379. margin-right: 16rpx;
  380. text-align: center;
  381. &:last-of-type {
  382. margin-right: 0;
  383. }
  384. }
  385. }
  386. }
  387. </style>