scanning_B.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  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="buildAndOrderSign(res.data.id,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. // 接单并签到或建单并签到
  149. buildAndOrderSign(speId,orderId) {
  150. this.type = 'buildAndOrderSign';
  151. if(orderId){
  152. // 接单并签到
  153. this.type = 'specimenAssignAndSign';
  154. }else{
  155. // 建单并签到
  156. this.type = 'buildAndOrderSign';
  157. }
  158. uni.showLoading({
  159. title: "加载中",
  160. mask: true,
  161. });
  162. let postData = {
  163. speId
  164. }
  165. if(orderId){
  166. // 接单并签到
  167. postData.orderId = orderId;
  168. }
  169. post("/workerOrder/specimenCreateAndSign", postData).then((res) => {
  170. if (res.state == 200 || res.state == 201) {
  171. uni.hideLoading();
  172. if (res.status == 200) {
  173. // 跳转到扫描科室
  174. // type1: res.type, //type类型
  175. // id: data.id, //工单ID
  176. // deptCode: code, //二维码
  177. // dept: res.dept //科室名称
  178. uni.navigateTo({
  179. url: `/pages/scanning_code/scanning_code?type=${
  180. res.workOrder.taskType.associationType.value
  181. }&type1=${res.type}&id=${res.workOrder.id}&deptCode=${
  182. this.currentCode
  183. }&dept=${res.dept}&accountObj=${encodeURIComponent(
  184. JSON.stringify(undefined)
  185. )}&deptId=${res.deptId}`,
  186. });
  187. } else {
  188. uni.navigateTo({
  189. 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`,
  190. });
  191. }
  192. } else if (res.state == "0000") {
  193. uni.hideLoading();
  194. this.currentCode = res.code;
  195. this.res.workOrder = res.workOrder;
  196. this.showSelectAccount();
  197. } else {
  198. uni.hideLoading();
  199. uni.showToast({
  200. icon: "none",
  201. title: res.msg || "请求失败!",
  202. });
  203. }
  204. });
  205. },
  206. // 填写交接人账号-确认
  207. hosOk(data) {
  208. console.log(data);
  209. const {
  210. accountName,
  211. account,
  212. accountId
  213. } = data;
  214. if (!accountName && !account) {
  215. //没有填写交接人
  216. uni.showModal({
  217. title: "提示",
  218. content: "请填写交接人账号!",
  219. showCancel: false,
  220. success: function(res) {
  221. if (res.confirm) {
  222. console.log("用户点击确定");
  223. } else if (res.cancel) {
  224. console.log("用户点击取消");
  225. }
  226. },
  227. });
  228. return;
  229. } else if ((!accountName && account) || (accountName && !account)) {
  230. //没有填写交接人
  231. uni.showModal({
  232. title: "提示",
  233. content: "请填写正确的交接人账号!",
  234. showCancel: false,
  235. success: function(res) {
  236. if (res.confirm) {
  237. console.log("用户点击确定");
  238. } else if (res.cancel) {
  239. console.log("用户点击取消");
  240. }
  241. },
  242. });
  243. return;
  244. }
  245. this.hosModels.disjunctor = false;
  246. uni.showLoading({
  247. title: "加载中",
  248. mask: true,
  249. });
  250. this.nextDeptOrder_s(this.res.workOrder, data);
  251. },
  252. // 填写交接人账号-取消
  253. hosCancel() {
  254. this.hosModels.disjunctor = false;
  255. },
  256. // 填写交接人账号弹窗
  257. showSelectAccount() {
  258. this.hosModels = {
  259. title: "填写交接人账号",
  260. disjunctor: true,
  261. };
  262. },
  263. // 知道了
  264. showAlert() {
  265. uni.navigateTo({
  266. url: "../receiptpage/receiptpage",
  267. });
  268. },
  269. },
  270. onLoad(options) {
  271. this.res = JSON.parse(options.res);
  272. this.infoDATA = JSON.parse(options.infoDATA); //详细信息
  273. console.log(this.infoDATA);
  274. // #ifdef APP-PLUS
  275. webHandle("no", "app");
  276. // #endif
  277. // #ifdef H5
  278. webHandle("no", "wx");
  279. // #endif
  280. },
  281. };
  282. </script>
  283. <style lang="less">
  284. .Scanning_B {
  285. padding: 0px 74rpx;
  286. .uni-modal__btn_primary {
  287. color: #49b856 !important;
  288. }
  289. .Scanning_top {
  290. height: 270rpx;
  291. .Scanning_top_icon {
  292. width: 140rpx;
  293. height: 140rpx;
  294. margin: 0 auto;
  295. margin-top: 116rpx;
  296. border-radius: 50%;
  297. line-height: 140rpx;
  298. text-align: center;
  299. .cubeic-ok {
  300. font-size: 140rpx;
  301. color: #35b34a;
  302. }
  303. .cubeic-close {
  304. font-size: 140rpx;
  305. color: #ff3b53;
  306. }
  307. }
  308. .Scanning_top_text {
  309. .text1 {
  310. margin-top: 40rpx;
  311. font-size: 48rpx;
  312. text-align: center;
  313. }
  314. }
  315. }
  316. .Scanning_cont {
  317. font-size: 32rpx;
  318. view {
  319. margin-bottom: 16rpx;
  320. text-align: center;
  321. }
  322. .text {
  323. margin-top: 24rpx;
  324. color: #35b34a;
  325. }
  326. .text1 {
  327. margin-top: 24rpx;
  328. color: #ff3b53;
  329. }
  330. }
  331. .foot_btn {
  332. line-height: 88rpx;
  333. height: 100rpx;
  334. margin-top: 40rpx;
  335. display: flex;
  336. justify-content: center;
  337. .btn3 {
  338. flex: 1;
  339. height: 88rpx;
  340. background-image: linear-gradient(to right, #72c172, #3bb197);
  341. color: #fff;
  342. border-radius: 8rpx;
  343. font-size: 32rpx;
  344. margin-top: 16rpx;
  345. margin-right: 16rpx;
  346. text-align: center;
  347. &:last-of-type {
  348. margin-right: 0;
  349. }
  350. }
  351. }
  352. }
  353. </style>