java做病历管理系统源代码
269
2024-03-10 06:56
java
// 患者信息类
public class Patient {
private String name;
private int age;
public Patient(String name, int age) {
this.name = name;
this.age = age;
}
public String getName() {
return name;
}
public int getAge() {
return age;
}
}
// 病历管理系统类
public class MedicalRecordSystem {
private List patients;
public MedicalRecordSystem() {
this.patients = new ArrayList<>();
}
public void addPatient(Patient patient) {
patients.add(patient);
}
public Patient findPatient(String name) {
for (Patient patient : patients) {
if (patient.getName().equals(name)) {
return patient;
}
}
return null;
}
}
顶一下
(0)
踩一下
(0)