feat: Add patient info decrypt.

This commit is contained in:
sunwen
2025-03-21 15:56:22 +08:00
parent ed7a1206a1
commit 7783fcee38

View File

@@ -91,17 +91,18 @@ PatientData PatientDataReader::getPatientDataFromHJ(const std::string& aFilePath
char* patientCString = new char[aConfigHeader->getPatientLength()]; char* patientCString = new char[aConfigHeader->getPatientLength()];
stream.read(patientCString,aConfigHeader->getPatientLength()); stream.read(patientCString,aConfigHeader->getPatientLength());
std::string patientJsonString = patientCString; std::string patientJsonString = patientCString;
patientJsonString = AESEncryptHelper::decrypt(patientJsonString);
if(patientJsonString.empty())
{
return result;
}
nlohmann::json jsonObj = nlohmann::json::parse(patientJsonString); nlohmann::json jsonObj = nlohmann::json::parse(patientJsonString);
if(!jsonObj.contains("Patient Info")) if(!jsonObj.contains("Patient Info"))
{ {
return result; return result;
} }
nlohmann::json patientObj = jsonObj.at("Patient Info"); patientJsonString = jsonObj.at("Patient Info").get<std::string>();
patientJsonString = AESEncryptHelper::decrypt(patientJsonString);
if(patientJsonString.empty())
{
return result;
}
nlohmann::json patientObj = nlohmann::json::parse(patientJsonString);;
if(patientObj.contains("PatientID")) if(patientObj.contains("PatientID"))
{ {
result.setPatientID(patientObj.at("PatientID").get<std::string>()); result.setPatientID(patientObj.at("PatientID").get<std::string>());