123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432 |
- <template>
- <view class="Scanning_Result">
- <view class="Scanning_top">
- 患者总数量:<text class="green">{{patientList.length}}</text>
- </view>
- <view class="Scanning_cont">
- <scroll-view scroll-y class="scrollContent">
- <checkbox-group @change="checkboxChange">
- <view class="column" v-for="(item, index) in patientList" :key="item.id">
- <view class="top">
- <checkbox :value="item.id" :checked="item.checked" activeBackgroundColor="#49b856" activeBorderColor="#49b856" iconColor="#fff"/>
- <text class="orders green">{{index + 1}}</text>
- <view class="name">姓名:</view>
- <view class="value">{{item.patientName}}</view>
- </view>
- <view class="bottom">
- <view class="name">住院号:</view>
- <view class="value">{{item.residenceNo}}</view>
- </view>
- </view>
- </checkbox-group>
- </scroll-view>
- </view>
- <view class="foot_btn_spe">
- <view class="column">
- <view class="btn" @click="scan()">扫一扫</view>
- <view class="btn" @click="hand_again()">手动录入</view>
- </view>
- <view class="column" v-if="patientList.length">
- <view class="btn" @click="scanDept()">建单</view>
- </view>
- </view>
- <!-- 手动查询患者弹窗 -->
- <handViewPatient v-if="patientModels.disjunctor" :title="patientModels.title"
- :disjunctor="patientModels.disjunctor" @ok="patientOk" @cancel="patientCancel">
- </handViewPatient>
- </view>
- </template>
- <script>
- import {
- get,
- post,
- SM,
- webHandle
- } from "@/http/http.js";
- export default {
- data() {
- return {
- hosId: uni.getStorageSync("userData").user.currentHospital.id,
- patientList: [],//患者列表
- queryObj: {}, //路由传递过来的数据
- scanCount: '', //已扫描数量
- SMFlag: true,
- // 手动查询弹窗model
- patientModels: {
- disjunctor: false,
- },
- };
- },
- onShow() {
- this.SMFlag = true;
- },
- methods: {
- checkboxChange (e) {
- var items = this.patientList,
- values = e.detail.value;
- for (var i = 0, lenI = items.length; i < lenI; ++i) {
- const item = items[i]
- if(values.includes(item.id)){
- this.$set(item,'checked',true)
- }else{
- this.$set(item,'checked',false)
- }
- }
- console.log(8888,this.patientList)
- },
- // 送回病房-扫描科室
- scanDept() {
- if (!this.SMFlag) {
- return;
- }
- let isList = this.patientList.filter(i=>i.checked)
- if(isList.length==0){
- uni.showToast({
- icon: 'error',
- title: '请勾选患者',
- duration: 2000,
- });
- return
- }
- this.SMFlag = false;
- let code = "";
- SM().then((ress1) => {
- uni.showLoading({
- title: "加载中",
- mask: true,
- });
- //检验二维码的有效性
- post("/dept/scanning", {
- content: ress1,
- }).then((result) => {
- this.SMFlag = true;
- if (result.state == 200 || result.state == 201) {
- let ress = result.code;
- if (ress) {
- code = ress;
- // 科室扫描
- let postData = {
- "type": "query",
- "qrCode": code
- };
- post("/dept/scanChangeDept", postData).then((res) => {
- uni.hideLoading();
- if (res.status == 200) {
- if (res.data) {
- if(res.data.deptDTO){
- this.currentStartDept = res.data.deptDTO;
- }else{
- this.currentStartDept = res.data;
- }
- this.buildOrder();
- } else {
- uni.hideLoading();
- uni.showToast({
- icon: "none",
- title: "请扫描正确的科室码!",
- });
- }
- } else {
- uni.hideLoading();
- uni.showToast({
- icon: "none",
- title: res.msg || "接口获取数据失败!",
- });
- }
- });
- }
- } else {
- uni.hideLoading();
- uni.showToast({
- icon: "none",
- title: result.info || "接口获取数据失败!",
- });
- }
- });
- }).catch(err => {
- this.SMFlag = true;
- });
- },
- // 手动查询-确认
- patientOk(data) {
- console.log(data);
- if (!data.id) {
- //没有查询到患者
- uni.showModal({
- title: '提示',
- content: "没有查询到患者!",
- showCancel: false,
- success: function(res) {
- if (res.confirm) {
- console.log('用户点击确定');
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- });
- return;
- }
- this.patientModels.disjunctor = false;
- this.hand_scanning_common(data.residenceNo, 'hand');
- },
- // 手动查询-取消
- patientCancel() {
- this.patientModels.disjunctor = false;
- },
- // 手动查询弹窗
- showHandViewDrugsbag() {
- this.patientModels = {
- title: '填写患者住院号',
- disjunctor: true,
- }
- },
- // 手动录入
- hand_again() {
- this.showHandViewDrugsbag();
- },
- // 核对交接
- buildOrder(){
- uni.showModal({
- title: "提示",
- content: "您确定建单吗?",
- success: (res) => {
- if (res.confirm) {
- console.log("用户点击确定");
- uni.showLoading({
- mask: true,
- title: '加载中'
- })
- let userId = uni.getStorageSync("userData").user.id;
- let postData = {
- "workOrder": [],
- };
- this.patientList.forEach(v => {
- if(v.checked){
- postData.workOrder.push({
- sourceId: 4,
- "hosId": this.hosId,
- "startDept": {
- "id": this.currentStartDept.id
- },
- "createDept": this.currentStartDept.id,
- "patient": {
- "patientCode": v.patientCode
- },
- "worker": {
- "id": userId
- },
- })
- }
- })
- post("/workerOrder/returnSickRoom", postData).then((res) => {
- console.log(res)
- uni.hideLoading();
- if (res.status == 200) {
- uni.showToast({
- icon: 'success',
- title: '建单成功',
- duration: 2000,
- mask: true,
- });
- setTimeout(() => {
- uni.navigateTo({
- url: `/pages/receiptpage/receiptpage`,
- });
- }, 2000)
- } else {
- uni.showToast({
- icon: "none",
- title: res.msg || "接口获取数据失败!",
- });
- }
- })
- } else if (res.cancel) {
- console.log("用户点击取消");
- }
- },
- });
- },
- // 扫一扫
- scan(isFlag = false) {
- if (!this.SMFlag) {
- return;
- }
- this.SMFlag = false;
- SM().then((ress1) => {
- this.hand_scanning_common(ress1, 'scan', isFlag);
- }).catch(err => {
- this.SMFlag = true;
- });
- },
- // 手动输入和扫码公共方法
- hand_scanning_common(ress1, type, isFlag = false) {
- // ----------------
- uni.showLoading({
- title: "加载中",
- mask: true,
- });
- //检验二维码的有效性
- post("/dept/scanning", {
- content: ress1,
- }).then((result) => {
- this.SMFlag = true;
- if (result.state == 200 || result.state == 201) {
- let codes = result.code;
- if (codes) {
- this.input_common(ress1, type, isFlag);
- } else {
- uni.hideLoading();
- }
- } else {
- uni.hideLoading();
- uni.showToast({
- icon: "none",
- title: result.info || "接口获取数据失败!",
- });
- }
- });
- // ------------------------------
- },
- // 将患者添加到患者列表
- input_common(ress1, type, isFlag = false){
- uni.showLoading({
- title: "加载中",
- mask: true,
- });
- post("/patient/patientByCode ", { code: ress1 }).then((ress) => {
- uni.hideLoading();
- if (ress.status == 200) {
- let flag = this.patientList.find(v => v.id == ress.data.id);
- if(flag){
- uni.showToast({
- icon: "none",
- title: "患者已存在!",
- });
- }else{
- this.patientList.unshift(ress.data);
- uni.showToast({
- icon: "none",
- title: "添加患者成功!",
- });
- }
- } else {
- uni.showToast({
- icon: "none",
- title: ress.msg || "接口获取数据失败!",
- });
- }
- });
- },
- },
- onLoad(options) {
- console.log(options, "options");
- this.queryObj = options;
- this.patientList = [{id: options.patientId, patientName: options.patientName, residenceNo: options.patientResidenceNo, patientCode: options.patientCode, checked:true}]
- // #ifdef APP-PLUS
- webHandle("no", "app");
- // #endif
- // #ifdef H5
- webHandle("no", "wx");
- // #endif
- },
- };
- </script>
- <style lang="less" scoped>
- .green{
- color:#49b856;
- }
- .Scanning_Result {
- background: #EBEBEB;
- display: flex;
- flex-direction: column;
- height: 100vh;
- .Scanning_top {
- display: flex;
- justify-content: center;
- align-items: center;
- height: 63rpx;
- font-size: 28rpx;
- font-weight: bold;
- background-color: #fff;
- margin-top: 16rpx;
- }
- .Scanning_cont {
- flex: 1;
- min-height: 0;
- display: flex;
- flex-direction: column;
- .scrollContent{
- flex: 1;
- min-height: 0;
- }
- .column{
- padding: 24rpx 44rpx;
- font-size: 26rpx;
- margin-top: 16rpx;
- background-color: #fff;
- .top,.bottom{
- height: 50%;
- display: flex;
- align-items: center;
- .name{
-
- }
- .value{
- flex: 1;
- }
- }
- .top{
- position: relative;
- .orders{
- width: 54rpx;
- text-align: center;
- // position: absolute;
- // left: -64rpx;
- // top: 50%;
- // transform: translateY(-50%);
- font-size: 28rpx;
- font-weight: bold;
- }
- }
- .bottom{
- margin-top: 16rpx;
- }
- }
- }
- .foot_btn_spe {
- display: flex;
- flex-direction: column;
- align-items: center;
- gap: 24rpx;
- font-weight: bold;
- padding: 24rpx;
- .column{
- width: 100%;
- height: 78rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: 24rpx;
- .btn {
- height: 100%;
- flex: 1;
- background: linear-gradient( 90deg, #6FC073 0%, #3DB197 100%);
- color: #fff;
- border-radius: 4rpx;
- font-size: 30rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- }
- }
- }
- </style>
|