373 lines
9.6 KiB
Vue
373 lines
9.6 KiB
Vue
<template xmlns="http://www.w3.org/1999/html">
|
||
<div class="container">
|
||
<div class="left">
|
||
<chargeQueue @clickItem="clickItem" @getStatus="getStatus" ref="chargeQueueRef"></ChargeQueue>
|
||
</div>
|
||
<div class="middle">
|
||
<el-scrollbar>
|
||
<div>
|
||
<Panel title="医疗诊断">
|
||
<template #default>
|
||
<div class="diagnosis-content">
|
||
<div>诊断:</div>
|
||
<div class="diagnosis">
|
||
<DiagnosisSearchInput
|
||
v-model="diagnosisKeyword"
|
||
:request-api="diagnosisSearchApi"
|
||
:show-config="diagnosisShowConfig"
|
||
@selectedCallBack="diagnosisSelect"
|
||
ref="diagnosisSearchRef"
|
||
:show-header="false"
|
||
:disabled="statusDisabled==1"
|
||
|
||
>
|
||
</DiagnosisSearchInput>
|
||
</div>
|
||
<div>医生:</div>
|
||
<div class="doctor">
|
||
<el-select
|
||
v-model="formData.doctorId"
|
||
@change="handleChange"
|
||
clearable
|
||
style="width: 100%"
|
||
:disabled="formData.status == 1"
|
||
>
|
||
<el-option
|
||
v-for="item in doctorList"
|
||
:key="item.id"
|
||
:label="item.name"
|
||
:value="item.id"
|
||
>
|
||
</el-option>
|
||
</el-select>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
</Panel>
|
||
</div>
|
||
<div style="margin-top: 24px">
|
||
<ServiceDetail v-model="formData.itemDetail" :status="formData.status == 0"
|
||
@totalPriceChange="getOrderTotalPrice"></ServiceDetail>
|
||
</div>
|
||
<div style="margin-top: 24px">
|
||
<GoodsDetail v-model="formData.goodsDetail" :status="formData.status == 0"
|
||
@totalPriceChange="getOrderTotalPrice"></GoodsDetail>
|
||
</div>
|
||
<div class="bottom">
|
||
<TotalPrice v-model="formData.totalPrice" @save="charge" :status="formData.status" @openCheckOut ="openCheckoutDetail(formData.goodsDetail)"></TotalPrice>
|
||
</div>
|
||
</el-scrollbar>
|
||
</div>
|
||
<div class="right">
|
||
<div class="top">
|
||
<PatientCard ref="patientCardRef"></PatientCard>
|
||
</div>
|
||
<div class="bottom">
|
||
<RecordsLog ref="recordsConsumptionRef"></RecordsLog>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<CheckoutDetail ref="checkoutDetailRef"></CheckoutDetail>
|
||
<Settlement
|
||
ref="settlementRef"
|
||
v-model="socialCard"
|
||
@orderCompleted="orderCompleted"
|
||
@orderCanceled="orderCanceled"
|
||
></Settlement>
|
||
|
||
</template>
|
||
<script setup lang="ts">
|
||
|
||
import Panel from "@/components/common/Panel.vue";
|
||
import ChargeQueue from "@/components/charge/ChargeQueue.vue";
|
||
import {nextTick, onMounted, ref} from "vue";
|
||
import {post} from "@/utils/request.ts";
|
||
import ServiceDetail from "@/components/common/service/ServiceDetail.vue";
|
||
import GoodsDetail from "@/components/common/goods/GoodsDetail.vue";
|
||
import DiagnosisSearchInput from "@/components/outpatient/DiagnosisSearchInput.vue";
|
||
import Settlement from "@/components/charge/Settlement.vue";
|
||
import TotalPrice from "@/components/charge/TotalPrice.vue";
|
||
import psnCertTypes from "@/assets/config/directory/psnCertTypes.json"
|
||
import RecordsLog from "@/components/charge/RecordsLog.vue";
|
||
import PatientCard from "@/components/charge/PatientCard.vue";
|
||
import {apiConfig} from "@/assets/config/apiConfig.ts";
|
||
import CheckoutDetail from "@/components/charge/CheckoutDetail.vue";
|
||
import {ElMessage} from "element-plus";
|
||
|
||
const socialCard = ref<any>({payInfo: {}})
|
||
const formData = ref<any>({
|
||
patientInfo: {},
|
||
diagnosisMedicalRecord: {},
|
||
goodsDetail: [],
|
||
itemDetail: [],
|
||
patientRegistration: {}
|
||
})
|
||
const statusDisabled = ref(0)
|
||
const diagnosisKeyword = ref("")
|
||
const chargeQueueRef = ref()
|
||
const delDraft = () => {
|
||
nextTick(() => {
|
||
chargeQueueRef.value?.delDraft()
|
||
})
|
||
}
|
||
const settlementRef = ref()
|
||
const charge = () => {
|
||
|
||
if (checkTraceCode(formData.value.goodsDetail)) {
|
||
//保存订单
|
||
saveAndCharge()
|
||
} else {
|
||
//打开追溯码详情页
|
||
openCheckoutDetail(formData.value.goodsDetail)
|
||
}
|
||
}
|
||
|
||
|
||
const checkTraceCode = (goodsList: any[]) => {
|
||
|
||
for (let i = 0; i < goodsList.length; i++) {
|
||
const item = goodsList[i];
|
||
if (!item.traceAbilityCodeList || item.shouldNumber != item.traceAbilityCodeList.length) {
|
||
return false;
|
||
}else {
|
||
ElMessage({
|
||
message: `${item.name}的追溯码采集未完成`,
|
||
type: 'warning',
|
||
})
|
||
}
|
||
|
||
}
|
||
return true;
|
||
}
|
||
const checkoutDetailRef = ref()
|
||
const openCheckoutDetail = (goodsList: any[]) => {
|
||
if (!goodsList || goodsList.length == 0) {
|
||
ElMessage({
|
||
message: '没有商品信息,请先选择需要售卖的商品',
|
||
type: 'info',
|
||
plain: true,
|
||
});
|
||
return
|
||
}
|
||
nextTick(() => {
|
||
checkoutDetailRef.value.init(goodsList);
|
||
})
|
||
}
|
||
|
||
const saveAndCharge = () => {
|
||
post('charge/save', {data: {...formData.value, doctorId: doctorId.value}}).then((res: any) => {
|
||
formData.value.code = res
|
||
nextTick(() => {
|
||
settlementRef.value?.init(res)
|
||
})
|
||
})
|
||
}
|
||
const diagnosisSearchRef = ref()
|
||
const diagnosisSearchApi = "social/diagnose/search"
|
||
const diagnosisShowConfig = [
|
||
{
|
||
label: "诊断名称",
|
||
prop: "name",
|
||
},
|
||
{
|
||
label: "诊断编码",
|
||
prop: "code",
|
||
}
|
||
]
|
||
const diagnosisSelect = (list: any) => {
|
||
const diagnosisNames = list.map((item: any) => item.name).join(',')
|
||
formData.value.diagnosisMedicalRecord.diagnosisDetail = JSON.stringify(list)
|
||
formData.value.diagnosisMedicalRecord.diagnosisSummary = diagnosisNames
|
||
}
|
||
const recordsConsumptionRef = ref<any>("")
|
||
const patientCardRef = ref()
|
||
const clickItem = async (item: any, status: any) => {
|
||
statusDisabled.value = status
|
||
formData.value = await post('medical/record/getByDiagnosisCode', {diagnosisCode: item.code})
|
||
//添加追溯码应采字段
|
||
for (let i =0;i<formData.value.goodsDetail.length;i++){
|
||
let goodsItem =formData.value.goodsDetail[i]
|
||
if (goodsItem.packagingUnit == goodsItem.selectedUnit){
|
||
goodsItem.shouldNumber = goodsItem.selectedNum;
|
||
}else {
|
||
goodsItem.shouldNumber = Math.ceil(goodsItem.selectedNum / goodsItem.minPackagingNumber);
|
||
}
|
||
goodsItem.idCode = goodsItem.idCode?.split(",")
|
||
}
|
||
|
||
getOrderTotalPrice()
|
||
nextTick(() => {
|
||
let list = JSON.parse(formData.value.diagnosisMedicalRecord.diagnosisDetail)
|
||
let nList = formData.value.diagnosisMedicalRecord.diagnosisSummary.split(',')
|
||
diagnosisSearchRef.value?.init(list, nList);
|
||
recordsConsumptionRef.value?.init(formData.value.patientInfo.id);
|
||
patientCardRef.value?.init(formData.value.registrationId);
|
||
})
|
||
}
|
||
const dockerList = ref<any[]>([])
|
||
const getDockerList = () => {
|
||
let query = {
|
||
role: 1
|
||
}
|
||
post('organization/member/search', {query: query}).then((res: any) => {
|
||
dockerList.value = res
|
||
})
|
||
}
|
||
const orderCompleted = () => {
|
||
nextTick(() => {
|
||
chargeQueueRef.value?.getOrderList()
|
||
})
|
||
}
|
||
const orderCanceled = () => {
|
||
nextTick(() => {
|
||
chargeQueueRef.value?.getOrderList()
|
||
})
|
||
|
||
}
|
||
|
||
|
||
onMounted(() => {
|
||
getDockerList()
|
||
list()
|
||
})
|
||
const getOrderTotalPrice = () => {
|
||
let totalPrice = 0
|
||
formData.value.itemDetail?.forEach((item: any) => {
|
||
totalPrice += item.selectedPrice * item.selectedNum
|
||
})
|
||
formData.value.goodsDetail.forEach((item: any) => {
|
||
totalPrice += item.selectedPrice * item.selectedNum
|
||
})
|
||
formData.value.preTotalPrice = totalPrice
|
||
formData.value.totalPrice = totalPrice
|
||
}
|
||
|
||
|
||
const props = {
|
||
expandTrigger: 'hover' as const,
|
||
}
|
||
|
||
const doctorId = ref<any>('')
|
||
const handleChange = (value: any) => {
|
||
doctorId.value = value[value.length - 1]
|
||
}
|
||
|
||
const cardTypeList = ref<any>(Object.entries(psnCertTypes).map(([id, name]) => ({id, name})))
|
||
const doctorList = ref<any>([])
|
||
const sectionDoctorOption = ref<any>('')
|
||
const list = () => {
|
||
post(apiConfig.OrganizationMemberSearch, {query: {role: 1}}).then((res: any) => {
|
||
doctorList.value = res
|
||
})
|
||
}
|
||
|
||
const getStatus=(status:any)=>{
|
||
console.log(111)
|
||
formData.value = {
|
||
patientInfo: {},
|
||
diagnosisMedicalRecord: {},
|
||
goodsDetail: [],
|
||
itemDetail: [],
|
||
patientRegistration: {}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style scoped lang="scss">
|
||
.container {
|
||
padding: 0 24px;
|
||
height: 100%;
|
||
width: 100%;
|
||
display: flex;
|
||
|
||
.left {
|
||
width: 320px;
|
||
margin-right: 24px;
|
||
|
||
}
|
||
|
||
.middle {
|
||
flex: 1;
|
||
display: flex;
|
||
flex-direction: column;
|
||
overflow: hidden;
|
||
|
||
.diagnosis-content {
|
||
height: 64px;
|
||
padding: 0 24px 24px;
|
||
display: flex;
|
||
align-items: center;
|
||
|
||
.diagnosis {
|
||
flex: 1;
|
||
margin-right: 24px;
|
||
|
||
}
|
||
|
||
.doctor {
|
||
width: 200px;
|
||
}
|
||
}
|
||
|
||
.case {
|
||
background: #FFFFFF;
|
||
border-radius: 8px;
|
||
padding-bottom: 24px;
|
||
}
|
||
|
||
.service-items {
|
||
margin-top: 24px;
|
||
background: #FFFFFF;
|
||
border-radius: 8px;
|
||
}
|
||
|
||
.pharmaceutical-consumables {
|
||
margin-top: 24px;
|
||
background: #FFFFFF;
|
||
border-radius: 8px;
|
||
}
|
||
|
||
.bottom {
|
||
margin-top: 24px;
|
||
height: 86px;
|
||
border-radius: 8px;
|
||
}
|
||
|
||
.el-form-item {
|
||
margin-right: 0;
|
||
}
|
||
}
|
||
|
||
.right {
|
||
width: 400px;
|
||
margin-left: 24px;
|
||
display: flex;
|
||
flex-direction: column;
|
||
|
||
.top {
|
||
height: 240px;
|
||
}
|
||
|
||
.bottom {
|
||
flex: 1;
|
||
width: 100%;
|
||
background: #fff;
|
||
margin-top: 24px;
|
||
border-radius: 8px;
|
||
min-height: 0;
|
||
|
||
|
||
}
|
||
|
||
}
|
||
|
||
|
||
}
|
||
|
||
.bottom {
|
||
margin-top: 24px;
|
||
height: 86px;
|
||
background: #FFFFFF;
|
||
border-radius: 8px;
|
||
}
|
||
</style> |