⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pts_test.java

📁 java语言描述的一个简单处方跟踪系统。描述病人
💻 JAVA
字号:

//测试程序
import java.util.ArrayList;
import java.util.GregorianCalendar;

public class Pts_Test {
	public static ArrayList<Doctor> doctors; 
	public static ArrayList<Patient>patients; 
	public static ArrayList<Prescription>prescriptions;
	
	public static void main(String[] args) {
		Doctor d1,d2;
		Patient pa1,pa2,pa3;
		Prescription p1,p2,p3;
		Medicine m1,m2,m3,m4,m5,m6,m7,m8;
		PrescriptionEntry pe1,pe2,pe3,pe4,pe5,pe6;
		GregorianCalendar g1,g2,g3,g4,g5,g6;
		
		//  创建医生并存储于 doctors之中
		d1 = new Doctor("John ","KaiFuQu","Mam","13456235478",45,"Adjunct Professor","surgical department ");
		d2 = new Doctor("Rose ","TianXinQu","Women","15698745236",36,"Full Professor","medical department ");
		doctors = new ArrayList<Doctor>();
		doctors.add(d1);
		doctors.add(d2);
		
		//创建患者并存储于Patient之中
		pa1 = new Patient("Jack","TianXinQu","Man","7854963",36,"RenShouBaoXian","2032-5423");
		pa2 = new Patient("Fred", "YuHuaQu","Mam","5224162",40, "ZhongHuaBaoXian", "2100-2432");
		pa3 = new Patient("Smith","KaiFuQu", "Woman", "8414230", 34,"HuaKeBaoXian","2145-4533");
		patients = new ArrayList<Patient>();
		patients.add(pa1);
		patients.add(pa2);
		patients.add(pa3);
		
		//创建日期
		g1 = new GregorianCalendar(2006,7,10);
		g2 = new GregorianCalendar(2006,12,10);
		g3 = new GregorianCalendar(2007,1,3);
		g4 = new GregorianCalendar(2007,3,3);
		g5 = new GregorianCalendar(2008,2,4);
		g6 = new GregorianCalendar(2008,6,4);
		
		//创建药物
		m1 = new Medicine("Penicillin");
		m2 = new Medicine("Amoxicillin");
		m3 = new Medicine("Anodyne");
		m4 = new Medicine("vitamineC");
		m5 = new Medicine("Chloromycetin");
		m6 = new Medicine("Yunnan white Ppowder");
		m7 = new Medicine("Antidiarrheal Agent");
		m8 = new Medicine("Coldrex");
		
		//为药物添加替代药物及副作用
		m1.addReplace(m8);
		m3.addReplace(m6);
		m4.addReplace(m7);
		m3.addSideEffect("throw up");
		m6.addSideEffect("skin allergy");
		m8.addSideEffect("be harmful to liver");
					
		//创建处方并存储于prescriptions之中
		p1 = new Prescription(200674,d1,pa1,4,g1,g2);
		p2 = new Prescription(200685,d1,pa1,2,g3,g4);
		p3 = new Prescription(200693,d2,pa2,6,g5,g6);
		prescriptions = new ArrayList<Prescription>();
		prescriptions.add(p1);
		prescriptions.add(p2);
		prescriptions.add(p3);
				
		//创建处方单元
		pe1 = new PrescriptionEntry(m1,p1,5,"bottles",false);
		pe2 = new PrescriptionEntry(m2,p1,9,"pieces",true);
		pe3 = new PrescriptionEntry(m3,p1,18,"pieces",false);
		pe4 = new PrescriptionEntry(m4,p2,30,"pieces",true);
		pe5 = new PrescriptionEntry(m5,p2,1,"bottles",false);
		pe6 = new PrescriptionEntry(m6,p3,3,"bottles",false);
						
		//打印处方实例
		System.out.println("            =========   Prescription  Examples    =========           ");
		System.out.println();
		p1.display();
		System.out.println();
		p2.display();
		System.out.println();
		p3.display();
		System.out.println();
		
		//查询打印出用户c1的处方记录
		System.out.println();
		System.out.println();
		System.out.println(pa1.getName()+":\nThe record of the prescription:");
	    allThePrescription(pa1.getName());
	}
	
	//查询打印某患者的所有处方
	public static void allThePrescription(String n){
		for(Patient pa: patients){
			if(pa.getName()==n) 
				pa.displayPrescriptions();
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -