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

📄 prescription.java

📁 类 &#8226 Person:PTS系统中的一个抽象类。 &#8226 Customer: Person类继承下来的客户即病人类。 &#8226 Prescription:病人处方类
💻 JAVA
字号:
Prescription.java
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Date;

public class Prescription{
	private int prescriptionId;
	private String doctorName;
	private String doctorphone;
	private String startDate;
	private String endDate;
	private int number;
	
	private Customer customerOwner;
	private HashMap<String, Medicine> includedMedicine;
	//----------------
	// Constructor(s).
	//----------------
	public Prescription(int pId, String dName, String dPhone,String sDate, 
	          String eDate,int number,Customer customer) {
		setPrescriptionId(pId);
		setDoctorName(dName);
		setDoctorphone(dPhone);
		setStartDate(sDate);
		setEndDate(eDate);
		setNumber(number);
		setCustomerOwner(customer);
		
		includedMedicine= new HashMap<String, Medicine>();
		// Note that we're instantiating empty support Collection(s).
	}


	//------------------
	// Accessor methods.
	//------------------
	public void setPrescriptionId(int id) {
		prescriptionId = id;
	}

	public int getPrescriptionId() {
		return prescriptionId;
	}

	public void setDoctorName(String name) {
		doctorName = name;
	}

	public String getDoctorName() {
		return doctorName;
	}

	public void setDoctorphone(String phone) {
		doctorphone = phone;
	}

	public String getDoctorphone() {
		return doctorphone;
	}

	public void setStartDate(String start) {
		startDate = start;
	}

	public String getStartDate() {
		return startDate;
	}
	public void setEndDate(String end) {
		endDate = end;
	}
	public String getEndDate() {
		return endDate;
	}		
	public void setNumber(int u) {
		number = u;
	}
	public int getNumber() {
		return number;
	}
	public void setCustomerOwner(Customer c) {
		customerOwner = c;
	}
	public Customer getCustomerOwner() {
		return customerOwner;
	}
	public HashMap<String, Medicine> getIncludedMedicine() {
		return includedMedicine;
	}
	public String toString() {
		return getPrescriptionId() + " - " +
		       getDoctorName() + " - " +
		       getDoctorphone() + " - " +
		       getStartDate() +  " - " +
		       getEndDate() + " - " +
		       getNumber();
	}

	public void display() {

        System.out.println("=========================");
        System.out.println("       Prescription :    ");
	    System.out.println("=========================");
		System.out.println("\tPrescription Id:  " + getPrescriptionId());
		System.out.println("\tCustomerOwner" + getCustomerOwner());
		System.out.println("\tNumber: " + getNumber());
		System.out.println("\tDoctor Name:  " + 
				   getDoctorName());
		System.out.println("\tDoctor Phone:  " + getDoctorphone());
		System.out.println("\tStart Date:  " + getStartDate());
		System.out.println("\tEnd Date:  " + getEndDate());
		for (Medicine m : includedMedicine.values()) {
			m.display();
			System.out.println();
		}
	}
	public void addMedicine(Medicine m){
		String key=m.getMedicineName();
		includedMedicine.put(key,m);		

	}
	public boolean isOutOfDate(){
		Calendar rightnow = Calendar.getInstance();
		if(rightnow>endDate) return ture;
		else return falae;
		
		}
	}


⌨️ 快捷键说明

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