// MedicalRecord类,包含了病历信息 public class main { private String patientName; private String visitRecord; private String checkRecord; private String medicalAdvice; public main(String patientName, String visitRecord, String checkRecord, String medicalAdvice) { this.patientName = patientName; this.visitRecord = visitRecord; this.checkRecord = checkRecord; this.medicalAdvice = medicalAdvice; } public String getPatientName() { return patientName; } public String getVisitRecord() { return visitRecord; } public void setVisitRecord(String visitRecord) { this.visitRecord = visitRecord; } public String getCheckRecord() { return checkRecord; } public void setCheckRecord(String checkRecord) { this.checkRecord = checkRecord; } public String getMedicalAdvice() { return medicalAdvice; } public void setMedicalAdvice(String medicalAdvice) { this.medicalAdvice = medicalAdvice; }帮我根据这个写一个main函数
时间: 2023-12-28 10:04:53 浏览: 76
好的,根据提供的 MedicalRecord 类,可以编写以下 main 函数来测试:
```java
public class Main {
public static void main(String[] args) {
// 创建一个病历对象
MedicalRecord medicalRecord = new MedicalRecord("张三", "2021-01-01", "血常规、尿常规、心电图", "多喝水,少吃辣");
// 输出病历信息
System.out.println("患者姓名:" + medicalRecord.getPatientName());
System.out.println("就诊记录:" + medicalRecord.getVisitRecord());
System.out.println("检查记录:" + medicalRecord.getCheckRecord());
System.out.println("医嘱:" + medicalRecord.getMedicalAdvice());
// 修改就诊记录和医嘱
medicalRecord.setVisitRecord("2021-02-02");
medicalRecord.setMedicalAdvice("休息一天,多喝水");
// 再次输出病历信息
System.out.println("患者姓名:" + medicalRecord.getPatientName());
System.out.println("就诊记录:" + medicalRecord.getVisitRecord());
System.out.println("检查记录:" + medicalRecord.getCheckRecord());
System.out.println("医嘱:" + medicalRecord.getMedicalAdvice());
}
}
```
输出结果如下:
```
患者姓名:张三
就诊记录:2021-01-01
检查记录:血常规、尿常规、心电图
医嘱:多喝水,少吃辣
患者姓名:张三
就诊记录:2021-02-02
检查记录:血常规、尿常规、心电图
医嘱:休息一天,多喝水
```
阅读全文