Compare commits
10 Commits
fe3d2138f6
...
75f9a20366
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
75f9a20366 | ||
|
|
86ed42f0b9 | ||
|
|
e6f20d063e | ||
|
|
481a948d8f | ||
|
|
5195902a1b | ||
|
|
e064a13ebd | ||
|
|
dfbeff51fb | ||
|
|
5471b51a8c | ||
|
|
c50c0d04a4 | ||
|
|
fde57c169b |
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "yuanhe-checkin-electron",
|
"name": "yuanhe-checkin-electron",
|
||||||
"version": "1.0.7",
|
"version": "1.1.2",
|
||||||
"description": "Electron application compatible with Windows 7",
|
"description": "Electron application compatible with Windows 7",
|
||||||
"main": "electron/main.js",
|
"main": "electron/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -120,6 +120,11 @@ export interface SignInResponse {
|
|||||||
is_success: number; // 0-成功 1-失败
|
is_success: number; // 0-成功 1-失败
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 移除可选套餐响应
|
||||||
|
export interface RemoveOptionalResponse {
|
||||||
|
is_success: number; // 1-成功 0-失败
|
||||||
|
}
|
||||||
|
|
||||||
// 创建axios实例
|
// 创建axios实例
|
||||||
function createAxiosInstance(baseURL: string): AxiosInstance {
|
function createAxiosInstance(baseURL: string): AxiosInstance {
|
||||||
const instance = axios.create({
|
const instance = axios.create({
|
||||||
@@ -374,5 +379,23 @@ export async function signIn(
|
|||||||
return response.data;
|
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实例,以便需要时进行自定义配置
|
// 导出axios实例,以便需要时进行自定义配置
|
||||||
export { axiosInstance };
|
export { axiosInstance };
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ const U1: React.FC = () => {
|
|||||||
window.electronAPI.log("info", `[idcard-data] received`);
|
window.electronAPI.log("info", `[idcard-data] received`);
|
||||||
window.electronAPI.log(
|
window.electronAPI.log(
|
||||||
"info",
|
"info",
|
||||||
`Read IDCard success: ${payload.name} ${payload.id_card_no}`
|
`Read IDCard success: ${payload.name} ${payload.id_card_no}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
// 清理倒计时
|
// 清理倒计时
|
||||||
@@ -98,7 +98,9 @@ const U1: React.FC = () => {
|
|||||||
navigate("/u2");
|
navigate("/u2");
|
||||||
} else {
|
} else {
|
||||||
// 未查询到档案信息,显示错误提示,不跳转
|
// 未查询到档案信息,显示错误提示,不跳转
|
||||||
setErrorMsg("未查询到您的档案信息,详情请咨询前台工作人员!");
|
setErrorMsg(
|
||||||
|
res.Message || "未查询到您的档案信息,详情请咨询前台工作人员!",
|
||||||
|
);
|
||||||
setReading(false);
|
setReading(false);
|
||||||
isProcessingRef.current = false;
|
isProcessingRef.current = false;
|
||||||
resetListening();
|
resetListening();
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import {
|
|||||||
updatePatientInfo,
|
updatePatientInfo,
|
||||||
PatientInfo,
|
PatientInfo,
|
||||||
} from "../../api/hisApi";
|
} from "../../api/hisApi";
|
||||||
import { parseRegionCodesFromId } from "../../utils/idCard";
|
|
||||||
|
|
||||||
const U2: React.FC = () => {
|
const U2: React.FC = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import DecorLine from "../../components/DecorLine";
|
|||||||
import LongButton from "../../components/LongButton";
|
import LongButton from "../../components/LongButton";
|
||||||
import radio0 from "../../assets/radio-0.png";
|
import radio0 from "../../assets/radio-0.png";
|
||||||
import radio1 from "../../assets/radio-1.png";
|
import radio1 from "../../assets/radio-1.png";
|
||||||
|
import { removeOptionalItems } from "../../api/hisApi";
|
||||||
interface testType {
|
interface testType {
|
||||||
id: number;
|
id: number;
|
||||||
title: string;
|
title: string;
|
||||||
@@ -19,8 +20,61 @@ const U4: React.FC = () => {
|
|||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const optionalData = (location.state as any)?.optionalData;
|
const optionalData = (location.state as any)?.optionalData;
|
||||||
const [test, setTest] = React.useState<testType[]>([]);
|
const [test, setTest] = React.useState<testType[]>([]);
|
||||||
const handleConfirm = () => {
|
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");
|
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(() => {
|
React.useEffect(() => {
|
||||||
if (
|
if (
|
||||||
@@ -40,7 +94,6 @@ const U4: React.FC = () => {
|
|||||||
navigate("/UI6");
|
navigate("/UI6");
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
const [selectedId, setSelectedId] = React.useState<number | null>(null);
|
|
||||||
|
|
||||||
// 当 test 更新后,如果没有选择项则默认选择第一个
|
// 当 test 更新后,如果没有选择项则默认选择第一个
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
@@ -50,7 +103,8 @@ const U4: React.FC = () => {
|
|||||||
}, [test]);
|
}, [test]);
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
console.log("选择的项目", selectedId);
|
console.log("选择的项目:", selectedId);
|
||||||
|
window.electronAPI.log("info", `选择的项目: ${selectedId}`);
|
||||||
}, [selectedId]);
|
}, [selectedId]);
|
||||||
return (
|
return (
|
||||||
<div className="u4-root">
|
<div className="u4-root">
|
||||||
|
|||||||
@@ -5,13 +5,24 @@ import { useNavigate } from "react-router-dom";
|
|||||||
import BackButton from "../../components/BackButton";
|
import BackButton from "../../components/BackButton";
|
||||||
import ConfirmButton from "../../components/ConfirmButton";
|
import ConfirmButton from "../../components/ConfirmButton";
|
||||||
import DecorLine from "../../components/DecorLine";
|
import DecorLine from "../../components/DecorLine";
|
||||||
import { getPackagItemDetail } from "../../api/hisApi";
|
import { getPackagItemDetail, getOptionalItemList } from "../../api/hisApi";
|
||||||
import upgradeImg from "../../assets/upgrade.png";
|
import upgradeImg from "../../assets/upgrade.png";
|
||||||
|
|
||||||
const UI6: React.FC = () => {
|
const UI6: React.FC = () => {
|
||||||
const navigate = useNavigate();
|
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);
|
navigate(-1);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -25,7 +36,6 @@ const UI6: React.FC = () => {
|
|||||||
getListData();
|
getListData();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
||||||
const getListData = async () => {
|
const getListData = async () => {
|
||||||
const id_no = localStorage.getItem("lastIdCardNo");
|
const id_no = localStorage.getItem("lastIdCardNo");
|
||||||
if (!id_no) {
|
if (!id_no) {
|
||||||
@@ -106,7 +116,6 @@ const UI6: React.FC = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="basic-root">
|
<div className="basic-root">
|
||||||
<div className="basic-white-block">
|
<div className="basic-white-block">
|
||||||
@@ -122,32 +131,37 @@ const UI6: React.FC = () => {
|
|||||||
{localStorage.getItem("gender") === "男" ? "先生" : "女士"}{" "}
|
{localStorage.getItem("gender") === "男" ? "先生" : "女士"}{" "}
|
||||||
<strong className="ui6-package-name">
|
<strong className="ui6-package-name">
|
||||||
{PackageInfo.package_name}
|
{PackageInfo.package_name}
|
||||||
|
|
||||||
</strong>
|
</strong>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
尊敬的客户,以下是您预约的 {PackageInfo.appointment_datetime} 体检套餐详情,请核对确认
|
尊敬的客户,以下是您预约的 {PackageInfo.appointment_datetime}{" "}
|
||||||
|
体检套餐详情,请核对确认
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<div className="ui6-table-container">
|
<div className="ui6-table-container">
|
||||||
|
|
||||||
<table className="ui6-table">
|
<table className="ui6-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th className="ui6-table-header ui6-table-dept">科室</th>
|
<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>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{ListData.map((item, index) => (
|
{ListData.map((item, index) => (
|
||||||
<tr key={index} className="ui6-table-row">
|
<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">
|
<td className="ui6-table-project-cell">
|
||||||
{item.project_names.map((project: string, pIndex: number) => (
|
{item.project_names.map(
|
||||||
|
(project: string, pIndex: number) => (
|
||||||
<div key={pIndex} className="ui6-project-item">
|
<div key={pIndex} className="ui6-project-item">
|
||||||
<span style={{ paddingLeft: 20 }}>{project}</span>
|
<span style={{ paddingLeft: 20 }}>{project}</span>
|
||||||
</div>
|
</div>
|
||||||
))}
|
)
|
||||||
|
)}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
))}
|
||||||
|
|||||||
Reference in New Issue
Block a user