Compare commits

...

10 Commits

Author SHA1 Message Date
yuchenglong
75f9a20366 更新版本号至 1.1.2 2026-01-20 11:29:02 +08:00
yuchenglong
86ed42f0b9 修复 IDCard 读取日志格式,优化错误信息提示 2026-01-20 11:28:28 +08:00
yuchenglong
e6f20d063e 更新版本号至 1.1.1 2026-01-14 09:42:50 +08:00
yuchenglong
481a948d8f 添加获取可选体检项目列表的功能,并优化代码格式 2026-01-14 09:42:24 +08:00
yuchenglong
5195902a1b 1.1.0 2026-01-13 17:26:05 +08:00
yuchenglong
e064a13ebd 使用optionalData?.packageInfo?.physical_exam_id 2026-01-13 17:25:42 +08:00
yuchenglong
dfbeff51fb 移除未使用的 parseRegionCodesFromId 导入 2026-01-13 16:39:50 +08:00
yuchenglong
5471b51a8c 更新版本号至 1.0.9 2026-01-13 15:05:20 +08:00
yuchenglong
c50c0d04a4 添加移除弃选体检套餐选项功能 2026-01-13 15:05:03 +08:00
yuchenglong
fde57c169b 更新版本号至 1.0.8 2025-12-31 09:24:44 +08:00
6 changed files with 123 additions and 31 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "yuanhe-checkin-electron",
"version": "1.0.7",
"version": "1.1.2",
"description": "Electron application compatible with Windows 7",
"main": "electron/main.js",
"scripts": {

View File

@@ -120,6 +120,11 @@ export interface SignInResponse {
is_success: number; // 0-成功 1-失败
}
// 移除可选套餐响应
export interface RemoveOptionalResponse {
is_success: number; // 1-成功 0-失败
}
// 创建axios实例
function createAxiosInstance(baseURL: string): AxiosInstance {
const instance = axios.create({
@@ -374,5 +379,23 @@ export async function signIn(
return response.data;
}
/**
* 10. 移除弃选体检套餐选项
* @param physical_exam_id 体检ID
* @param combination_code_ids 组合代码多个项目以逗号分割例如123,456
*/
export async function removeOptionalItems(
physical_exam_id: number,
combination_code_ids: string
): Promise<ApiResponse<RemoveOptionalResponse>> {
const response = await axiosInstance.post<
ApiResponse<RemoveOptionalResponse>
>("exam-optional-remove", {
physical_exam_id,
combination_code_ids,
});
return response.data;
}
// 导出axios实例以便需要时进行自定义配置
export { axiosInstance };

View File

@@ -51,7 +51,7 @@ const U1: React.FC = () => {
window.electronAPI.log("info", `[idcard-data] received`);
window.electronAPI.log(
"info",
`Read IDCard success: ${payload.name} ${payload.id_card_no}`
`Read IDCard success: ${payload.name} ${payload.id_card_no}`,
);
// 清理倒计时
@@ -75,7 +75,7 @@ const U1: React.FC = () => {
.catch((e: any) => console.error(e));
}, 1000);
})
.catch(() => { });
.catch(() => {});
};
// 先验证档案信息,查询到才跳转
@@ -92,13 +92,15 @@ const U1: React.FC = () => {
.then((res) => {
if (res.Status === 200 && res.Data) {
// 查询成功,跳转到 u2
window.electronAPI.stopIdCardListen().catch(() => { });
window.electronAPI.stopIdCardListen().catch(() => {});
setReading(false);
isProcessingRef.current = false;
navigate("/u2");
} else {
// 未查询到档案信息,显示错误提示,不跳转
setErrorMsg("未查询到您的档案信息,详情请咨询前台工作人员!");
setErrorMsg(
res.Message || "未查询到您的档案信息,详情请咨询前台工作人员!",
);
setReading(false);
isProcessingRef.current = false;
resetListening();
@@ -119,7 +121,7 @@ const U1: React.FC = () => {
});
return () => {
window.electronAPI.stopIdCardListen().catch(() => { });
window.electronAPI.stopIdCardListen().catch(() => {});
window.electronAPI.removeIdCardListeners();
if (timerRef.current) clearTimeout(timerRef.current);
if (intervalRef.current) clearInterval(intervalRef.current);

View File

@@ -14,7 +14,6 @@ import {
updatePatientInfo,
PatientInfo,
} from "../../api/hisApi";
import { parseRegionCodesFromId } from "../../utils/idCard";
const U2: React.FC = () => {
const navigate = useNavigate();

View File

@@ -6,6 +6,7 @@ import DecorLine from "../../components/DecorLine";
import LongButton from "../../components/LongButton";
import radio0 from "../../assets/radio-0.png";
import radio1 from "../../assets/radio-1.png";
import { removeOptionalItems } from "../../api/hisApi";
interface testType {
id: number;
title: string;
@@ -19,8 +20,61 @@ const U4: React.FC = () => {
const location = useLocation();
const optionalData = (location.state as any)?.optionalData;
const [test, setTest] = React.useState<testType[]>([]);
const handleConfirm = () => {
navigate("/UI6");
const [selectedId, setSelectedId] = React.useState<number | null>(null);
const [isSubmitting, setIsSubmitting] = React.useState(false);
const handleConfirm = async () => {
if (isSubmitting) return; // 防止重复提交
if (selectedId === null || !test.length) {
console.warn("没有选择任何项目,直接跳过");
navigate("/UI6");
return;
}
setIsSubmitting(true);
try {
// 找出未选择的项目
const unselectedItems = test.filter((item) => item.id !== selectedId);
console.log("未选择的项目:", unselectedItems);
// 如果有未选的项目,调用移除接口
if (unselectedItems.length > 0) {
// 拼接未选项目的combination_code
const combinationCodeIds = unselectedItems
.map((item) => item.id)
.join(",");
// 获取physical_exam_id
const physical_exam_id = optionalData?.packageInfo?.physical_exam_id;
if (physical_exam_id) {
console.log("开始移除未选项目:", combinationCodeIds);
window.electronAPI.log(
"info",
`开始移除未选项目: ${combinationCodeIds}`
);
// 调用移除接口
await removeOptionalItems(physical_exam_id, combinationCodeIds);
window.electronAPI.log(
"info",
`成功移除未选项目: ${combinationCodeIds}`
);
console.log("成功移除未选项目");
}
} else {
console.log("没有未选项目需要移除");
window.electronAPI.log("info", "没有未选项目需要移除");
}
} catch (error) {
console.error("移除未选项目失败:", error);
window.electronAPI.log("error", `移除未选项目失败: ${String(error)}`);
// 即使移除失败,也继续流程
} finally {
// 无论成功或失败,都跳转到下一页
setIsSubmitting(false);
navigate("/UI6");
}
};
React.useEffect(() => {
if (
@@ -40,7 +94,6 @@ const U4: React.FC = () => {
navigate("/UI6");
}
}, []);
const [selectedId, setSelectedId] = React.useState<number | null>(null);
// 当 test 更新后,如果没有选择项则默认选择第一个
React.useEffect(() => {
@@ -50,7 +103,8 @@ const U4: React.FC = () => {
}, [test]);
React.useEffect(() => {
console.log("选择的项目", selectedId);
console.log("选择的项目:", selectedId);
window.electronAPI.log("info", `选择的项目: ${selectedId}`);
}, [selectedId]);
return (
<div className="u4-root">

View File

@@ -5,13 +5,24 @@ import { useNavigate } from "react-router-dom";
import BackButton from "../../components/BackButton";
import ConfirmButton from "../../components/ConfirmButton";
import DecorLine from "../../components/DecorLine";
import { getPackagItemDetail } from "../../api/hisApi";
import { getPackagItemDetail, getOptionalItemList } from "../../api/hisApi";
import upgradeImg from "../../assets/upgrade.png";
const UI6: React.FC = () => {
const navigate = useNavigate();
const handleBack = () => {
const handleBack = async () => {
const id_no = localStorage.getItem("lastIdCardNo");
if (id_no) {
try {
const res = await getOptionalItemList(id_no as string);
if (res && res.Status === 200) {
window.electronAPI.log("info", `撤销体检选项项目列表成功`);
}
} catch (error) {
console.error("getOptionalItemList error:", error);
}
}
navigate(-1);
};
@@ -25,7 +36,6 @@ const UI6: React.FC = () => {
getListData();
}, []);
const getListData = async () => {
const id_no = localStorage.getItem("lastIdCardNo");
if (!id_no) {
@@ -61,16 +71,16 @@ const UI6: React.FC = () => {
// 兼容旧格式(一个字符串里用顿号分隔)和新格式(每条记录一个项目)
const projectIds: string[] = item.project_id
? String(item.project_id)
.split("、")
.map((id: string) => id.trim())
.filter((id: string) => id)
.split("、")
.map((id: string) => id.trim())
.filter((id: string) => id)
: [];
const projectNames: string[] = item.project_name
? String(item.project_name)
.split("、")
.map((name: string) => name.trim())
.filter((name: string) => name)
.split("、")
.map((name: string) => name.trim())
.filter((name: string) => name)
: [];
if (!departmentMap.has(deptId)) {
@@ -106,7 +116,6 @@ const UI6: React.FC = () => {
}
};
return (
<div className="basic-root">
<div className="basic-white-block">
@@ -122,32 +131,37 @@ const UI6: React.FC = () => {
{localStorage.getItem("gender") === "男" ? "先生" : "女士"}{" "}
<strong className="ui6-package-name">
{PackageInfo.package_name}
</strong>
<br />
<br />
{PackageInfo.appointment_datetime}
{PackageInfo.appointment_datetime}{" "}
</span>
<div className="ui6-table-container">
<table className="ui6-table">
<thead>
<tr>
<th className="ui6-table-header ui6-table-dept"></th>
<th className="ui6-table-header ui6-table-project"></th>
<th className="ui6-table-header ui6-table-project">
</th>
</tr>
</thead>
<tbody>
{ListData.map((item, index) => (
<tr key={index} className="ui6-table-row">
<td className="ui6-table-dept-cell">{item.department_name}</td>
<td className="ui6-table-dept-cell">
{item.department_name}
</td>
<td className="ui6-table-project-cell">
{item.project_names.map((project: string, pIndex: number) => (
<div key={pIndex} className="ui6-project-item">
<span style={{ paddingLeft: 20 }}>{project}</span>
</div>
))}
{item.project_names.map(
(project: string, pIndex: number) => (
<div key={pIndex} className="ui6-project-item">
<span style={{ paddingLeft: 20 }}>{project}</span>
</div>
)
)}
</td>
</tr>
))}