Emergencytriagejava Provided Necessary Information Making Sure Delete Lines Beginning Sour Q27892589
/**
* EmergencyTriage.java
* Provided the necessary information here,
* making sure to delete these lines.
*/
// This is the beginning of the source code to helpyou get started.
// Do not change the following:
public class EmergencyTriage {
private Heap<ERPatient> waiting;
/**
* The empty EmergencyTriage isinitialized.
*/
public EmergencyTriage() {
waiting = newHeap<>();
}
/**
* Heap.java
* Provide the necessary header information here,
* making sure to delete these lines.
*/
import java.util.List;
import java.util.ArrayList;
import java.util.NoSuchElementException;
// This is the beginning of the source code to helpyou get started.
// Do not change the following:
public class Heap<E extends Comparable<E>>{
private ArrayList<E>heap;
private int size;
private static final int CAPACITY = 100;
/**
* Creates an empty heap.
*/
public Heap() {
heap = newArrayList<E>(CAPACITY);
for (int i=0; i<CAPACITY;i++) {
heap.add(null);
}
}
/**
* NoSuchCategoryException.java
*/
/**
* This exception indicates that the triage category for anERPatient
* not a valid category.
* These categories are determined by the ERPatient class.
*/
public class NoSuchCategoryException extends RuntimeException{
/**
* Creates a new exception.
* @param msg The error message.
*/
public NoSuchCategoryException(String msg){
super(msg);
}
/**
* Creates a new exception.
*/
public NoSuchCategoryException() {
super();
}
}
/**
* ERPatient.java
*/
/**
* Class ERPatient represents the record of a patient presenting toan Emergency room.
* Patients are assessed and registered by the triage nurse, whodetermines
* their level or priority for detailed assessment and treatment inthe Emergency Room.
*/
public class ERPatient implements Comparable<ERPatient> {
private static int admissionNumber= 0;
private int orderStamp;
private String id;
private String lastName;
private String firstName;
private int priorityNum;
protected final static String[]categories = {“Life-threatening”,”Majorfracture”,”Acute”,”Chronic”,”Ambulatory”};
/**
* Creates an ER record for the registeredpatient.
* @param lastName The patient’s last name.
* @param firstName The patient’s first andsubsequent names.
* @param triageCategory: This is the categorygiven by the triage nurse after a preliminary assessment based onthe patient’s complaint and some vital signs.
* The categories used, inorder of priority are:
* <dl>
* <dt>Life-threatening</dt><dd>Needs to be treatedimmediately.</dd>
* <dt>Majorfracture</dt><dd>Needs splinting, support and possiblesurgery.</dd>
* <dt>Acute</dt><dd>Symptoms that indicate anunknown and unfamiliar medical condition.</dd>
* <dt>Chronic</dt><dd>Symptoms appear related to anexacerbation of a known condition.</dd>
* <dt>Ambulatory</dt><dd>Does not need a bed;condition will not worsen with some waiting.</dd>
* </dl>
*/
public ERPatient(String lastName, StringfirstName, String triageCategory) {
this.lastName =lastName;
this.firstName =firstName;
orderStamp =admissionNumber++;
id =lastName+”_”+orderStamp++;
priorityNum =verify_triageCategory(triageCategory);
}
private intverify_triageCategory(String triageCategory) {
for (int i=0;i<categories.length; i++) {
if(triageCategory.toUpperCase().equals(categories[i].toUpperCase())){
return i+1;
}
}
throw newNoSuchCategoryException(categories());
}
private static String categories(){
StringBuilder sb = newStringBuilder(10*categories.length);
sb.append(“Acceptablecategory list:nt”);
for (String s: categories){
sb.append(s+”, “);
}
// the categories are neverempty
// remove the last comma andspace
sb.delete(sb.length()-2,sb.length());
return sb.toString();
}
/**
* Decides which patient has the highest prioritylevel for admission to the
* Emergency room.
* Priority is determined first by the triagecategory, and then by the length of time waiting.
* @param other The patient record being comparedto this patient record.
* @return a number <0 indicates that thispatient has higher priority.
* A number >0indicates that the other patient has higher priority.
* If 0, then the two recordsbelong to the same patient.
* @throws NullPointerExceptionif other is null.
*/
public int compareTo(ERPatient other) {
if (other == null) {
throw newNullPointerException(“Cannot compare ERPatient to a nullobject”);
}
int triageOrder = priorityNum- other.priorityNum;
if (triageOrder == 0) {
triageOrder = orderStamp – other.orderStamp;
}
return triageOrder;
}
/**
* Equality of patient records is determined byid, which indicates that the records
* belong to the same person.
* @param other The patient record tocompare.
* @return true if the records are for the samepatient; false otherwise.
*/
public boolean equals(ERPatient other) {
returnid.equals(other.id);
}
/**
* @return The id number of this patient.
*/
public String getId() {
return id;
}
/**
* @return The priority level assigned thepatient. Lower numbers have higher priority.
*/
public int getPriorityNum() {
return priorityNum;
}
/**
* @return The actual triage category that wasassigned the patient.
*/
public String getTriageCategory() {
returncategories[priorityNum-1];
}
/**
* @return The patient record information.
*/
public String toString() {
return lastName+”,”+firstName+”: order number: “+orderStamp+”, triage category: “
Hospital Admission Information System Description. The local hospital Emergency Room (ER) admits and treats patients that present themselves for medical treatment. Each patient is assessed by a triage nurse, who performs a preliminary assessment to determine the priority level of the patient’s presenting complaints. If the patient needs immediate attention, the triage nurse provides enough intervention to stabilize them. An ER patient record is initialized, containing the patients’s name and complaint. A priority level is added to the record by the triage nurse. Patients are released from “triage” into the ER proper once there is an available Emergency Room Physician who can provide further assessment, treatment, is and referrals as needed. ER physicians treat patients in the order of the triage queue, which manages an orde determined firstly by the triage nurse’s assessment and secondly by the amount of time that has passed since the patient registered. Show transcribed image text