Changeset 5425
- Timestamp:
- 09/02/08 14:01:15 (3 months ago)
- Files:
-
- openmrs-modules/patientnotes/branches/example/metadata/config.xml (modified) (2 diffs)
- openmrs-modules/patientnotes/branches/example/metadata/moduleApplicationContext.xml (modified) (2 diffs)
- openmrs-modules/patientnotes/branches/example/metadata/sqldiff.xml (modified) (2 diffs)
- openmrs-modules/patientnotes/branches/example/src/org/openmrs/module/patientnotes/obs (added)
- openmrs-modules/patientnotes/branches/example/src/org/openmrs/module/patientnotes/obs/handler (added)
- openmrs-modules/patientnotes/branches/example/src/org/openmrs/module/patientnotes/obs/handler/RichTextHandler.java (added)
- openmrs-modules/patientnotes/branches/example/src/org/openmrs/module/patientnotes/util (added)
- openmrs-modules/patientnotes/branches/example/src/org/openmrs/module/patientnotes/util/NoteUtils.java (added)
- openmrs-modules/patientnotes/branches/example/web/module/portlets/notePortlet.jsp (modified) (1 diff)
- openmrs-modules/patientnotes/branches/example/web/src/net/fckeditor/connector/ConnectorServlet.java (modified) (3 diffs)
- openmrs-modules/patientnotes/branches/example/web/src/org/openmrs/module/patientnotes/web/controller/NoteFormController.java (modified) (5 diffs)
- openmrs-modules/patientnotes/branches/example/web/src/org/openmrs/module/patientnotes/web/controller/NotePortletController.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
openmrs-modules/patientnotes/branches/example/metadata/config.xml
r5362 r5425 7 7 <id>patientnotes</id> 8 8 <name>Patient Notes</name> 9 <version> 1.0</version>9 <version>0.1</version> 10 10 <package>org.openmrs.module.patientnotes</package> 11 11 <author>Mohammad Shahiduzzaman</author> … … 19 19 <!-- /Base Module Properties --> 20 20 21 <require_version>1. 2.0.3400</require_version>21 <require_version>1.3.0.0000</require_version> 22 22 23 23 <!-- Extensions --> openmrs-modules/patientnotes/branches/example/metadata/moduleApplicationContext.xml
r5421 r5425 42 42 <!-- /Controllers --> 43 43 44 <!-- 44 45 <bean parent="serviceContext"> 45 46 <property name="moduleService"> … … 69 70 </property> 70 71 </bean> 72 --> 71 73 72 74 </beans> openmrs-modules/patientnotes/branches/example/metadata/sqldiff.xml
r5106 r5425 19 19 <date>Jun 22nd 2008</date> 20 20 <description> 21 Creating a table to hold a message for each patient21 <!--Creating a table to hold a message for each patient (experimental table)--> 22 22 </description> 23 23 <sql> 24 <!-- DROP TABLE patientnotes_note;--> 25 24 <!-- 26 25 CREATE TABLE IF NOT EXISTS `patientnotes_note` ( 27 26 `patientnotes_note_id` int(10) NOT NULL auto_increment, … … 34 33 35 34 INSERT INTO patientnotes_note VALUES (1, 'a first note', 385); 35 --> 36 36 </sql> 37 37 </diff> openmrs-modules/patientnotes/branches/example/web/module/portlets/notePortlet.jsp
r5175 r5425 13 13 <div id="patientNotesBox" class="box${model.patientVariation}"> 14 14 <c:forEach var="note" items="${model.notes}" varStatus="status"> 15 <p></p><u>Note ${status.count}:</u> ${note.text} 16 <a href=${pageContext.request.contextPath}/module/patientnotes/patientNote.form?patientId=${model.patient.patientId}&¬eId=${note.noteId}> 15 <p></p><u>Note ${status.count} (Create Date - ${note.dateCreated}):</u> <%--${note.text}--%>${note.valueText} 16 <%-- <a href=${pageContext.request.contextPath}/module/patientnotes/patientNote.form?patientId=${model.patient.patientId}&¬eId=${note.noteId}>--%> 17 <a href=${pageContext.request.contextPath}/module/patientnotes/patientNote.form?patientId=${model.patient.patientId}&&obsId=${note.obsId}> 17 18 <spring:message code="patientnotes.edit.note"/></a> 18 19 </c:forEach> openmrs-modules/patientnotes/branches/example/web/src/net/fckeditor/connector/ConnectorServlet.java
r5421 r5425 50 50 import org.slf4j.LoggerFactory; 51 51 import org.openmrs.util.OpenmrsUtil; 52 import org.openmrs.api.context.Context; 52 53 53 54 /** … … 130 131 131 132 // String typePath = UtilsFile.constructServerSidePath(request, resourceType); 132 // String typePath = "/usr/local/tomcat/webapps/openmrs/userfiles/image"; 133 String typePath = "patientnotes/userfiles/image"; 134 // String typeDirPath = getServletContext().getRealPath(typePath); 133 // String typeDirPath = getServletContext().getRealPath(typePath); 134 // File typeDir = new File(typeDirPath); 135 String typePath = Context.getAdministrationService().getGlobalProperty("obs.complex_obs_dir"); 136 if(typePath == null) { 137 typePath = "patientnotes/userfiles/image"; 138 } 139 135 140 File typeDir = OpenmrsUtil.getDirectoryInApplicationDataDirectory(typePath); 136 // File typeDir = new File(typeDirPath); 141 137 142 UtilsFile.checkDirAndCreate(typeDir); 138 143 … … 231 236 // String typePath = UtilsFile.constructServerSidePath(request, resourceType); 232 237 // String typeDirPath = getServletContext().getRealPath(typePath); 233 //234 238 // File typeDir = new File(typeDirPath); 235 236 String typePath = "patientnotes/userfiles/image"; 239 String typePath = Context.getAdministrationService().getGlobalProperty("obs.complex_obs_dir"); 240 if(typePath == null) { 241 typePath = "patientnotes/userfiles/image"; 242 } 237 243 File typeDir = OpenmrsUtil.getDirectoryInApplicationDataDirectory(typePath); 238 244 openmrs-modules/patientnotes/branches/example/web/src/org/openmrs/module/patientnotes/web/controller/NoteFormController.java
r5175 r5425 16 16 import javax.servlet.http.HttpServletRequest; 17 17 import javax.servlet.http.HttpServletResponse; 18 import javax.imageio.ImageIO; 18 19 19 20 import org.apache.commons.logging.Log; … … 26 27 import org.openmrs.module.patientnotes.Notes; 27 28 import org.openmrs.module.patientnotes.NoteService; 28 import org.openmrs.Patient; 29 import org.openmrs.module.patientnotes.util.NoteUtils; 30 import org.openmrs.*; 31 import org.openmrs.util.OpenmrsUtil; 32 import org.openmrs.obs.ComplexData; 29 33 import org.openmrs.api.context.Context; 34 35 import java.util.Date; 36 import java.util.List; 37 import java.awt.image.BufferedImage; 38 import java.io.File; 39 import java.io.IOException; 30 40 31 41 /** … … 64 74 //HttpSession httpSession = request.getSession(); 65 75 Notes note = (Notes) object; 76 77 // Concept concept = Context.getConceptService().getConcept(Integer.valueOf(1353)); 78 Concept concept = Context.getConceptService().getConceptByName("PATIENT NOTES"); 79 Location location = Context.getEncounterService() 80 .getLocation(Integer.valueOf(1)); 81 82 Obs obs; 83 if (note.getNoteId() == null || note.getNoteId() == 0) { 84 obs = new Obs(); 85 obs.setConcept(concept); 86 obs.setPerson(note.getPatient()); 87 obs.setCreator(Context.getAuthenticatedUser()); 88 obs.setDateCreated(new Date()); 89 obs.setObsDatetime(new Date()); 90 obs.setLocation(location); 91 obs.setVoided(false); 92 obs.setValueText(note.getText()); 93 Context.getObsService().saveObs(obs, null); 94 } else { 95 obs = Context.getObsService().getObs(note.getNoteId()); 96 obs.setValueText(note.getText()); 97 Context.getObsService().saveObs(obs, "Updating existing note observation"); 98 } 99 100 66 101 log.info("in NoteFormController: noteId: " + note.getNoteId() + ", patientId: " + note.getPatient().getPatientId() 67 102 + ", text: " + note.getText()); 68 103 69 NoteService ns = ((NoteService) Context.getService(NoteService.class));70 ns.createNote(note);71 104 return new ModelAndView(new RedirectView(getSuccessView() + "?patientId=" + note.getPatient().getPatientId())); 72 105 } … … 94 127 // under the "commandName" tag 95 128 int patientId = ServletRequestUtils.getIntParameter(request, "patientId", 0); 96 int noteId = ServletRequestUtils.getIntParameter(request, "noteId", 0); 97 log.info("in NoteFormController: noteId: " + noteId + ", patientId: " + patientId); 129 // int noteId = ServletRequestUtils.getIntParameter(request, "noteId", 0); 130 int obsId = ServletRequestUtils.getIntParameter(request, "obsId", 0); 131 // log.info("in NoteFormController: noteId: " + noteId + ", patientId: " + patientId); 98 132 Notes note = new Notes(); 133 /* 99 134 if (noteId != 0) { 100 135 NoteService ns = ((NoteService) Context.getService(NoteService.class)); … … 107 142 } 108 143 } 144 */ 145 if(obsId != 0){ 146 Obs obs = Context.getObsService().getObs(obsId); 147 note.setPatient(Context.getPatientService().getPatient(obs.getPersonId())); 148 note.setText(obs.getValueText()); 149 note.setNoteId(obsId); 150 } else { 151 if(patientId != 0) { 152 Patient patient = new Patient(); 153 patient.setPatientId(patientId); 154 note.setPatient(patient); 155 } 156 } 157 109 158 log.info("in NoteFormController: noteId: " + note.getNoteId() + ", patientId: " + note.getPatient().getPatientId() 110 159 + ", text: " + note.getText()); 111 160 return note; 112 161 } 113 114 115 116 162 } openmrs-modules/patientnotes/branches/example/web/src/org/openmrs/module/patientnotes/web/controller/NotePortletController.java
r5175 r5425 6 6 import org.openmrs.module.patientnotes.Notes; 7 7 import org.openmrs.Patient; 8 import org.openmrs.Concept; 9 import org.openmrs.Obs; 10 import org.apache.commons.logging.Log; 11 import org.apache.commons.logging.LogFactory; 8 12 9 13 import javax.servlet.http.HttpServletRequest; … … 18 22 public class NotePortletController extends PortletController { 19 23 20 // private Log log = LogFactory.getLog(this.getClass());24 private Log log = LogFactory.getLog(NotePortletController.class); 21 25 protected void populateModel(HttpServletRequest httpServletRequest, Map<String, Object> stringObjectMap) { 22 26 27 log.debug("putting notes in model"); 23 28 Patient p = (Patient) stringObjectMap.get("patient"); 24 NoteService ns = ((NoteService) Context.getService(NoteService.class)); 29 // Concept concept = Context.getConceptService().getConcept(Integer.valueOf(1353)); 30 Concept concept = Context.getConceptService().getConceptByName("PATIENT NOTES"); 31 List<Obs> noteObs = Context.getObsService().getObservationsByPersonAndConcept(p, concept); 32 33 // NoteService ns = ((NoteService) Context.getService(NoteService.class)); 25 34 try { 26 List<Notes> noteList = ns.getNoteByPatientId(p.getPatientId());27 // stringObjectMap.put("note ", note.getText());28 stringObjectMap.put("notes", note List);35 // List<Notes> noteList = ns.getNoteByPatientId(p.getPatientId()); 36 // stringObjectMap.put("notes", noteList); 37 stringObjectMap.put("notes", noteObs); 29 38 } catch (Throwable e) { 30 39 log.debug("exception in populateModel", e);