Changeset 1518
- Timestamp:
- Jan 23, 2012, 11:39:49 AM (11 years ago)
- Location:
- extensions/net.sf.basedb.reggie/trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.reggie/trunk/META-INF/servlets.xml
r1472 r1518 12 12 <servlet-name>ReferralForm</servlet-name> 13 13 <servlet-class>net.sf.basedb.reggie.servlet.ReferralFormServlet</servlet-class> 14 </servlet> 15 <servlet> 16 <servlet-name>BloodRegistration</servlet-name> 17 <servlet-class>net.sf.basedb.reggie.servlet.BloodRegistrationServlet</servlet-class> 14 18 </servlet> 15 19 <servlet> -
extensions/net.sf.basedb.reggie/trunk/resources/bloodform.jsp
r1517 r1518 30 30 <script language="JavaScript"> 31 31 32 var debug = false;32 var debug = true; 33 33 var currentStep = 1; 34 34 var pnrIsValid = false; … … 39 39 40 40 var patientInfo = null; 41 var caseInfo = null;41 var bloodInfo = null; 42 42 43 43 function init() … … 156 156 caseIsValid = true; 157 157 158 get CaseInfo();158 getBloodInfo(); 159 159 } 160 160 … … 303 303 } 304 304 305 function get CaseInfo()305 function getBloodInfo() 306 306 { 307 307 // Check entered case and pnr with AJAX … … 309 309 var caseName = frm.caseName.value; 310 310 var request = Ajax.getXmlHttpRequest(); 311 var url = ' PersonalRegistration.servlet?ID=<%=ID%>&cmd=GetCaseInfo';311 var url = 'BloodRegistration.servlet?ID=<%=ID%>&cmd=GetBloodInfo'; 312 312 url += '&caseName=' + caseName; 313 313 request.open("GET", url, false); … … 324 324 325 325 // Get biosource information from the AJAX response 326 caseInfo = response.caseInfo;327 328 if ( caseInfo && caseInfo.patient)329 { 330 frm.personalNumber.value = caseInfo.patient.personalNumber;326 bloodInfo = response.bloodInfo; 327 328 if (bloodInfo && bloodInfo.patient) 329 { 330 frm.personalNumber.value = bloodInfo.patient.personalNumber; 331 331 gotoStep2(); 332 332 } … … 403 403 currentStep = 3; 404 404 405 var updateMode = caseInfo.id && caseInfo.patient;405 var updateMode = bloodInfo.id && bloodInfo.patient; 406 406 407 Main.show('caseSection'); 407 Main.show('bloodSection'); 408 409 if (updateMode) 410 { 411 412 if (bloodInfo.samplingDate != null) 413 { 414 frm.samplingDate.value = bloodInfo.samplingDate.substring(0, 8); 415 frm.samplingTime.value = bloodInfo.samplingDate.substring(9, 13); 416 samplingDateTimeOnChange(); 417 } 418 if (bloodInfo.freezerDate != null) 419 { 420 frm.freezerDate.value = bloodInfo.freezerDate.substring(0, 8); 421 frm.freezerTime.value = bloodInfo.freezerDate.substring(9, 13); 422 freezerDateTimeOnChange(); 423 } 424 frm.serum.checked = bloodInfo.serum == 'Yes'; 425 } 408 426 409 427 Main.hide('gonext'); … … 429 447 var frm = document.forms['reggie']; 430 448 431 caseInfo.samplingDate = Main.trimString(frm.samplingDate.value + ' ' + frm.samplingTime.value);432 caseInfo.freezerDate = Main.trimString(frm.freezerDate.value + ' ' + frm.freezerTime.value);433 caseInfo.serum = frm.serum.checked ? true : false;449 bloodInfo.samplingDate = Main.trimString(frm.samplingDate.value + ' ' + frm.samplingTime.value); 450 bloodInfo.freezerDate = Main.trimString(frm.freezerDate.value + ' ' + frm.freezerTime.value); 451 bloodInfo.serum = frm.serum.checked ? "Yes" : "No"; 434 452 435 453 frm.samplingDate.disabled = true; … … 438 456 frm.freezerTime.disabled = true; 439 457 440 var updateMode = caseInfo.id && caseInfo.patient;458 var updateMode = bloodInfo.id && bloodInfo.patient; 441 459 var submitInfo = new Object(); 442 460 submitInfo.patientInfo = patientInfo; 443 submitInfo. caseInfo = caseInfo;461 submitInfo.bloodInfo = bloodInfo; 444 462 445 463 if (debug) Main.debug(JSON.stringify(submitInfo)); … … 447 465 var request = Ajax.getXmlHttpRequest(); 448 466 var url = 'BloodRegistration.servlet?ID=<%=ID%>&cmd='; 449 url += updateMode ? 'Update Case' : 'CreateCase';467 url += updateMode ? 'UpdateBlood' : 'CreateBlood'; 450 468 request.open("POST", url, false); 451 469 request.setRequestHeader("Content-Type", "application/json"); … … 622 640 623 641 624 <!-- 3. Caseregistration -->625 <div id=" caseSection" style="display: none;">642 <!-- 3. Blood registration --> 643 <div id="bloodSection" style="display: none;"> 626 644 <p> 627 645 <table border="0" cellspacing="0" cellpadding="0" class="stepform"> 628 646 <tr> 629 647 <td rowspan="2" class="stepno">3</td> 630 <td class="steptitle" id="step3.title">Create new case</td>648 <td class="steptitle" id="step3.title">Create new blood</td> 631 649 </tr> 632 650 <tr> -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/Patient.java
r1509 r1518 78 78 } 79 79 80 /** 81 Find the patient the blood case is linked with. Null is returned if 82 not found. 83 @since 2.2 84 */ 85 public static Patient findByBlood(DbControl dc, Blood blood) 86 { 87 Patient patient = null; 88 Sample s = blood.getSample(); 89 BioSource b = s.getParentType() == Item.BIOSOURCE ? (BioSource)s.getParent() : null; 90 if (b != null) 91 { 92 patient = new Patient(b); 93 } 94 return patient; 95 } 96 80 97 81 98 /** -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/ReggieItem.java
r1333 r1518 53 53 Initialize a JSON object with information. Subclasses 54 54 should override this method if the need to put in more 55 than the 'id', 'name' or loaded annotations (see {@link #loadAnnotations(String, AnnotationType )})55 than the 'id', 'name' or loaded annotations (see {@link #loadAnnotations(String, AnnotationType, ValueConverter)}) 56 56 */ 57 57 protected void initJSON(JSONObject json) … … 98 98 Utility method that first finds the annotation type using 99 99 {@link Reggie#findAnnotationType(DbControl, net.sf.basedb.core.Item, String, boolean)} 100 and then calls {@link #loadAnnotations(String, AnnotationType )}.100 and then calls {@link #loadAnnotations(String, AnnotationType, ValueConverter)}. 101 101 */ 102 102 public void loadAnnotations(DbControl dc, String jsonKey, String annotationTypeName, ValueConverter converter) -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/Subtype.java
r1515 r1518 93 93 Load the subtype as a BASE item. 94 94 @param dc The DbControl to use for database access 95 @return 95 @return An ItemSubtype object 96 96 */ 97 97 public ItemSubtype load(DbControl dc) -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/PersonalRegistrationServlet.java
r1513 r1518 26 26 import net.sf.basedb.reggie.converter.DateToStringConverter; 27 27 import net.sf.basedb.reggie.converter.StringToDateConverter; 28 import net.sf.basedb.reggie.dao.Blood; 28 29 import net.sf.basedb.reggie.dao.Case; 29 30 import net.sf.basedb.reggie.dao.Patient; … … 76 77 String caseName = req.getParameter("caseName"); 77 78 Case theCase = Case.findByName(dc, caseName); 79 Patient patient = null; 78 80 List<SpecimenTube> specimenTubes = null; 79 81 JSONObject jsonCase = null; … … 102 104 103 105 // Load the patient associated with the case 104 Patient patient = Patient.findByCase(dc, theCase); 105 // The patient can be null if (for example) we have only registered consent=yes so far 106 if (patient != null) 107 { 108 patient.loadDefaultAnnotations(dc); 109 jsonCase.put("patient", patient.asJSONObject()); 110 } 106 patient = Patient.findByCase(dc, theCase); 111 107 } 112 108 else … … 116 112 jsonCase = new JSONObject(); 117 113 jsonCase.put("name", caseName); 118 } 119 114 115 // Also check for a blood sample so that we can get patient information 116 Blood blood = Blood.findByCaseName(dc, caseName); 117 if (blood != null) patient = Patient.findByBlood(dc, blood); 118 } 119 120 // The patient can be null if (for example) we have only registered consent=yes so far 121 if (patient != null) 122 { 123 patient.loadDefaultAnnotations(dc); 124 jsonCase.put("patient", patient.asJSONObject()); 125 } 126 120 127 // Load specimen tube annotations 121 128 JSONArray jsonTubes = new JSONArray();
Note: See TracChangeset
for help on using the changeset viewer.