sendBackPatient.vue 12 KB

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