smallScreen.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. <template>
  2. <view class="smallScreen">
  3. <view class="smallScreen_scan" @click="Scan_ss(sData,sType)">
  4. <slot></slot>
  5. </view>
  6. <!-- 填写交接人账号弹窗 -->
  7. <selectAccount v-if="hosModels.disjunctor" :title="hosModels.title" :disjunctor="hosModels.disjunctor" @ok="hosOk"
  8. @cancel="hosCancel">
  9. </selectAccount>
  10. </view>
  11. </template>
  12. <script>
  13. import selectAccount from "../../components/selectAccount/selectAccount.vue";
  14. import {
  15. post,
  16. SM
  17. } from "../../http/http.js";
  18. export default {
  19. data() {
  20. return {
  21. currentCode: '', //当前小扫描的科室二维码
  22. currentData: {}, //当前小扫描的工单对象
  23. // 填写交接人账号弹窗model
  24. hosModels: {
  25. disjunctor: false,
  26. },
  27. SMFlag:true,
  28. }
  29. },
  30. props: {
  31. sData: {
  32. type: Object
  33. },
  34. sType: {
  35. type: Number
  36. }
  37. },
  38. methods: {
  39. // 如果不是静配,药配,标本配送,标本轮巡
  40. // 科室签到(小扫描)
  41. nextDeptOrder_ss(data, accountObj) {
  42. let isKs = 0;
  43. let ids = [];
  44. let id = data.id;
  45. ids.push(id);
  46. let list = {
  47. code: "",
  48. ids: ids,
  49. };
  50. let code = "";
  51. let type = "";
  52. if (this.currentCode) {
  53. let gdStateValue = data.gdState.value; //工单状态value
  54. let associationTypeValue = data.taskType.associationType.value; //关联类型value
  55. // 患者陪检,并且工单状态是待到达
  56. if (
  57. gdStateValue == "4" &&
  58. associationTypeValue == "inspect"
  59. ) {
  60. list.code = this.currentCode; //其他
  61. type = "handleIns";
  62. }
  63. // 其他临床服务,并且工单状态是待到达||工单状态待送达
  64. if (
  65. (associationTypeValue == "other" &&
  66. gdStateValue == "4") ||
  67. gdStateValue == "5"
  68. ) {
  69. code = this.currentCode;
  70. type = "orderSign/" + code;
  71. list = {
  72. ids
  73. };
  74. if (accountObj) {
  75. list.handover = [accountObj.accountId];
  76. }
  77. isKs = 1;
  78. }
  79. if (
  80. (gdStateValue == "5" &&
  81. associationTypeValue == "inspect") ||
  82. associationTypeValue == "patientTransport"
  83. ) {
  84. code = this.currentCode;
  85. type = "orderSign/" + code;
  86. list = {
  87. ids
  88. };
  89. if (accountObj) {
  90. list.handover = [accountObj.accountId];
  91. }
  92. isKs = 1;
  93. }
  94. if (gdStateValue == "8") {
  95. code = this.currentCode; //患者陪检--检查
  96. type = "orderSign/" + code;
  97. list = {
  98. ids
  99. };
  100. if (accountObj) {
  101. list.handover = [accountObj.accountId];
  102. }
  103. isKs = 1;
  104. }
  105. if (
  106. gdStateValue == "4" &&
  107. associationTypeValue == "patientTransport"
  108. ) {
  109. list = {
  110. code: this.currentCode, //患者转运--检查
  111. ids: ids,
  112. };
  113. type = "handleTrans";
  114. }
  115. post("/workerOrder/" + type, list).then((res) => {
  116. uni.hideLoading();
  117. if (res) {
  118. if (res.status == 200) {
  119. if (
  120. gdStateValue == "4" &&
  121. associationTypeValue == "other"
  122. ) {
  123. uni.navigateTo({
  124. url: `../../pages/scanning_code/scanning_code?type=${associationTypeValue}&type1=${res.type}&id=${data.id}&deptCode=${code}&dept=${res.dept}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}`,
  125. });
  126. }
  127. if (
  128. gdStateValue == "4" &&
  129. associationTypeValue != "other"
  130. ) {
  131. uni.navigateTo({
  132. url: `../../pages/scanning_Result/scanning_Result?type=${
  133. associationTypeValue
  134. }&type1=${res.type}&id=${data.id}&deptCode=${
  135. list.code
  136. }&patient=${res.patient}&patientCode=${
  137. res.patientCode
  138. }&deptName=${res.deptName}&bedNum=${
  139. res.bedNum
  140. }&status=${res.status}&msg=${
  141. res.msg
  142. }&model=${encodeURIComponent(JSON.stringify(res))}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}`,
  143. });
  144. }
  145. if (gdStateValue == "8") {
  146. uni.navigateTo({
  147. url: `../../pages/scanning_code/scanning_code?type=${associationTypeValue}&type1=${res.type}&id=${data.id}&deptCode=${code}&dept=${res.dept}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}`,
  148. });
  149. }
  150. if (gdStateValue == "5") {
  151. uni.navigateTo({
  152. url: `../../pages/scanning_code/scanning_code?type=${associationTypeValue}&type1=${res.type}&id=${data.id}&deptCode=${code}&dept=${res.dept}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}`,
  153. });
  154. }
  155. } else {
  156. console.log(res, "扫描失败");
  157. if (res.type == "trans-ddd-1") {
  158. //起点科室扫描腕带码失败
  159. uni.navigateTo({
  160. url: `../../pages/scanning_Result/scanning_Result?type=${associationTypeValue}&type1=${res.type}&id=${data.id}&status=600&msg=${res.msg}`,
  161. });
  162. } else {
  163. uni.navigateTo({
  164. url: `../../pages/scanning_Result/scanning_Result?type=${
  165. associationTypeValue
  166. }&type1=${res.type}&id=${data.id}&status=600&msg=${
  167. res.msg
  168. }&isKs=${isKs}&model=${encodeURIComponent(
  169. JSON.stringify(res)
  170. )}`,
  171. });
  172. }
  173. }
  174. } else {
  175. uni.navigateTo({
  176. url: `../../pages/scanning_Result/scanning_Result?id=${data.id}&status=600&msg=扫码失败!请扫描正确的二维码!&isKs=${isKs}`,
  177. });
  178. }
  179. });
  180. }
  181. },
  182. // 如果不是患者陪检或患者转运或其他
  183. // 科室签到
  184. nextDeptOrder_s(data, accountObj) {
  185. console.log(data, accountObj)
  186. let ids = [];
  187. let id = data.id;
  188. ids.push(id);
  189. let code = "";
  190. let postData = {
  191. ids
  192. };
  193. if (accountObj) {
  194. postData.handover = [accountObj.accountId];
  195. }
  196. if (this.currentCode) {
  197. code = this.currentCode;
  198. // 科室签到
  199. post("/workerOrder/orderSign/" + code, postData).then((res) => {
  200. uni.hideLoading();
  201. if (res.status == 200) {
  202. // 跳转到扫描科室
  203. // type1: res.type, //type类型
  204. // id: data.id, //工单ID
  205. // deptCode: code, //二维码
  206. // dept: res.dept //科室名称
  207. uni.navigateTo({
  208. url: `../../pages/scanning_code/scanning_code?type=${data.taskType.associationType.value}&type1=${res.type}&id=${data.id}&deptCode=${code}&dept=${res.dept}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}&deptId=${res.deptId}`,
  209. });
  210. } else {
  211. uni.navigateTo({
  212. url: `../../pages/scanning_Result/scanning_Result?type=${data.taskType.associationType.value}&type1=${res.type}&id=${data.id}&status=600&msg=${res.msg}&isKs=1`,
  213. });
  214. }
  215. });
  216. }
  217. },
  218. // type==1 如果不是静配,药配,标本配送,标本轮巡
  219. // type==2 如果不是患者陪检,患者转运,其他
  220. // 扫码(小扫描)
  221. Scan_ss(data, type) {
  222. if (!this.SMFlag) {
  223. return;
  224. }
  225. this.SMFlag = false;
  226. this.currentData = data;
  227. console.log(data, 'data');
  228. SM().then((ress1) => {
  229. uni.showLoading({
  230. title: "加载中",
  231. mask: true,
  232. });
  233. //检验二维码的有效性
  234. post("/dept/scanning", {
  235. content: ress1,
  236. taskTypeId: data.taskType.id,
  237. gdState: data.gdState.id,
  238. }).then((result) => {
  239. this.SMFlag = true;
  240. this.currentCode = result.code;
  241. if (result.state == 200 || result.state == 201) {
  242. if (result.account) {
  243. if (type == 1) {
  244. this.nextDeptOrder_ss(this.currentData, {
  245. account: result.account,
  246. accountName: result.name,
  247. accountId: result.id,
  248. });
  249. } else if (type == 2) {
  250. this.nextDeptOrder_s(this.currentData, {
  251. account: result.account,
  252. accountName: result.name,
  253. accountId: result.id,
  254. });
  255. }
  256. } else {
  257. if (type == 1) {
  258. this.nextDeptOrder_ss(this.currentData);
  259. } else if (type == 2) {
  260. this.nextDeptOrder_s(this.currentData);
  261. }
  262. }
  263. } else if (result.state == '0000') {
  264. uni.hideLoading();
  265. this.showSelectAccount(); //yeye
  266. } else {
  267. uni.hideLoading();
  268. uni.showToast({
  269. icon: "none",
  270. title: "请求失败!",
  271. });
  272. }
  273. });
  274. }).catch(err=>{
  275. this.SMFlag = true;
  276. });
  277. },
  278. // 填写交接人账号-确认
  279. hosOk(data) {
  280. console.log(data);
  281. const {
  282. accountName,
  283. account,
  284. accountId
  285. } = data;
  286. if (!accountName && !account) {
  287. //没有填写交接人
  288. uni.showModal({
  289. title: '提示',
  290. content: "请填写交接人账号!",
  291. showCancel: false,
  292. success: function(res) {
  293. if (res.confirm) {
  294. console.log('用户点击确定');
  295. } else if (res.cancel) {
  296. console.log('用户点击取消');
  297. }
  298. }
  299. });
  300. return;
  301. } else if (!accountName && account || accountName && !account) {
  302. //没有填写交接人
  303. uni.showModal({
  304. title: '提示',
  305. content: "请填写正确的交接人账号!",
  306. showCancel: false,
  307. success: function(res) {
  308. if (res.confirm) {
  309. console.log('用户点击确定');
  310. } else if (res.cancel) {
  311. console.log('用户点击取消');
  312. }
  313. }
  314. });
  315. return;
  316. }
  317. this.hosModels.disjunctor = false;
  318. let associationTypeValue = this.currentData.taskType.associationType.value;
  319. console.log(associationTypeValue)
  320. if (
  321. associationTypeValue !== "patientTransport" &&
  322. associationTypeValue !== "inspect" &&
  323. associationTypeValue !== "other"
  324. ) {
  325. this.nextDeptOrder_s(this.currentData, data);
  326. }
  327. if (
  328. associationTypeValue !== "jPBag" &&
  329. associationTypeValue !== "drugsBag" &&
  330. associationTypeValue !== "specimen" &&
  331. associationTypeValue !== "specimenPlan"
  332. ) {
  333. this.nextDeptOrder_ss(this.currentData, data);
  334. }
  335. },
  336. // 填写交接人账号-取消
  337. hosCancel() {
  338. this.hosModels.disjunctor = false;
  339. },
  340. // 填写交接人账号弹窗
  341. showSelectAccount() {
  342. this.hosModels = {
  343. title: '填写交接人账号',
  344. disjunctor: true,
  345. }
  346. },
  347. },
  348. components: {
  349. selectAccount
  350. },
  351. onShow(){
  352. this.SMFlag = true;
  353. }
  354. };
  355. </script>
  356. <style lang="less">
  357. .smallScreen {
  358. width: 100%;
  359. height: 100%;
  360. .smallScreen_scan {
  361. width: 100%;
  362. height: 100%;
  363. }
  364. }
  365. </style>