优化患者信息更新逻辑,增加日志记录以便调试;修正身份证号码解析函数的区域代码提取

This commit is contained in:
yuchenglong
2025-12-09 16:47:40 +08:00
parent cf1e31ecdd
commit f13be6d557
2 changed files with 12 additions and 3 deletions

View File

@@ -209,7 +209,12 @@ const U2: React.FC = () => {
} }
const byteArray = new Uint8Array(byteNumbers); const byteArray = new Uint8Array(byteNumbers);
const blob = new Blob([byteArray], { type: mime }); const blob = new Blob([byteArray], { type: mime });
//打印参数
window.electronAPI.log(
"info",
`Updating patient info: id_no=${idCardNo}, marital_status=${selectedMarital}, province=${provinceCode}, city=${cityCode}, county=${countyCode}, address=${address}, id_no_pic size=${blob.size}`
);
// 调用带图片的更新接口(传入推断的省市县编码) // 调用带图片的更新接口(传入推断的省市县编码)
return updatePatientInfo( return updatePatientInfo(
idCardNo, idCardNo,
@@ -233,6 +238,10 @@ const U2: React.FC = () => {
}) })
.catch((err) => { .catch((err) => {
console.error("updatePatientInfo error", err); console.error("updatePatientInfo error", err);
window.electronAPI.log(
"error",
`更新客户信息异常: ${err.message || err}`
);
alert("更新客户信息异常,请联系前台工作人员"); alert("更新客户信息异常,请联系前台工作人员");
}); });
} else { } else {

View File

@@ -8,7 +8,7 @@ export function parseRegionCodesFromId(idNo: string | null | undefined) {
const first4 = s.slice(0, 4); const first4 = s.slice(0, 4);
const first2 = s.slice(0, 2); const first2 = s.slice(0, 2);
result.county = first6; // 6位县级代码 result.county = first6; // 6位县级代码
result.city = `${first4}`; // 市级代码前4位+00 result.city = `${first4}00`; // 市级代码前4位+00
result.province = `${first2}`; // 省级代码前2位+0000 result.province = `${first2}0000`; // 省级代码前2位+0000
return result; return result;
} }