diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationDiagnosisAppService.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationDiagnosisAppService.java index cdd6979c..e9382724 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationDiagnosisAppService.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationDiagnosisAppService.java @@ -127,4 +127,12 @@ public interface IDoctorStationDiagnosisAppService { * @return 结果 */ R saveInfectiousDiseaseReport(InfectiousDiseaseReportDto infectiousDiseaseReportDto); + + /** + * 获取下一个传染病报告卡编号 + * + * @param orgCode 医疗机构编码 + * @return 卡片编号 + */ + R getNextCardNo(String orgCode); } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationDiagnosisAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationDiagnosisAppServiceImpl.java index 176d2644..36c21c1d 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationDiagnosisAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationDiagnosisAppServiceImpl.java @@ -621,4 +621,27 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"传染病报告卡"})); } } + + /** + * 获取下一个传染病报告卡编号 + * 编号规则:医疗机构编码 + 年月日 + 4位流水号 + * 示例:123456202603060001 + * + * @param orgCode 医疗机构编码 + * @return 卡片编号 + */ + @Override + public R getNextCardNo(String orgCode) { + // 参数校验 + if (orgCode == null || orgCode.trim().isEmpty()) { + orgCode = "0000"; + } + + // 使用 AssignSeqUtil 生成每日递增的流水号 + // 前缀为医疗机构编码,每天从0001开始 + String cardNo = assignSeqUtil.getSeqByDay(orgCode, 4); + + log.debug("生成传染病报告卡编号: {}", cardNo); + return R.ok(cardNo); + } } \ No newline at end of file diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationDiagnosisController.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationDiagnosisController.java index 3a5f578c..65943bbb 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationDiagnosisController.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationDiagnosisController.java @@ -217,4 +217,15 @@ public class DoctorStationDiagnosisController { return iDoctorStationDiagnosisAppService.saveInfectiousDiseaseReport(infectiousDiseaseReportDto); } + /** + * 获取下一个传染病报告卡编号 + * + * @param orgCode 医疗机构编码 + * @return 卡片编号 + */ + @GetMapping("/next-card-no") + public R getNextCardNo(@RequestParam(value = "orgCode", required = false) String orgCode) { + return iDoctorStationDiagnosisAppService.getNextCardNo(orgCode); + } + } diff --git a/openhis-ui-vue3/src/views/doctorstation/components/api.js b/openhis-ui-vue3/src/views/doctorstation/components/api.js index 169d167c..1b874af9 100644 --- a/openhis-ui-vue3/src/views/doctorstation/components/api.js +++ b/openhis-ui-vue3/src/views/doctorstation/components/api.js @@ -1089,6 +1089,17 @@ export function checkInfectiousDisease(params) { }); } +/** + * 获取下一个传染病报告卡编号 + */ +export function getNextCardNo(orgCode) { + return request({ + url: '/doctor-station/diagnosis/next-card-no', + method: 'get', + params: { orgCode }, + }); +} + /** * 保存传染病报告卡 */ diff --git a/openhis-ui-vue3/src/views/doctorstation/components/diagnosis/infectiousDiseaseReportDialog.vue b/openhis-ui-vue3/src/views/doctorstation/components/diagnosis/infectiousDiseaseReportDialog.vue index b93ab509..71bfaece 100644 --- a/openhis-ui-vue3/src/views/doctorstation/components/diagnosis/infectiousDiseaseReportDialog.vue +++ b/openhis-ui-vue3/src/views/doctorstation/components/diagnosis/infectiousDiseaseReportDialog.vue @@ -15,8 +15,8 @@ @@ -32,7 +32,7 @@ 家长姓名 - + 身份证号 @@ -98,29 +98,23 @@ 现住地址 -
- - - - - - - - - +
+
- - - - - - + - + @@ -141,27 +135,26 @@ - - + 职业 - + + + + + 病例分类 -
-
- 疑似病例 - 临床诊断病例 - 确诊病例 -
-
- 病原携带者 - 阳性检测结果(采供血机构填写) -
-
+ + 疑似病例 + 临床诊断病例 + 确诊病例 + 病原携带者 + 阳性检测结果 +
@@ -334,7 +327,7 @@ :model-value="form.selectedClassB === '0221'" @update:model-value="(checked) => handleClassBCheckbox('0221', checked)" label="0221" - >淋病 + >����病 疟疾 - 新型冠状病毒肺炎 - 甲型H1N1流感 - 人感染H7N9禽流感
@@ -422,12 +400,11 @@ @update:model-value="(checked) => handleClassCCheckbox('0309', checked)" label="0309" >丝虫病 - 除霍乱/菌痢/伤寒副伤寒以外的感染性腹泻病 + >其它感染性腹泻病 import { ref, computed, getCurrentInstance, watch } from 'vue'; import pcas from 'china-division/dist/pcas-code.json'; -import { saveInfectiousDiseaseReport } from '../api'; +import { saveInfectiousDiseaseReport, getNextCardNo } from '../api'; import useUserStore from '@/store/modules/user'; import { useDict } from '@/utils/dict'; @@ -566,151 +543,17 @@ const props = defineProps({ const emit = defineEmits(['close', 'success']); -// 地址选择器数据 -const addressData = ref(pcas); -const provinceCode = ref(''); -const cityCode = ref(''); -const countyCode = ref(''); -const townCode = ref(''); -const provinceOptions = ref([]); -const cityOptions = ref([]); -const countyOptions = ref([]); -const townOptions = ref([]); - +// 地址级联选择器配置 +const addressOptions = ref(pcas); +const addressCodes = ref([]); // 直辖市列表(这些城市的省级和市级相同) const municipalities = ['北京市', '天津市', '上海市', '重庆市']; - -// 初始化省级选项 -function initProvinceOptions() { - provinceOptions.value = addressData.value.map(item => ({ - code: item.code, - name: item.name - })); -} - -// 省级变化处理 -function handleProvinceChange(code) { - cityCode.value = ''; - countyCode.value = ''; - townCode.value = ''; - cityOptions.value = []; - countyOptions.value = []; - townOptions.value = []; - form.value.addressProv = ''; - form.value.addressCity = ''; - form.value.addressCounty = ''; - form.value.addressTown = ''; - - if (code) { - const province = addressData.value.find(item => item.code === code); - if (province) { - form.value.addressProv = province.name; - // 直辖市特殊处理:市级选项与省级相同 - if (municipalities.includes(province.name)) { - cityOptions.value = [{ code: province.code, name: province.name }]; - cityCode.value = province.code; - form.value.addressCity = province.name; - // 直辖市的区县是省级的children - if (province.children && province.children.length > 0) { - countyOptions.value = province.children[0].children?.map(item => ({ - code: item.code, - name: item.name - })) || []; - } - } else { - cityOptions.value = province.children?.map(item => ({ - code: item.code, - name: item.name - })) || []; - } - } - } -} - -// 市级变化处理 -function handleCityChange(code) { - countyCode.value = ''; - townCode.value = ''; - countyOptions.value = []; - townOptions.value = []; - form.value.addressCity = ''; - form.value.addressCounty = ''; - form.value.addressTown = ''; - - if (code) { - const province = addressData.value.find(item => item.code === provinceCode.value); - if (province) { - // 直辖市处理 - if (municipalities.includes(province.name)) { - const county = province.children?.[0]?.children?.find(item => item.code === code); - if (county) { - form.value.addressCounty = county.name; - townOptions.value = county.children?.map(item => ({ - code: item.code, - name: item.name - })) || []; - } - } else { - const city = province.children?.find(item => item.code === code); - if (city) { - form.value.addressCity = city.name; - countyOptions.value = city.children?.map(item => ({ - code: item.code, - name: item.name - })) || []; - } - } - } - } -} - -// 区县变化处理 -function handleCountyChange(code) { - townCode.value = ''; - townOptions.value = []; - form.value.addressCounty = ''; - form.value.addressTown = ''; - - if (code) { - const province = addressData.value.find(item => item.code === provinceCode.value); - if (province) { - if (municipalities.includes(province.name)) { - // 直辖市 - const county = province.children?.[0]?.children?.find(item => item.code === code); - if (county) { - form.value.addressCounty = county.name; - townOptions.value = county.children?.map(item => ({ - code: item.code, - name: item.name - })) || []; - } - } else { - const city = province.children?.find(item => item.code === cityCode.value); - if (city) { - const county = city.children?.find(item => item.code === code); - if (county) { - form.value.addressCounty = county.name; - townOptions.value = county.children?.map(item => ({ - code: item.code, - name: item.name - })) || []; - } - } - } - } - } -} - -// 街道变化处理 -function handleTownChange(code) { - form.value.addressTown = ''; - if (code) { - const town = townOptions.value.find(item => item.code === code); - if (town) { - form.value.addressTown = town.name; - } - } -} +const addressCascaderProps = { + checkStrictly: true, + value: 'code', + label: 'name', + children: 'children' +}; const form = ref({ cardNo: '', @@ -758,104 +601,65 @@ const form = ref({ diagnosisId: '', }); -// 根据地址名称初始化下拉选择器(用于回显) -function initAddressByName(provName, cityName, countyName, townName) { - if (!provName) return; +// 根据地址名称数组查找对应的代码数组(用于初始化地址选择器的回显) +function findCodesByNames(names) { + const codes = []; + let currentNodes = addressOptions.value; - // 初始化省级选项 - initProvinceOptions(); + for (const name of names) { + if (!name) break; + const node = currentNodes?.find(n => n.name === name); + if (node) { + codes.push(node.code); + currentNodes = node.children; + } else { + break; + } + } + return codes; +} - // 查找省份 - const province = addressData.value.find(item => item.name === provName); - if (!province) return; +// 地址级联选择器变化处理 +function handleAddressChange(values) { + if (!values || values.length === 0) { + form.value.addressProv = ''; + form.value.addressCity = ''; + form.value.addressCounty = ''; + form.value.addressTown = ''; + return; + } - provinceCode.value = province.code; - form.value.addressProv = province.name; + // 根据选中的代码获取对应的名称 + const names = []; + let currentNodes = addressOptions.value; - // 直辖市处理 + for (const code of values) { + const node = currentNodes?.find(n => n.code === code); + if (node) { + names.push(node.name); + currentNodes = node.children; + } + } + + // 处理直辖市情况:如果是直辖市,市级和省级相同 + const provName = names[0] || ''; + let cityName = names[1] || ''; + const countyName = names[2] || ''; + const townName = names[3] || ''; + + // 如果是直辖市,市级应该与省级相同 if (municipalities.includes(provName)) { - cityOptions.value = [{ code: province.code, name: province.name }]; - cityCode.value = province.code; - form.value.addressCity = province.name; - - // 直辖市的区县 - if (province.children && province.children.length > 0) { - countyOptions.value = province.children[0].children?.map(item => ({ - code: item.code, - name: item.name - })) || []; - - if (countyName) { - const county = countyOptions.value.find(item => item.name === countyName); - if (county) { - countyCode.value = county.code; - form.value.addressCounty = county.name; - - // 获取原始区县数据以查找街道 - const countyData = province.children[0].children?.find(item => item.code === county.code); - if (countyData && countyData.children) { - townOptions.value = countyData.children.map(item => ({ - code: item.code, - name: item.name - })); - - if (townName) { - const town = townOptions.value.find(item => item.name === townName); - if (town) { - townCode.value = town.code; - form.value.addressTown = town.name; - } - } - } - } - } - } + // 直辖市:省级=市级 + form.value.addressProv = provName; + form.value.addressCity = provName; // 直辖市的市级与省级相同 + form.value.addressCounty = cityName; // 原来的市级变成区县 + form.value.addressTown = countyName; // 原来的区县变成街道 } else { - // 非直辖市处理 - cityOptions.value = province.children?.map(item => ({ - code: item.code, - name: item.name - })) || []; - - if (cityName) { - const city = cityOptions.value.find(item => item.name === cityName); - if (city) { - cityCode.value = city.code; - form.value.addressCity = city.name; - - const cityData = province.children?.find(item => item.code === city.code); - if (cityData && cityData.children) { - countyOptions.value = cityData.children.map(item => ({ - code: item.code, - name: item.name - })); - - if (countyName) { - const county = countyOptions.value.find(item => item.name === countyName); - if (county) { - countyCode.value = county.code; - form.value.addressCounty = county.name; - - const countyData = cityData.children.find(item => item.code === county.code); - if (countyData && countyData.children) { - townOptions.value = countyData.children.map(item => ({ - code: item.code, - name: item.name - })); - - if (townName) { - const town = townOptions.value.find(item => item.name === townName); - if (town) { - townCode.value = town.code; - form.value.addressTown = town.name; - } - } - } - } - } - } - } - } + // 非直辖市:正常处理 + form.value.addressProv = provName; + form.value.addressCity = cityName; + form.value.addressCounty = countyName; + form.value.addressTown = townName; } } @@ -1116,19 +920,6 @@ function calculateAge() { */ function show(diagnosisData) { dialogVisible.value = true; - - // 重置地址选择器状态 - provinceCode.value = ''; - cityCode.value = ''; - countyCode.value = ''; - townCode.value = ''; - cityOptions.value = []; - countyOptions.value = []; - townOptions.value = []; - - // 初始化省级地址选项 - initProvinceOptions(); - const patientInfo = props.patientInfo || {}; const birthInfo = parseBirthDate(patientInfo.birthDate || patientInfo.birthday); @@ -1228,16 +1019,37 @@ function show(diagnosisData) { updateSelectedDiseases(); // 设置地址选择组件初始值 + // 根据地址名称查找对应的代码数组 const provName = diagnosisData?.addressProv || ''; - const cityName = diagnosisData?.addressCity || ''; + let cityName = diagnosisData?.addressCity || ''; const countyName = diagnosisData?.addressCounty || ''; const townName = diagnosisData?.addressTown || ''; - initAddressByName(provName, cityName, countyName, townName); + // 处理直辖市情况:如果是直辖市,需要调整地址层级 + let names = []; + if (municipalities.includes(provName)) { + // 直辖市:省级=市级,所以传给级联选择器的应该是 [省, 区县, 街道] + names = [provName, countyName, townName].filter(n => n); + } else { + // 非直辖市:正常处理 [省, 市, 区县, 街道] + names = [provName, cityName, countyName, townName].filter(n => n); + } + addressCodes.value = findCodesByNames(names); if (birthInfo.year) { calculateAge(); } + + // 从后端获取下一个卡片编号(含流水号) + getNextCardNo(orgCode).then(res => { + if (res.code === 200 && res.data) { + form.value.cardNo = res.data; + } + }).catch(err => { + // 后端不可用时提示用户,不生成可能重复的编号 + proxy.$modal.msgError('获取卡片编号失败,请稍后重试'); + console.error('获取卡片编号失败:', err); + }); } /** @@ -1329,11 +1141,6 @@ async function buildSubmitData() { function validateFormManually() { const errors = []; - // 卡片编号验证(可选,但如果填写了必须是12位) - if (form.value.cardNo && form.value.cardNo.length !== 12) { - errors.push('卡片编号必须为12位'); - } - // 身份证号验证 if (!form.value.idNo) { errors.push('请输入身份证号'); @@ -1549,26 +1356,6 @@ defineExpose({ show }); .card-number-input { width: 240px; - - :deep(.el-input__wrapper) { - border: none; - border-bottom: 1px solid #dcdfe6; - border-radius: 0; - box-shadow: none; - background: transparent; - } - - :deep(.el-input__inner) { - font-size: 12px; - color: #666; - text-align: center; - letter-spacing: 2px; - } - - :deep(.el-input__inner::placeholder) { - font-size: 12px; - color: #999; - } } /* 表单区域样式 */ @@ -1627,90 +1414,36 @@ defineExpose({ show }); gap: 4px; } -/* 地址选择样式 - 四个下拉框并排 */ -.address-selects { +/* 地址选择样式 */ +.address-inputs { display: flex; gap: 8px; + flex-wrap: wrap; +} + +/* 地址级联选择器样式 */ +.region-selects-wrapper { flex: 1; } -.address-selects .el-select { - flex: 1; - min-width: 0; -} - -.address-selects :deep(.el-input__wrapper) { - border: none; - border-bottom: 1px solid #dcdfe6; - border-radius: 0; - box-shadow: none; - background: transparent; -} - -.address-selects :deep(.el-input__wrapper:hover) { - border-bottom-color: #c0c4cc; -} - -.address-selects :deep(.el-input__wrapper.is-focus) { - border-bottom-color: #409eff; -} - -.address-selects :deep(.el-input__inner) { - font-size: 12px; - color: #666; -} - -.address-selects :deep(.el-input__inner::placeholder) { - font-size: 12px; - color: #999; -} - -/* 街道下拉框下划线样式 */ -.underline-select { +.region-selects-wrapper :deep(.el-cascader) { width: 100%; } -.underline-select :deep(.el-input__wrapper) { - border: none; +.region-selects-wrapper :deep(.el-cascader .el-input__wrapper) { border-bottom: 1px solid #dcdfe6; border-radius: 0; box-shadow: none; - background: transparent; } -.underline-select :deep(.el-input__wrapper:hover) { +.region-selects-wrapper :deep(.el-cascader .el-input__wrapper:hover) { border-bottom-color: #c0c4cc; } -.underline-select :deep(.el-input__wrapper.is-focus) { +.region-selects-wrapper :deep(.el-cascader .el-input__wrapper.is-focus) { border-bottom-color: #409eff; } -.underline-select :deep(.el-input__inner) { - font-size: 12px; - color: #666; -} - -.underline-select :deep(.el-input__inner::placeholder) { - font-size: 12px; - color: #999; -} - -/* 病例分类两行排布 */ -.case-class-group { - width: 100%; -} - -.case-class-row { - display: flex; - gap: 16px; - margin-bottom: 8px; -} - -.case-class-row:last-child { - margin-bottom: 0; -} - .full-select { width: 100%; @@ -1769,10 +1502,6 @@ defineExpose({ show }); width: calc(25% - 8px); } -.disease-list.four-columns .el-checkbox.wide-checkbox { - width: calc(50% - 8px); -} - .disease-with-subtype { display: flex; align-items: center; @@ -1804,9 +1533,6 @@ defineExpose({ show }); .disease-with-subtype { width: calc(50% - 8px); } - .disease-list.four-columns .el-checkbox.wide-checkbox { - width: 100%; - } } @media (max-width: 600px) {