smallScreen.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476
  1. <template>
  2. <view class="smallScreen">
  3. <view class="smallScreen_scan" @click="getInspectAndPatientTransform(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. <!-- 弹窗 -->
  11. <showModel :title="models4.title" :icon="models4.icon" :disjunctor="models4.disjunctor"
  12. :radioInspectionDistanceItem="models4.radioInspectionDistanceItem" @ok="ok4" @radioChange="radioChange4" :operate="models4.operate">
  13. </showModel>
  14. </view>
  15. </template>
  16. <script>
  17. import showModel from "../../components/showModel/showModel.vue";
  18. import selectAccount from "../../components/selectAccount/selectAccount.vue";
  19. import {
  20. post,
  21. SM
  22. } from "../../http/http.js";
  23. export default {
  24. data() {
  25. return {
  26. selectRadio: [], //单选框选中的数据,第一项是qrcode,第二项是名称
  27. // 单选框弹窗model1
  28. models4: {
  29. disjunctor: false,
  30. },
  31. hosId: uni.getStorageSync("userData").user.currentHospital.id,
  32. currentCode: '', //当前小扫描的科室二维码
  33. currentData: {}, //当前小扫描的工单对象
  34. // 填写交接人账号弹窗model
  35. hosModels: {
  36. disjunctor: false,
  37. },
  38. SMFlag:true,
  39. }
  40. },
  41. props: {
  42. sData: {
  43. type: Object
  44. },
  45. sType: {
  46. type: Number
  47. }
  48. },
  49. methods: {
  50. // 获取是否需要选择陪检方式
  51. getInspectAndPatientTransform(sData,sType){
  52. console.log(this.sData,this.sType);
  53. // 患者陪检,患者其他服务,工单状态是待到达
  54. if((this.sData.taskType.associationType.value === 'inspect' || this.sData.taskType.associationType.value === 'patientTransport') && this.sData.gdState.value == 4){
  55. const postData = {
  56. "idx":0,
  57. "sum":1,
  58. "taskTypeConfig":{
  59. "taskTypeDTO":{
  60. "hosId": {"id": this.hosId},
  61. "associationType": {
  62. "key": "association_types",
  63. "value":"inspect",
  64. },
  65. },
  66. },
  67. };
  68. uni.showLoading({
  69. mask: true,
  70. title: '加载中'
  71. })
  72. post("/simple/data/fetchDataList/taskTypeConfig", postData).then((res) => {
  73. console.log(res)
  74. if (res.status == 200) {
  75. res.list = res.list || [];
  76. if(res.list[0].signTypeIds){
  77. // 如果开启
  78. const postData = {
  79. "idx":0,
  80. "sum":9999,
  81. "workOrderInspectScore":{
  82. "hosId": this.hosId,
  83. },
  84. };
  85. post("/simple/data/fetchDataList/workOrderInspectScore", postData).then((res) => {
  86. console.log(res)
  87. uni.hideLoading();
  88. if (res.status == 200) {
  89. res.list = res.list || [];
  90. let radioInspectionDistanceItem = res.list.map(v => ({id: v.id + "__" + v.inspectMode, inspectMode: v.inspectMode}));
  91. console.log(radioInspectionDistanceItem)
  92. this.models4 = {
  93. disjunctor: true,
  94. title: "请选择陪检方式",
  95. radioInspectionDistanceItem,
  96. icon: "",
  97. operate: {
  98. ok: "确定",
  99. },
  100. };
  101. } else {
  102. uni.showToast({
  103. icon: "none",
  104. title: "请求失败!",
  105. });
  106. }
  107. })
  108. }else{
  109. this.Scan_ss(sData,sType);
  110. }
  111. } else {
  112. uni.hideLoading();
  113. uni.showToast({
  114. icon: "none",
  115. title: "请求失败!",
  116. });
  117. }
  118. })
  119. }else{
  120. this.Scan_ss(sData,sType);
  121. }
  122. },
  123. // 选中单选框
  124. radioChange4(item) {
  125. console.log(item);
  126. this.selectRadio = item.split("__");
  127. },
  128. // 确定
  129. ok4() {
  130. console.log(this.selectRadio);
  131. if (!this.selectRadio.length) {
  132. return;
  133. }
  134. this.models4.disjunctor = false;
  135. this.Scan_ss(this.sData,this.sType);
  136. },
  137. // 如果不是静配,药配,标本配送,标本轮巡
  138. // 科室签到(小扫描)
  139. nextDeptOrder_ss(data, accountObj) {
  140. console.log(this.currentCode);
  141. let isKs = 0;
  142. let ids = [];
  143. let id = data.id;
  144. ids.push(id);
  145. let list = {
  146. code: "",
  147. ids: ids,
  148. };
  149. let code = "";
  150. let type = "";
  151. if (this.currentCode) {
  152. let gdStateValue = data.gdState.value; //工单状态value
  153. let associationTypeValue = data.taskType.associationType.value; //关联类型value
  154. // 患者陪检,并且工单状态是待到达
  155. if (
  156. gdStateValue == "4" &&
  157. associationTypeValue == "inspect"
  158. ) {
  159. list.code = this.currentCode; //其他
  160. type = "handleIns";
  161. }
  162. // 其他临床服务,并且工单状态是待到达||工单状态待送达
  163. if (
  164. (associationTypeValue == "other" &&
  165. gdStateValue == "4") ||
  166. gdStateValue == "5"
  167. ) {
  168. code = this.currentCode;
  169. type = "orderSign/" + code;
  170. list = {
  171. ids
  172. };
  173. if (accountObj) {
  174. list.handover = [accountObj.accountId];
  175. }
  176. isKs = 1;
  177. }
  178. if (
  179. (gdStateValue == "5" &&
  180. associationTypeValue == "inspect") ||
  181. associationTypeValue == "patientTransport"
  182. ) {
  183. code = this.currentCode;
  184. type = "orderSign/" + code;
  185. list = {
  186. ids
  187. };
  188. if (accountObj) {
  189. list.handover = [accountObj.accountId];
  190. }
  191. isKs = 1;
  192. }
  193. if (gdStateValue == "8") {
  194. code = this.currentCode; //患者陪检--检查
  195. type = "orderSign/" + code;
  196. list = {
  197. ids
  198. };
  199. if (accountObj) {
  200. list.handover = [accountObj.accountId];
  201. }
  202. isKs = 1;
  203. }
  204. if (
  205. gdStateValue == "4" &&
  206. associationTypeValue == "patientTransport"
  207. ) {
  208. list = {
  209. code: this.currentCode, //患者转运--检查
  210. ids: ids,
  211. };
  212. type = "handleTrans";
  213. }
  214. if(gdStateValue == "4" && (associationTypeValue == "inspect" || associationTypeValue == "patientTransport")){
  215. console.log(this.selectRadio)
  216. list.inspectMode = this.selectRadio.length > 0 ? this.selectRadio[0] : undefined;
  217. }
  218. post("/workerOrder/" + type, list).then((res) => {
  219. uni.hideLoading();
  220. if (res) {
  221. if (res.status == 200) {
  222. if (
  223. gdStateValue == "4" &&
  224. associationTypeValue == "other"
  225. ) {
  226. uni.navigateTo({
  227. url: `../../pages/scanning_code/scanning_code?type=${associationTypeValue}&type1=${res.type}&id=${data.id}&deptCode=${code}&dept=${res.dept}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}`,
  228. });
  229. }
  230. if (
  231. gdStateValue == "4" &&
  232. associationTypeValue != "other"
  233. ) {
  234. uni.navigateTo({
  235. url: `../../pages/scanning_Result/scanning_Result?type=${
  236. associationTypeValue
  237. }&type1=${res.type}&id=${data.id}&deptCode=${
  238. list.code
  239. }&patient=${res.patient}&patientCode=${
  240. res.patientCode
  241. }&deptName=${res.deptName}&bedNum=${
  242. res.bedNum
  243. }&status=${res.status}&msg=${
  244. res.msg
  245. }&model=${encodeURIComponent(JSON.stringify(res))}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}`,
  246. });
  247. }
  248. if (gdStateValue == "8") {
  249. uni.navigateTo({
  250. url: `../../pages/scanning_code/scanning_code?type=${associationTypeValue}&type1=${res.type}&id=${data.id}&deptCode=${code}&dept=${res.dept}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}`,
  251. });
  252. }
  253. if (gdStateValue == "5") {
  254. uni.navigateTo({
  255. url: `../../pages/scanning_code/scanning_code?type=${associationTypeValue}&type1=${res.type}&id=${data.id}&deptCode=${code}&dept=${res.dept}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}`,
  256. });
  257. }
  258. } else {
  259. console.log(res, "扫描失败");
  260. if (res.type == "trans-ddd-1") {
  261. //起点科室扫描腕带码失败
  262. uni.navigateTo({
  263. url: `../../pages/scanning_Result/scanning_Result?type=${associationTypeValue}&type1=${res.type}&id=${data.id}&status=600&msg=${res.msg}&qrcode=${this.currentCode}`,
  264. });
  265. } else {
  266. uni.navigateTo({
  267. url: `../../pages/scanning_Result/scanning_Result?type=${
  268. associationTypeValue
  269. }&type1=${res.type}&id=${data.id}&status=600&msg=${
  270. res.msg
  271. }&isKs=${isKs}&model=${encodeURIComponent(
  272. JSON.stringify(res)
  273. )}&qrcode=${this.currentCode}`,
  274. });
  275. }
  276. }
  277. } else {
  278. uni.navigateTo({
  279. url: `../../pages/scanning_Result/scanning_Result?id=${data.id}&status=600&msg=扫码失败!请扫描正确的二维码!&isKs=${isKs}&qrcode=${this.currentCode}`,
  280. });
  281. }
  282. });
  283. }
  284. },
  285. // 如果不是患者陪检或患者转运或其他
  286. // 科室签到
  287. nextDeptOrder_s(data, accountObj) {
  288. console.log(this.currentCode);
  289. let ids = [];
  290. let id = data.id;
  291. ids.push(id);
  292. let code = "";
  293. let postData = {
  294. ids
  295. };
  296. if (accountObj) {
  297. postData.handover = [accountObj.accountId];
  298. }
  299. if (this.currentCode) {
  300. code = this.currentCode;
  301. // 科室签到
  302. post("/workerOrder/orderSign/" + code, postData).then((res) => {
  303. uni.hideLoading();
  304. if (res.status == 200) {
  305. // 跳转到扫描科室
  306. // type1: res.type, //type类型
  307. // id: data.id, //工单ID
  308. // deptCode: code, //二维码
  309. // dept: res.dept //科室名称
  310. console.log(data,'工单')
  311. let endDepts = data.endDepts.map(v=>v.id).toString();
  312. console.log(endDepts,'smallScreen');
  313. uni.navigateTo({
  314. 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}&endDepts=${endDepts}`,
  315. });
  316. } else {
  317. uni.navigateTo({
  318. 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}`,
  319. });
  320. }
  321. });
  322. }
  323. },
  324. // type==1 如果不是静配,药配,标本配送,标本轮巡
  325. // type==2 如果不是患者陪检,患者转运,其他
  326. // 扫码(小扫描)
  327. Scan_ss(data, type) {
  328. if (!this.SMFlag) {
  329. return;
  330. }
  331. this.SMFlag = false;
  332. this.currentData = data;
  333. console.log(data, 'data');
  334. SM().then((ress1) => {
  335. uni.showLoading({
  336. title: "加载中",
  337. mask: true,
  338. });
  339. //检验二维码的有效性
  340. post("/dept/scanning", {
  341. content: ress1,
  342. taskTypeId: data.taskType.id,
  343. gdState: data.gdState.id,
  344. }).then((result) => {
  345. this.SMFlag = true;
  346. this.currentCode = result.code;
  347. if (result.state == 200 || result.state == 201) {
  348. if (result.account) {
  349. if (type == 1) {
  350. this.nextDeptOrder_ss(this.currentData, {
  351. account: result.account,
  352. accountName: result.name,
  353. accountId: result.id,
  354. });
  355. } else if (type == 2) {
  356. this.nextDeptOrder_s(this.currentData, {
  357. account: result.account,
  358. accountName: result.name,
  359. accountId: result.id,
  360. });
  361. }
  362. } else {
  363. if (type == 1) {
  364. this.nextDeptOrder_ss(this.currentData);
  365. } else if (type == 2) {
  366. this.nextDeptOrder_s(this.currentData);
  367. }
  368. }
  369. } else if (result.state == '0000') {
  370. uni.hideLoading();
  371. this.showSelectAccount(); //yeye
  372. } else {
  373. uni.hideLoading();
  374. uni.showToast({
  375. icon: "none",
  376. title: "请求失败!",
  377. });
  378. }
  379. });
  380. }).catch(err=>{
  381. this.SMFlag = true;
  382. });
  383. },
  384. // 填写交接人账号-确认
  385. hosOk(data) {
  386. console.log(data);
  387. const {
  388. accountName,
  389. account,
  390. accountId
  391. } = data;
  392. if (!accountName && !account) {
  393. //没有填写交接人
  394. uni.showModal({
  395. title: '提示',
  396. content: "请填写交接人账号!",
  397. showCancel: false,
  398. success: function(res) {
  399. if (res.confirm) {
  400. console.log('用户点击确定');
  401. } else if (res.cancel) {
  402. console.log('用户点击取消');
  403. }
  404. }
  405. });
  406. return;
  407. } else if (!accountName && account || accountName && !account) {
  408. //没有填写交接人
  409. uni.showModal({
  410. title: '提示',
  411. content: "请填写正确的交接人账号!",
  412. showCancel: false,
  413. success: function(res) {
  414. if (res.confirm) {
  415. console.log('用户点击确定');
  416. } else if (res.cancel) {
  417. console.log('用户点击取消');
  418. }
  419. }
  420. });
  421. return;
  422. }
  423. this.hosModels.disjunctor = false;
  424. let associationTypeValue = this.currentData.taskType.associationType.value;
  425. console.log(associationTypeValue)
  426. if (
  427. associationTypeValue !== "patientTransport" &&
  428. associationTypeValue !== "inspect" &&
  429. associationTypeValue !== "other"
  430. ) {
  431. this.nextDeptOrder_s(this.currentData, data);
  432. }
  433. if (
  434. associationTypeValue !== "jPBag" &&
  435. associationTypeValue !== "drugsBag" &&
  436. associationTypeValue !== "specimen" &&
  437. associationTypeValue !== "specimenPlan"
  438. ) {
  439. this.nextDeptOrder_ss(this.currentData, data);
  440. }
  441. },
  442. // 填写交接人账号-取消
  443. hosCancel() {
  444. this.hosModels.disjunctor = false;
  445. },
  446. // 填写交接人账号弹窗
  447. showSelectAccount() {
  448. this.hosModels = {
  449. title: '填写交接人账号',
  450. disjunctor: true,
  451. }
  452. },
  453. },
  454. components: {
  455. selectAccount
  456. },
  457. onShow(){
  458. this.SMFlag = true;
  459. },
  460. };
  461. </script>
  462. <style lang="less">
  463. .smallScreen {
  464. width: 100%;
  465. height: 100%;
  466. .smallScreen_scan {
  467. width: 100%;
  468. height: 100%;
  469. }
  470. }
  471. </style>