sendBackPatient.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424
  1. <template>
  2. <view class="Scanning_Result">
  3. <view class="Scanning_top">
  4. 患者总数量:<text class="green">{{patientList.length}}</text>
  5. </view>
  6. <view class="Scanning_cont">
  7. <scroll-view scroll-y class="scrollContent">
  8. <view class="column" v-for="(item, index) in patientList" :key="item.id">
  9. <view class="top">
  10. <text class="orders green">{{index + 1}}</text>
  11. <view class="name">姓名:</view>
  12. <view class="value">{{item.patientName}}</view>
  13. </view>
  14. <view class="bottom">
  15. <view class="name">住院号:</view>
  16. <view class="value">{{item.residenceNo}}</view>
  17. </view>
  18. </view>
  19. </scroll-view>
  20. </view>
  21. <view class="foot_btn_spe">
  22. <view class="column">
  23. <view class="btn" @click="scan()">扫一扫</view>
  24. <view class="btn" @click="hand_again()">手动录入</view>
  25. </view>
  26. <view class="column" v-if="patientList.length">
  27. <view class="btn" @click="scanDept()">建单</view>
  28. </view>
  29. </view>
  30. <!-- 手动查询患者弹窗 -->
  31. <handViewPatient v-if="patientModels.disjunctor" :title="patientModels.title"
  32. :disjunctor="patientModels.disjunctor" @ok="patientOk" @cancel="patientCancel">
  33. </handViewPatient>
  34. </view>
  35. </template>
  36. <script>
  37. import {
  38. get,
  39. post,
  40. SM,
  41. webHandle
  42. } from "@/http/http.js";
  43. export default {
  44. data() {
  45. return {
  46. hosId: uni.getStorageSync("userData").user.currentHospital.id,
  47. patientList: [],//患者列表
  48. queryObj: {}, //路由传递过来的数据
  49. scanCount: '', //已扫描数量
  50. SMFlag: true,
  51. // 手动查询弹窗model
  52. patientModels: {
  53. disjunctor: false,
  54. },
  55. };
  56. },
  57. onShow() {
  58. this.SMFlag = true;
  59. },
  60. methods: {
  61. // 送回病房-扫描科室
  62. scanDept() {
  63. if (!this.SMFlag) {
  64. return;
  65. }
  66. this.SMFlag = false;
  67. let code = "";
  68. SM().then((ress1) => {
  69. uni.showLoading({
  70. title: "加载中",
  71. mask: true,
  72. });
  73. //检验二维码的有效性
  74. post("/dept/scanning", {
  75. content: ress1,
  76. }).then((result) => {
  77. this.SMFlag = true;
  78. if (result.state == 200 || result.state == 201) {
  79. let ress = result.code;
  80. if (ress) {
  81. code = ress;
  82. // 科室扫描
  83. let postData = {
  84. "type": "query",
  85. "qrCode": code
  86. };
  87. post("/dept/scanChangeDept", postData).then((res) => {
  88. uni.hideLoading();
  89. if (res.status == 200) {
  90. if (res.data) {
  91. if(res.data.deptDTO){
  92. this.currentStartDept = res.data.deptDTO;
  93. }else{
  94. this.currentStartDept = res.data;
  95. }
  96. this.buildOrder();
  97. } else {
  98. uni.hideLoading();
  99. uni.showToast({
  100. icon: "none",
  101. title: "请扫描正确的科室码!",
  102. });
  103. }
  104. } else {
  105. uni.hideLoading();
  106. uni.showToast({
  107. icon: "none",
  108. title: res.msg || "接口获取数据失败!",
  109. });
  110. }
  111. });
  112. }
  113. } else {
  114. uni.hideLoading();
  115. uni.showToast({
  116. icon: "none",
  117. title: result.info || "接口获取数据失败!",
  118. });
  119. }
  120. });
  121. }).catch(err => {
  122. this.SMFlag = true;
  123. });
  124. },
  125. // 手动查询-确认
  126. patientOk(data) {
  127. console.log(data);
  128. if (!data.id) {
  129. //没有查询到患者
  130. uni.showModal({
  131. title: '提示',
  132. content: "没有查询到患者!",
  133. showCancel: false,
  134. success: function(res) {
  135. if (res.confirm) {
  136. console.log('用户点击确定');
  137. } else if (res.cancel) {
  138. console.log('用户点击取消');
  139. }
  140. }
  141. });
  142. return;
  143. }
  144. this.patientModels.disjunctor = false;
  145. this.hand_scanning_common(data.residenceNo, 'hand');
  146. },
  147. // 手动查询-取消
  148. patientCancel() {
  149. this.patientModels.disjunctor = false;
  150. },
  151. // 手动查询弹窗
  152. showHandViewDrugsbag() {
  153. this.patientModels = {
  154. title: '填写患者住院号',
  155. disjunctor: true,
  156. }
  157. },
  158. // 手动录入
  159. hand_again() {
  160. this.showHandViewDrugsbag();
  161. },
  162. // 核对交接
  163. buildOrder(){
  164. uni.showModal({
  165. title: "提示",
  166. content: "您确定建单吗?",
  167. success: (res) => {
  168. if (res.confirm) {
  169. console.log("用户点击确定");
  170. uni.showLoading({
  171. mask: true,
  172. title: '加载中'
  173. })
  174. let userId = uni.getStorageSync("userData").user.id;
  175. let postData = {
  176. "workOrder": [],
  177. };
  178. this.patientList.forEach(v => {
  179. postData.workOrder.push({
  180. sourceId: 4,
  181. "hosId": this.hosId,
  182. "startDept": {
  183. "id": this.currentStartDept.id
  184. },
  185. "createDept": this.currentStartDept.id,
  186. "patient": {
  187. "patientCode": v.patientCode
  188. },
  189. "worker": {
  190. "id": userId
  191. },
  192. })
  193. })
  194. post("/workerOrder/returnSickRoom", postData).then((res) => {
  195. console.log(res)
  196. uni.hideLoading();
  197. if (res.status == 200) {
  198. uni.showToast({
  199. icon: 'success',
  200. title: '建单成功',
  201. duration: 2000,
  202. mask: true,
  203. });
  204. setTimeout(() => {
  205. uni.navigateTo({
  206. url: `/pages/receiptpage/receiptpage`,
  207. });
  208. }, 2000)
  209. } else if(res.status == 400){
  210. // 校验患者是否没有住院科室
  211. uni.showToast({
  212. icon: "none",
  213. title: res.msg,
  214. duration: 2000,
  215. mask: true,
  216. });
  217. setTimeout(() => {
  218. uni.navigateTo({
  219. url: `/pages/receiptpage/receiptpage`,
  220. });
  221. }, 2000)
  222. } else {
  223. uni.showToast({
  224. icon: "none",
  225. title: res.msg || "接口获取数据失败!",
  226. });
  227. }
  228. })
  229. } else if (res.cancel) {
  230. console.log("用户点击取消");
  231. }
  232. },
  233. });
  234. },
  235. // 扫一扫
  236. scan(isFlag = false) {
  237. if (!this.SMFlag) {
  238. return;
  239. }
  240. this.SMFlag = false;
  241. SM().then((ress1) => {
  242. this.hand_scanning_common(ress1, 'scan', isFlag);
  243. }).catch(err => {
  244. this.SMFlag = true;
  245. });
  246. },
  247. // 手动输入和扫码公共方法
  248. hand_scanning_common(ress1, type, isFlag = false) {
  249. // ----------------
  250. uni.showLoading({
  251. title: "加载中",
  252. mask: true,
  253. });
  254. //检验二维码的有效性
  255. post("/dept/scanning", {
  256. content: ress1,
  257. }).then((result) => {
  258. this.SMFlag = true;
  259. if (result.state == 200 || result.state == 201) {
  260. let codes = result.code;
  261. if (codes) {
  262. this.input_common(ress1, type, isFlag);
  263. } else {
  264. uni.hideLoading();
  265. }
  266. } else {
  267. uni.hideLoading();
  268. uni.showToast({
  269. icon: "none",
  270. title: result.info || "接口获取数据失败!",
  271. });
  272. }
  273. });
  274. // ------------------------------
  275. },
  276. // 将患者添加到患者列表
  277. input_common(ress1, type, isFlag = false){
  278. uni.showLoading({
  279. title: "加载中",
  280. mask: true,
  281. });
  282. post("/patient/patientByCode ", { code: ress1 }).then((ress) => {
  283. uni.hideLoading();
  284. if (ress.status == 200) {
  285. let flag = this.patientList.find(v => v.id == ress.data.id);
  286. if(flag){
  287. uni.showToast({
  288. icon: "none",
  289. title: "患者已存在!",
  290. });
  291. }else{
  292. this.patientList.unshift(ress.data);
  293. uni.showToast({
  294. icon: "none",
  295. title: "添加患者成功!",
  296. });
  297. }
  298. } else {
  299. uni.showToast({
  300. icon: "none",
  301. title: ress.msg || "接口获取数据失败!",
  302. });
  303. }
  304. });
  305. },
  306. },
  307. onLoad(options) {
  308. console.log(options, "options");
  309. this.queryObj = options;
  310. this.patientList = [{id: options.patientId, patientName: options.patientName, residenceNo: options.patientResidenceNo, patientCode: options.patientCode}]
  311. // #ifdef APP-PLUS
  312. webHandle("no", "app");
  313. // #endif
  314. // #ifdef H5
  315. webHandle("no", "wx");
  316. // #endif
  317. },
  318. };
  319. </script>
  320. <style lang="less" scoped>
  321. .green{
  322. color:#49b856;
  323. }
  324. .Scanning_Result {
  325. background: #EBEBEB;
  326. display: flex;
  327. flex-direction: column;
  328. height: 100vh;
  329. .Scanning_top {
  330. display: flex;
  331. justify-content: center;
  332. align-items: center;
  333. height: 63rpx;
  334. font-size: 28rpx;
  335. font-weight: bold;
  336. background-color: #fff;
  337. margin-top: 16rpx;
  338. }
  339. .Scanning_cont {
  340. flex: 1;
  341. min-height: 0;
  342. display: flex;
  343. flex-direction: column;
  344. .scrollContent{
  345. flex: 1;
  346. min-height: 0;
  347. }
  348. .column{
  349. padding: 24rpx 44rpx;
  350. font-size: 26rpx;
  351. margin-top: 16rpx;
  352. background-color: #fff;
  353. .top,.bottom{
  354. height: 50%;
  355. display: flex;
  356. align-items: center;
  357. .name{
  358. }
  359. .value{
  360. flex: 1;
  361. }
  362. }
  363. .top{
  364. position: relative;
  365. /deep/ .uni-checkbox-input.uni-checkbox-input-checked{
  366. color: #fff !important;
  367. background: #49b856 !important;
  368. border-color: #49b856 !important;
  369. }
  370. .orders{
  371. width: 54rpx;
  372. text-align: center;
  373. // position: absolute;
  374. // left: -64rpx;
  375. // top: 50%;
  376. // transform: translateY(-50%);
  377. font-size: 28rpx;
  378. font-weight: bold;
  379. }
  380. }
  381. .bottom{
  382. margin-top: 16rpx;
  383. }
  384. }
  385. }
  386. .foot_btn_spe {
  387. display: flex;
  388. flex-direction: column;
  389. align-items: center;
  390. gap: 24rpx;
  391. font-weight: bold;
  392. padding: 24rpx;
  393. .column{
  394. width: 100%;
  395. height: 78rpx;
  396. display: flex;
  397. align-items: center;
  398. justify-content: space-between;
  399. gap: 24rpx;
  400. .btn {
  401. height: 100%;
  402. flex: 1;
  403. background: linear-gradient( 90deg, #6FC073 0%, #3DB197 100%);
  404. color: #fff;
  405. border-radius: 4rpx;
  406. font-size: 30rpx;
  407. display: flex;
  408. justify-content: center;
  409. align-items: center;
  410. }
  411. }
  412. }
  413. }
  414. </style>