Changeset 3463
- Timestamp:
- 09/06/10 17:16:59 (17 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
molgenis_projects/col7a1/handwritten/java/service/PatientService.java
r3460 r3463 9 9 import jxl.Workbook; 10 10 11 import org.apache.commons.lang.ObjectUtils; 11 12 import org.apache.commons.lang.StringUtils; 12 13 import org.apache.log4j.Logger; … … 121 122 public int insert(PatientSummaryVO patientSummaryVO) throws Exception 122 123 { 124 if (patientSummaryVO == null) 125 return 0; 126 123 127 try 124 128 { … … 126 130 db.beginTx(); 127 131 128 // If patientSummaryVO.mutation1 is existent, add it and link to patient 129 130 if (StringUtils.isNotEmpty(patientSummaryVO.getMutation1().getCdna_notation())) 131 { 132 this.db.update(patientSummaryVO.getMutation1()); 133 134 List<Mutation> mutations1 = this.db.findByExample(patientSummaryVO.getMutation1()); 135 if (mutations1.size() == 1) 136 patientSummaryVO.getPatient().setMutation1(mutations1.get(0)); 137 } 138 139 // If patientSummaryVO.mutation2 is existent, add it and link to patient 140 141 if (StringUtils.isNotEmpty(patientSummaryVO.getMutation2().getCdna_notation())) 142 { 143 this.db.update(patientSummaryVO.getMutation2()); 144 145 List<Mutation> mutations2 = this.db.findByExample(patientSummaryVO.getMutation2()); 146 if (mutations2.size() == 1) 147 patientSummaryVO.getPatient().setMutation2(mutations2.get(0)); 148 } 149 150 // // Phenotypes are never added via patients, just select 151 // List<Phenotype> phenotypes = this.db.findByExample(patientSummaryVO.getPhenotype()); 152 // logger.debug(">>> phenotypes==" + phenotypes.size()); 153 // if (phenotypes.size() == 1) 154 // patientSummaryVO.getPatient().setPhenotype(phenotypes.get(0)); 155 // else 156 // { 157 // Phenotype phenotype = new Phenotype(); 158 // phenotype.setName("DEB-u"); 159 // List<Phenotype> phenotypes2 = this.db.findByExample(phenotype); 160 // patientSummaryVO.getPatient().setPhenotype(phenotypes2.get(0)); 161 // } 162 163 // // Publications are currently not added via patients, just select 164 // List<Publication> publications = this.db.findByExample(patientSummaryVO.getPublication()); 165 // if (publications.size() == 1) 166 // patientSummaryVO.getPatient().setPublication(publications.get(0)); 132 if (patientSummaryVO.getMutation1().getId() != null) 133 patientSummaryVO.getPatient().setMutation1(patientSummaryVO.getMutation1().getId()); 134 135 if (patientSummaryVO.getMutation2().getId() != null) 136 patientSummaryVO.getPatient().setMutation2(patientSummaryVO.getMutation2().getId()); 137 138 if (patientSummaryVO.getPhenotype().getId() != null) 139 patientSummaryVO.getPatient().setPhenotype(patientSummaryVO.getPhenotype().getId()); 140 141 // Insert/update publication and get primary key 142 this.db.update(patientSummaryVO.getPublication()); 143 144 List<Publication> publications = this.db.findByExample(patientSummaryVO.getPublication()); 145 if (publications.size() == 1) 146 patientSummaryVO.getPatient().setPublication(publications.get(0)); 167 147 168 148 // Insert patient and set primary key … … 218 198 219 199 patientSummaryVO.setPhenotype(phenotype); 220 patientSummaryVO.getPatient().setPhenotype(phenotype);221 200 } 222 201
Note: See TracChangeset
for help on using the changeset viewer.