Inheritance diagram for PatientList:
Public Member Functions | |
PatientList (String prefix, Form form) | |
void | loadValues () |
void | deletePatient (int id) |
void | display (boolean hidden) |
Public Attributes | |
ActionButton | action |
PatientEditor | editor |
int | patient_id = 0 |
Static Public Attributes | |
static final int | EDIT = 1 |
static final int | DELETE = 2 |
Definition at line 3 of file PatientList.java.
|
Definition at line 12 of file PatientList.java. References action, Widget::addChild(), and Widget::n(). 00013 { 00014 super(prefix, form); 00015 action = new ActionButton(n("action"), form); 00016 addChild(action); 00017 }
|
|
Definition at line 59 of file PatientList.java. References Query::close(), Form::connectDb(), Query::execute(), Widget::form, and Form::pw. 00060 { 00061 Query q = new Query(form.connectDb(), form.pw); 00062 try 00063 { 00064 String where1 = " WHERE patient_id = " + id; 00065 String where2 = " WHERE appointment_id IN (SELECT appointment_id FROM appointments" + where1 + ")"; 00066 q.execute( 00067 "DELETE FROM appointment_services" + where2 + ";\n" + 00068 "DELETE FROM diagnoses" + where2 + ";\n" + 00069 "DELETE FROM referrals" + where2 + ";\n" + 00070 "DELETE FROM appointments" + where1 + ";\n" + 00071 "DELETE FROM patients" + where1 + ";\n" 00072 ); 00073 } 00074 finally 00075 { 00076 q.close(); 00077 } 00078 }
|
|
Reimplemented from Widget. Definition at line 80 of file PatientList.java. References action, Query::close(), Form::connectDb(), DELETE, ActionButton::display(), EDIT, Widget::form, Widget::modalChild, Widget::p(), patient_id, Widget::printAttribute(), Form::pw, Query::query(), and Query::r. 00081 { 00082 super.display(hidden); 00083 00084 printAttribute("patient_id", "" + patient_id); 00085 00086 if (hidden || modalChild != null) return; 00087 00088 p("<p align=center>"); 00089 action.display("Create new patient...", EDIT, -1); 00090 p("</p>"); 00091 00092 Query q = new Query(form.connectDb(), form.pw); 00093 try 00094 { 00095 q.query("\n"+ 00096 " SELECT t.name, t.address, t.phone, c.name || ': ' || p.description, patient_id\n"+ 00097 " FROM patients AS t\n"+ 00098 " INNER JOIN insurance_policies AS p USING (insurance_policy_id)\n"+ 00099 " INNER JOIN insurance_companies AS c USING (insurance_company_id)\n"+ 00100 " ORDER BY t.name\n"+ 00101 " "); 00102 00103 if (q.r != null) 00104 { 00105 p("<table border=1>\n"); 00106 p("<tr><td>Name</td><td>Phone</td><td>Address</td><td>Insurance</td><td> </td></tr>\n"); 00107 while(q.r.next()) 00108 { 00109 p("<tr><td>" + q.r.getString(1) + "</td><td>" + q.r.getString(2) 00110 + "</td><td>" + q.r.getString(3) + "</td><td>" + q.r.getString(4) 00111 + "</td><td>"); 00112 00113 action.display("Edit", EDIT, q.r.getInt(5)); 00114 action.display("Delete", DELETE, q.r.getInt(5)); 00115 00116 p("</td></tr>\n"); 00117 } 00118 p("</table>\n"); 00119 } 00120 } 00121 catch(SQLException e) 00122 { 00123 p(e); 00124 } 00125 finally 00126 { 00127 q.close(); 00128 } 00129 }
|
|
Reimplemented from Widget. Definition at line 19 of file PatientList.java. References ActionButton::action, action, Widget::addChild(), DELETE, deletePatient(), PatientEditor::done, EDIT, editor, Widget::form, Widget::loadAttribute(), PatientEditor::loadDefaults(), PatientEditor::loadValues(), Widget::modal, Widget::modalChild, Widget::n(), ActionButton::param, patient_id, and Widget::toInt(). 00020 { 00021 super.loadValues(); 00022 00023 int a = toInt(loadAttribute("patient_id"),0); 00024 boolean editing = a != 0; 00025 00026 for(;;) 00027 if (editing) 00028 { 00029 if (a != 0) patient_id = a; 00030 editor = new PatientEditor(patient_id, n("editor"), form); 00031 addChild(editor); 00032 if (a != 0) editor.loadValues(); else editor.loadDefaults(); 00033 if (editor.done) 00034 patient_id = 0; 00035 else 00036 { 00037 modalChild = editor; 00038 editor.modal = true; 00039 } 00040 return; 00041 } 00042 else 00043 { 00044 switch (action.action) 00045 { 00046 case EDIT: 00047 editing = true; 00048 patient_id = action.param; 00049 break; 00050 case DELETE: 00051 deletePatient(action.param); 00052 return; 00053 default: 00054 return; 00055 } 00056 } 00057 }
|
|
Definition at line 5 of file PatientList.java. |
|
Definition at line 10 of file PatientList.java. |
|
Definition at line 9 of file PatientList.java. |
|
Definition at line 6 of file PatientList.java. |
|
Definition at line 7 of file PatientList.java. |