Changeset 1767
- Timestamp:
- Dec 4, 2012, 9:27:53 AM (10 years ago)
- Location:
- extensions/net.sf.basedb.reggie/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.reggie/trunk/resources/bloodform.jsp
r1726 r1767 71 71 if (frm.allFirstNames.value == '') 72 72 { 73 setInputStatus('allFirstNames', 'Missing', 'invalid'); 74 frm.allFirstNames.focus(); 73 setInputStatus('allFirstNames', 'Missing', 'warning'); 75 74 formOk = false; 76 75 } … … 82 81 if (frm.familyName.value == '') 83 82 { 84 setInputStatus('familyName', 'Missing', 'invalid'); 85 frm.familyName.focus(); 83 setInputStatus('familyName', 'Missing', 'warning'); 86 84 formOk = false; 87 85 } … … 104 102 return formOk; 105 103 } 104 105 function step2IsAcceptable() 106 { 107 var formOk = true; 108 var frm = document.forms['reggie']; 109 // New patient only 110 if (!patientInfo.id) 111 { 112 formOk = frm.patientCode.value != ''; 113 } 114 return formOk; 115 } 116 106 117 107 118 function step3IsValid() … … 141 152 else if (currentStep == 2) 142 153 { 143 if (step2IsValid()) gotoStep3(); 154 if (step2IsValid()) 155 { 156 gotoStep3(); 157 } 158 else if (step2IsAcceptable()) 159 { 160 if (manual) 161 { 162 gotoStep3(); 163 } 164 else 165 { 166 setInnerHTML('gonext.message', 'Missing name(s). Click \'Next\' to continue registration.'); 167 } 168 } 144 169 } 145 170 } … … 220 245 setInputStatus('pnr', '', 'valid'); 221 246 pnrIsValid = true; 247 } 248 249 function nameOnChange(event) 250 { 251 var field = event.target; 252 if (field.value == '') 253 { 254 setInputStatus(field.name, 'Missing', 'warning'); 255 } 256 else 257 { 258 setInputStatus(field.name, '', 'valid'); 259 } 222 260 } 223 261 … … 601 639 <td class="prompt">Family name</td> 602 640 <td class="input"><input type="text" name="familyName" 603 value="" size="35" maxlength="255" 641 value="" size="35" maxlength="255" onblur="nameOnChange(event)" 604 642 onkeypress="focusOnEnter(event, 'allFirstNames')"></td> 605 643 <td class="status" id="familyName.status"></td> … … 608 646 <tr valign="top"> 609 647 <td class="prompt">All first names</td> 610 <td class="input"><input type="text" name="allFirstNames" 648 <td class="input"><input type="text" name="allFirstNames" onblur="nameOnChange(event)" 611 649 size="35" maxlength="255" onkeypress="doOnTabOrEnter(event, goNextAuto)"></td> 612 650 <td class="status" id="allFirstNames.status"></td> -
extensions/net.sf.basedb.reggie/trunk/resources/persinfo.jsp
r1726 r1767 74 74 if (frm.allFirstNames.value == '') 75 75 { 76 setInputStatus('allFirstNames', 'Missing', 'invalid'); 77 frm.allFirstNames.focus(); 76 setInputStatus('allFirstNames', 'Missing', 'warning'); 78 77 formOk = false; 79 78 } … … 85 84 if (frm.familyName.value == '') 86 85 { 87 setInputStatus('familyName', 'Missing', 'invalid'); 88 frm.familyName.focus(); 86 setInputStatus('familyName', 'Missing', 'warning'); 89 87 formOk = false; 90 88 } … … 109 107 if (frm.existingAllFirstNames.value == '') 110 108 { 111 setInputStatus('existingAllFirstNames', 'Missing', 'invalid'); 112 frm.existingAllFirstNames.focus(); 109 setInputStatus('existingAllFirstNames', 'Missing', 'warning'); 113 110 formOk = false; 114 111 } … … 120 117 if (frm.existingFamilyName.value == '') 121 118 { 122 setInputStatus('existingFamilyName', 'Missing', 'invalid'); 123 frm.existingFamilyName.focus(); 119 setInputStatus('existingFamilyName', 'Missing', 'warning'); 124 120 formOk = false; 125 121 } … … 132 128 return formOk; 133 129 } 130 131 function step2IsAcceptable() 132 { 133 var formOk = true; 134 var frm = document.forms['reggie']; 135 // New patient only 136 if (!patientInfo.id) 137 { 138 formOk = frm.patientCode.value != ''; 139 } 140 return formOk; 141 } 142 143 134 144 135 145 function step3IsValid() … … 173 183 else if (currentStep == 2) 174 184 { 175 if (step2IsValid()) gotoStep3(); 185 if (step2IsValid()) 186 { 187 gotoStep3(); 188 } 189 else if (step2IsAcceptable()) 190 { 191 if (manual) 192 { 193 gotoStep3(); 194 } 195 else 196 { 197 setInnerHTML('gonext.message', 'Missing name(s). Click \'Next\' to continue registration.'); 198 } 199 } 176 200 } 177 201 } … … 253 277 } 254 278 279 function nameOnChange(event) 280 { 281 var field = event.target; 282 if (field.value == '') 283 { 284 setInputStatus(field.name, 'Missing', 'warning'); 285 } 286 else 287 { 288 setInputStatus(field.name, '', 'valid'); 289 } 290 } 291 255 292 function lateralityOnChange() 256 293 { … … 351 388 } 352 389 353 if ( !Dates.isDate(samplingDate, 'yyyyMMdd'))390 if (samplingDate != '' && !Dates.isDate(samplingDate, 'yyyyMMdd')) 354 391 { 355 392 setInputStatus('samplingDate', 'Not a valid date', 'invalid'); … … 366 403 } 367 404 } 368 setInputStatus('samplingDate', '', 'valid'); 405 if (samplingDate == '') 406 { 407 setInputStatus('samplingDate', 'Missing', 'warning'); 408 } 409 else 410 { 411 setInputStatus('samplingDate', '', 'valid'); 412 } 369 413 } 370 414 samplingDateIsValid = true; … … 929 973 <td class="prompt">Family name</td> 930 974 <td class="input"><input type="text" name="familyName" 931 value="" size="35" maxlength="255" 975 value="" size="35" maxlength="255" onblur="nameOnChange(event)" 932 976 onkeypress="focusOnEnter(event, 'allFirstNames')"></td> 933 977 <td class="status" id="familyName.status"></td> … … 936 980 <tr valign="top"> 937 981 <td class="prompt">All first names</td> 938 <td class="input"><input type="text" name="allFirstNames" 982 <td class="input"><input type="text" name="allFirstNames" onblur="nameOnChange(event)" 939 983 size="35" maxlength="255" onkeypress="doOnTabOrEnter(event, goNextAuto)"></td> 940 984 <td class="status" id="allFirstNames.status"></td> … … 977 1021 <td class="prompt">Family name</td> 978 1022 <td class="input"><input type="text" name="existingFamilyName" 979 value="" size="35" maxlength="255" 1023 value="" size="35" maxlength="255" onblur="nameOnChange(event)" 980 1024 onkeypress="focusOnEnter(event, 'existingAllFirstNames')"></td> 981 1025 <td class="status" id="existingFamilyName.status"></td> … … 984 1028 <tr valign="top"> 985 1029 <td class="prompt">All first names</td> 986 <td class="input"><input type="text" name="existingAllFirstNames" 1030 <td class="input"><input type="text" name="existingAllFirstNames" onblur="nameOnChange(event)" 987 1031 size="35" maxlength="255" onkeypress="doOnTabOrEnter(event, goNextAuto)"></td> 988 1032 <td class="status" id="existingAllFirstNames.status"></td> -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/BloodRegistrationServlet.java
r1736 r1767 14 14 import org.json.simple.parser.JSONParser; 15 15 16 import net.sf.basedb.core.AnnotationSet;17 import net.sf.basedb.core.AnnotationType;18 16 import net.sf.basedb.core.Application; 19 17 import net.sf.basedb.core.BioMaterialEvent; … … 24 22 import net.sf.basedb.reggie.Reggie; 25 23 import net.sf.basedb.reggie.Site; 24 import net.sf.basedb.reggie.converter.StringToDateConverter; 26 25 import net.sf.basedb.reggie.dao.Annotationtype; 27 26 import net.sf.basedb.reggie.dao.Blood; … … 288 287 patient.setName((String)jsonPat.get("name")); 289 288 String pnr = (String)jsonPat.get("personalNumber"); 290 String dateOfBirth = (String)jsonPat.get("dateOfBirth"); 291 String gender = (String)jsonPat.get("gender"); 292 293 AnnotationType personalNumberType = Annotationtype.PERSONAL_NUMBER.load(dc); 294 AnnotationType familyNameType = Annotationtype.FAMILY_NAME.load(dc); 295 AnnotationType allFirstNamesType = Annotationtype.ALL_FIRST_NAMES.load(dc); 296 AnnotationType genderType = Annotationtype.GENDER.load(dc); 297 AnnotationType dateOfBirthType = Annotationtype.DATE_OF_BIRTH.load(dc); 298 299 AnnotationSet as = patient.getAnnotationSet(); 300 as.getAnnotation(personalNumberType).setValue(pnr); 301 as.getAnnotation(familyNameType).setValue((String)jsonPat.get("familyName")); 302 as.getAnnotation(allFirstNamesType).setValue((String)jsonPat.get("allFirstNames")); 303 if (gender != null) as.getAnnotation(genderType).setValue(gender); 304 if (dateOfBirth != null) 305 { 306 SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); 307 df.setLenient(false); 308 as.getAnnotation(dateOfBirthType).setValue(df.parse(dateOfBirth)); 309 } 289 StringToDateConverter dateConverter = new StringToDateConverter(new SimpleDateFormat("yyyy-MM-dd")); 290 Date dateOfBirth = dateConverter.convert((String)jsonPat.get("dateOfBirth")); 291 String gender = Values.getStringOrNull((String)jsonPat.get("gender")); 292 String familyName = Values.getStringOrNull((String)jsonPat.get("familyName")); 293 String allFirstNames = Values.getStringOrNull((String)jsonPat.get("allFirstNames")); 294 295 Annotationtype.PERSONAL_NUMBER.setAnnotationValue(dc, patient, pnr); 296 Annotationtype.FAMILY_NAME.setAnnotationValue(dc, patient, familyName); 297 Annotationtype.ALL_FIRST_NAMES.setAnnotationValue(dc, patient, allFirstNames); 298 Annotationtype.GENDER.setAnnotationValue(dc, patient, gender); 299 Annotationtype.DATE_OF_BIRTH.setAnnotationValue(dc, patient, dateOfBirth); 300 310 301 if (gender == null || dateOfBirth == null) 311 302 { -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/PersonalRegistrationServlet.java
r1677 r1767 26 26 import net.sf.basedb.reggie.Reggie; 27 27 import net.sf.basedb.reggie.Site; 28 import net.sf.basedb.reggie.converter.StringToDateConverter; 28 29 import net.sf.basedb.reggie.dao.Annotationtype; 29 30 import net.sf.basedb.reggie.dao.Blood; … … 543 544 Number patientId = (Number)jsonPat.get("id"); 544 545 BioSource patient = null; 545 AnnotationType familyNameType = Annotationtype.FAMILY_NAME.load(dc); 546 AnnotationType allFirstNamesType = Annotationtype.ALL_FIRST_NAMES.load(dc); 547 546 String familyName = Values.getStringOrNull((String)jsonPat.get("familyName")); 547 String allFirstNames = Values.getStringOrNull((String)jsonPat.get("allFirstNames")); 548 548 if (patientId != null) 549 549 { 550 550 patient = BioSource.getById(dc, patientId.intValue()); 551 551 // Update names 552 AnnotationSet as = patient.getAnnotationSet(); 553 as.getAnnotation(familyNameType).setValue((String)jsonPat.get("familyName")); 554 as.getAnnotation(allFirstNamesType).setValue((String)jsonPat.get("allFirstNames")); 552 Annotationtype.FAMILY_NAME.setAnnotationValue(dc, patient, familyName); 553 Annotationtype.ALL_FIRST_NAMES.setAnnotationValue(dc, patient, allFirstNames); 555 554 } 556 555 else … … 561 560 patient.setName((String)jsonPat.get("name")); 562 561 String pnr = (String)jsonPat.get("personalNumber"); 563 String dateOfBirth = (String)jsonPat.get("dateOfBirth"); 564 String gender = (String)jsonPat.get("gender"); 565 566 AnnotationType personalNumberType = Annotationtype.PERSONAL_NUMBER.load(dc); 567 AnnotationType genderType = Annotationtype.GENDER.load(dc); 568 AnnotationType dateOfBirthType = Annotationtype.DATE_OF_BIRTH.load(dc); 569 570 AnnotationSet as = patient.getAnnotationSet(); 571 as.getAnnotation(personalNumberType).setValue(pnr); 572 as.getAnnotation(familyNameType).setValue((String)jsonPat.get("familyName")); 573 as.getAnnotation(allFirstNamesType).setValue((String)jsonPat.get("allFirstNames")); 574 if (gender != null) as.getAnnotation(genderType).setValue(gender); 575 if (dateOfBirth != null) 576 { 577 SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); 578 df.setLenient(false); 579 as.getAnnotation(dateOfBirthType).setValue(df.parse(dateOfBirth)); 580 } 562 StringToDateConverter dateConverter = new StringToDateConverter(new SimpleDateFormat("yyyy-MM-dd")); 563 Date dateOfBirth = dateConverter.convert((String)jsonPat.get("dateOfBirth")); 564 String gender = Values.getStringOrNull((String)jsonPat.get("gender")); 565 566 Annotationtype.PERSONAL_NUMBER.setAnnotationValue(dc, patient, pnr); 567 Annotationtype.FAMILY_NAME.setAnnotationValue(dc, patient, familyName); 568 Annotationtype.ALL_FIRST_NAMES.setAnnotationValue(dc, patient, allFirstNames); 569 Annotationtype.GENDER.setAnnotationValue(dc, patient, gender); 570 Annotationtype.DATE_OF_BIRTH.setAnnotationValue(dc, patient, dateOfBirth); 571 581 572 if (gender == null || dateOfBirth == null) 582 573 {
Note: See TracChangeset
for help on using the changeset viewer.