forked from openmrs/openmrs-module-radiology
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RAD-272 Provide support radiology report templates
- Loading branch information
Showing
18 changed files
with
1,192 additions
and
2 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
api/src/main/java/org/openmrs/module/radiology/RadiologyUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* This Source Code Form is subject to the terms of the Mozilla Public License, | ||
* v. 2.0. If a copy of the MPL was not distributed with this file, You can | ||
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under | ||
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license. | ||
* | ||
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS | ||
* graphic logo is a trademark of OpenMRS Inc. | ||
*/ | ||
package org.openmrs.module.radiology; | ||
|
||
import java.io.File; | ||
|
||
/** | ||
* utility methods specific to the radiology module | ||
*/ | ||
public class RadiologyUtil { | ||
|
||
/** | ||
* get the path to directory that stores templates | ||
* | ||
* @return returns the folder of radiology report templates | ||
* | ||
* @should should return valid directory | ||
* @should create repo if missing | ||
* @should throw exception if repo cannot be created | ||
*/ | ||
public static final File getTemplateRepository() { | ||
// TODO still to provide implementation, just created a skeleton to model my work | ||
return null; | ||
} | ||
|
||
/** | ||
* get the path to directory that stores reports | ||
* | ||
* @return returns the folder containing radiology reports | ||
* | ||
* @should should return valid directory | ||
* @should create repo if missing | ||
* @should throw exception if repo cannot be created | ||
*/ | ||
public static final File getReportRepository() { | ||
// TODO still to provide implementation, just created a skeleton to model my work | ||
return null; | ||
} | ||
} |
76 changes: 76 additions & 0 deletions
76
...ain/java/org/openmrs/module/radiology/report/template/HibernateMRRTReportTemplateDAO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/** | ||
* This Source Code Form is subject to the terms of the Mozilla Public License, | ||
* v. 2.0. If a copy of the MPL was not distributed with this file, You can | ||
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under | ||
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license. | ||
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS | ||
* graphic logo is a trademark of OpenMRS Inc. | ||
*/ | ||
package org.openmrs.module.radiology.report.template; | ||
|
||
import java.util.List; | ||
|
||
import org.hibernate.SessionFactory; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
/** | ||
* Hibernate specific MRRTReportTemplate related functions. This class should not be used directly. All | ||
* calls should go through the {@link org.openmrs.module.radiology.report.MRRTReportTEmplateService} methods. | ||
* | ||
* @see org.openmrs.module.radiology.order.MRRTReportTemplateDAO | ||
* @see org.openmrs.module.radiology.order.MRRTReportTemplateService | ||
*/ | ||
class HibernateMRRTReportTemplateDAO implements MRRTReportTemplateDAO { | ||
|
||
|
||
@Autowired | ||
private SessionFactory sessionFactory; | ||
|
||
/** | ||
* Set session factory that allows us to connect to the database that Hibernate knows about. | ||
* | ||
* @param sessionFactory | ||
*/ | ||
public void setSessionFactory(SessionFactory sessionFactory) { | ||
this.sessionFactory = sessionFactory; | ||
} | ||
|
||
/** | ||
* @see org.openmrs.module.radiology.report.template.MRRTReportTemplateService#getMRRTReportTemplate(Integer) | ||
*/ | ||
@Override | ||
public MRRTReportTemplate getMRRTReportTemplate(Integer templateId) { | ||
return (MRRTReportTemplate) sessionFactory.getCurrentSession() | ||
.get(MRRTReportTemplate.class, templateId); | ||
} | ||
|
||
/** | ||
* @see org.openmrs.module.radiology.report.template.MRRTReportTemplateService#getAllMRRTReportTemplates() | ||
*/ | ||
@SuppressWarnings("unchecked") | ||
@Override | ||
public List<MRRTReportTemplate> getAllMRRTReportTemplates() { | ||
return sessionFactory.getCurrentSession() | ||
.createCriteria(MRRTReportTemplate.class) | ||
.list(); | ||
} | ||
|
||
/** | ||
* @see org.openmrs.module.radiology.report.template.MRRTReportTemplateService#getSaveMRRTReportTemplate(MRRTReportTemplate) | ||
*/ | ||
@Override | ||
public MRRTReportTemplate saveMRRTReportTemplate(MRRTReportTemplate template) { | ||
sessionFactory.getCurrentSession() | ||
.save(template); | ||
return template; | ||
} | ||
|
||
/** | ||
* @see org.openmrs.module.radiology.report.template.MRRTReportTemplateService#purgeMRRTReportTemplate(MRRTReportTemplate) | ||
*/ | ||
@Override | ||
public void purgeMRRTReportTemplate(MRRTReportTemplate template) { | ||
sessionFactory.getCurrentSession() | ||
.delete(template); | ||
} | ||
} |
167 changes: 167 additions & 0 deletions
167
api/src/main/java/org/openmrs/module/radiology/report/template/MRRTReportTemplate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
/** | ||
* This Source Code Form is subject to the terms of the Mozilla Public License, | ||
* v. 2.0. If a copy of the MPL was not distributed with this file, You can | ||
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under | ||
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license. | ||
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS | ||
* graphic logo is a trademark of OpenMRS Inc. | ||
*/ | ||
package org.openmrs.module.radiology.report.template; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.openmrs.BaseOpenmrsObject; | ||
|
||
public class MRRTReportTemplate extends BaseOpenmrsObject { | ||
|
||
|
||
private Integer templateId; | ||
|
||
private String title; | ||
|
||
private String description; | ||
|
||
private String charset; | ||
|
||
private String identifier; | ||
|
||
private String type; | ||
|
||
private String language; | ||
|
||
private String publisher; | ||
|
||
private String rights; | ||
|
||
private String license; | ||
|
||
private String date; | ||
|
||
private String creator; | ||
|
||
private List<String> contributors; | ||
|
||
private String path; | ||
|
||
public String getTitle() { | ||
return title; | ||
} | ||
|
||
public void setTitle(String title) { | ||
this.title = title; | ||
} | ||
|
||
public String getCharset() { | ||
return charset; | ||
} | ||
|
||
public void setCharset(String charset) { | ||
this.charset = charset; | ||
} | ||
|
||
public String getIdentifier() { | ||
return identifier; | ||
} | ||
|
||
public void setIdentifier(String identifier) { | ||
this.identifier = identifier; | ||
} | ||
|
||
public String getType() { | ||
return type; | ||
} | ||
|
||
public void setType(String type) { | ||
this.type = type; | ||
} | ||
|
||
public String getLanguage() { | ||
return language; | ||
} | ||
|
||
public void setLanguage(String language) { | ||
this.language = language; | ||
} | ||
|
||
public String getPublisher() { | ||
return publisher; | ||
} | ||
|
||
public void setPublisher(String publisher) { | ||
this.publisher = publisher; | ||
} | ||
|
||
public String getRights() { | ||
return rights; | ||
} | ||
|
||
public void setRights(String rights) { | ||
this.rights = rights; | ||
} | ||
|
||
public String getLicense() { | ||
return license; | ||
} | ||
|
||
public void setLicense(String license) { | ||
this.license = license; | ||
} | ||
|
||
public String getDate() { | ||
return date; | ||
} | ||
|
||
public void setDate(String content) { | ||
this.date = content; | ||
} | ||
|
||
public String getCreator() { | ||
return creator; | ||
} | ||
|
||
public void setCreator(String creator) { | ||
this.creator = creator; | ||
} | ||
|
||
public List<String> getContributors() { | ||
return contributors; | ||
} | ||
|
||
public void setContributors(List<String> contributors) { | ||
this.contributors = contributors; | ||
} | ||
|
||
public String getPath() { | ||
return path; | ||
} | ||
|
||
public void setPath(String path) { | ||
this.path = path; | ||
} | ||
|
||
public void addContributor(String contributor) { | ||
if (contributors == null) { | ||
contributors = new ArrayList<String>(); | ||
} | ||
contributors.add(contributor); | ||
} | ||
|
||
public String getDescription() { | ||
return description; | ||
} | ||
|
||
public void setDescription(String description) { | ||
this.description = description; | ||
} | ||
|
||
@Override | ||
public Integer getId() { | ||
return this.templateId; | ||
} | ||
|
||
@Override | ||
public void setId(Integer id) { | ||
this.templateId = id; | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
api/src/main/java/org/openmrs/module/radiology/report/template/MRRTReportTemplateDAO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* This Source Code Form is subject to the terms of the Mozilla Public License, | ||
* v. 2.0. If a copy of the MPL was not distributed with this file, You can | ||
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under | ||
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license. | ||
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS | ||
* graphic logo is a trademark of OpenMRS Inc. | ||
*/ | ||
package org.openmrs.module.radiology.report.template; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* MRRTReportTemplate-related database functions | ||
* | ||
* @see org.openmrs.module.radiology.report.template.MRRTReportTemplateService | ||
*/ | ||
interface MRRTReportTemplateDAO { | ||
|
||
|
||
/** | ||
* @see org.openmrs.module.radiology.report.template.MRRTReportTemplateService#getMRRTReportTemplate(Integer) | ||
*/ | ||
public MRRTReportTemplate getMRRTReportTemplate(Integer templateId); | ||
|
||
/** | ||
* @see org.openmrs.module.radiology.report.template.MRRTReportTemplateService#getAllMRRTReportTemplates() | ||
*/ | ||
public List<MRRTReportTemplate> getAllMRRTReportTemplates(); | ||
|
||
/** | ||
* @see org.openmrs.module.radiology.report.template.MRRTReportTemplateService#getSaveMRRTReportTemplate(MRRTReportTemplate) | ||
*/ | ||
public MRRTReportTemplate saveMRRTReportTemplate(MRRTReportTemplate template); | ||
|
||
/** | ||
* @see org.openmrs.module.radiology.report.template.MRRTReportTemplateService#purgeMRRTReportTemplate(MRRTReportTemplate) | ||
*/ | ||
public void purgeMRRTReportTemplate(MRRTReportTemplate template); | ||
} |
26 changes: 26 additions & 0 deletions
26
...c/main/java/org/openmrs/module/radiology/report/template/MRRTReportTemplateException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* This Source Code Form is subject to the terms of the Mozilla Public License, | ||
* v. 2.0. If a copy of the MPL was not distributed with this file, You can | ||
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under | ||
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license. | ||
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS | ||
* graphic logo is a trademark of OpenMRS Inc. | ||
*/ | ||
package org.openmrs.module.radiology.report.template; | ||
|
||
public class MRRTReportTemplateException extends Exception { | ||
|
||
|
||
/** | ||
* default serialization id | ||
*/ | ||
private static final long serialVersionUID = 1L; | ||
|
||
public MRRTReportTemplateException() { | ||
} | ||
|
||
public MRRTReportTemplateException(String message) { | ||
super(message); | ||
} | ||
|
||
} |
Oops, something went wrong.