Examples of HealthRecord


Examples of com.krminc.phr.domain.HealthRecord

        byte[] image = null;
        final String staticDirectory = "./static/images/avatars/";
        final String maleAvatar = "default_avatar_male_126x126.jpg";
        final String femaleAvatar = "default_avatar_female_126x126.jpg";
        User user = null;
        HealthRecord hr = null;

       //logger.error("Attempting to serve user image!");

        try {
            persistenceSvc.beginTx();
            hr = getEntity();
            user = hr.getUser();
            image = user.getUserImage();
        } finally {
            persistenceSvc.close();
        }

        if (image != null && image.length > 0) {
            return Response.ok(image, "image/jpeg").build();
        } else {
            try {
            URI location = null;
            if (user != null) {
                if (hr.getGender().equalsIgnoreCase("F")) {
                    location = new URI(staticDirectory + femaleAvatar);
                } else {
                    location = new URI(staticDirectory + maleAvatar);
                }
            }
View Full Code Here

Examples of com.krminc.phr.domain.HealthRecord

    @Path("info/")
    @GET
    @Produces({ MediaType.APPLICATION_JSON })
    public JSONObject getPatientInfo() {

        HealthRecord hr = null;
        JSONObject jSONObject = new JSONObject();

        PersistenceService persistenceSvc = PersistenceService.getInstance();
        try {
            persistenceSvc.beginTx();
            hr = getEntity();
            jSONObject.put("name", hr.getUser().getFullName());
            jSONObject.put("gender", hr.getFullGender());
            jSONObject.put("age", hr.getAge());
        } catch (JSONException ex) {
        } finally {
            PersistenceService.getInstance().close();
        }
View Full Code Here

Examples of com.krminc.phr.domain.HealthRecord

    @Path("profile/")
    @GET
    @Produces({ MediaType.APPLICATION_JSON })
    public JSONObject getPatientProfile() {

        HealthRecord hr = null;
        User usr = null;
        Address adrs = null;
        JSONObject jSONObject = new JSONObject();

        PersistenceService persistenceSvc = PersistenceService.getInstance();
        try {
            persistenceSvc.beginTx();
            hr = getEntity();
            usr =  hr.getUser();
            adrs = usr.getAddresses().get(0);
            jSONObject.put("firstName",usr.getFirstName());
            jSONObject.put("middleName", usr.getMiddleName());
            jSONObject.put("lastName", usr.getLastName());
            jSONObject.put("gender", hr.getFullGender());
            jSONObject.put("dateOfBirth", hr.getDateOfBirthString());
            jSONObject.put("maritalStatus", hr.getMaritalStatus());
            jSONObject.put("email", usr.getEmail());
            jSONObject.put("faxNum", usr.getFaxnum());
            jSONObject.put("telnumHome", usr.getTelnumHome());
            jSONObject.put("telnumMobile", usr.getTelnumMobile());
            jSONObject.put("telnumWork", usr.getTelnumWork());
View Full Code Here

Examples of com.krminc.phr.domain.HealthRecord

    @Path("account/")
    @GET
    @Produces({ MediaType.APPLICATION_JSON })
    public JSONObject getUserAccount() {

        HealthRecord hr = null;
        User usr = null;
        JSONObject jSONObject = new JSONObject();

        PersistenceService persistenceSvc = PersistenceService.getInstance();
        try {
            persistenceSvc.beginTx();
            hr = getEntity();
            usr =  hr.getUser();
            //username, last login, number of logins, preferred name, date account created, and email address
            jSONObject.put("username",usr.getUsername());
            jSONObject.put("lastLogin", usr.getLastLogin());
            jSONObject.put("numLogins", usr.getTotalLogin());
            jSONObject.put("preferredName", usr.getPreferredName());
View Full Code Here

Examples of com.krminc.phr.domain.HealthRecord

    @Path("preferences/")
    @GET
    @Produces({ MediaType.APPLICATION_JSON })
    public JSONObject getPreferences() {

        HealthRecord hr = null;
        JSONObject jSONObject = new JSONObject();

        PersistenceService persistenceSvc = PersistenceService.getInstance();
        try {
            persistenceSvc.beginTx();
            hr = getEntity();
            UserPreferences pref = hr.getPreferences();
            String careNotebookString = "";
            if (pref != null) {
                careNotebookString = pref.getShowCarenotebookString();
            }
            jSONObject.put("careNotebook", careNotebookString);
View Full Code Here

Examples of com.krminc.phr.domain.HealthRecord

    @Path("access/")
    @GET
    @Produces({ MediaType.APPLICATION_JSON })
    public JSONObject getUsersWithAccess() {

        HealthRecord hr = null;
        JSONObject jSONObject = new JSONObject();

        PersistenceService persistenceSvc = PersistenceService.getInstance();
        try {
            persistenceSvc.beginTx();
            hr = getEntity();
            List<String> names = new ArrayList<String>();
            List<String> emails = new ArrayList<String>();
            List<String> phones = new ArrayList<String>();
            List<String> faxes = new ArrayList<String>();
            List<Long> ids = new ArrayList<Long>();
            List<User> users = hr.getUserList();
            for (User u : users) {
                if (u.getUserId() != getAuthenticatedUser().getUserId()) { //keep self out of access list
                    ids.add(u.getUserId());
                    names.add(u.getFullName());
                    emails.add(u.getEmail());
View Full Code Here

Examples of com.krminc.phr.domain.HealthRecord

    @Produces({ MediaType.APPLICATION_JSON })
    public JSONObject removeAccess(
            @PathParam("userId") Long userId
            ) {

        HealthRecord localHR = getEntity();
        Long healthRecordIdToRemove = localHR.getHealthRecordId();

        JSONObject jsonResult = new JSONObject();
        Boolean returnType = false;

        if (healthRecordIdToRemove != null)
        {

            PersistenceService persistenceSvc = PersistenceService.getInstance();

            try {
                if (! securityContext.isUserInRole(UserConfig.ROLE_PATIENT)) throw new Exception("Not in patient role for removing access");
               
                EntityManager em = PersistenceService.getInstance().getEntityManager();
                User userToDisallow = null;
                User removingUser = null;

                try {
                    persistenceSvc.beginTx();

                    //get user
                     userToDisallow = getUserById(userId);
                     removingUser = getAuthenticatedUser();

                     //TODO check we are owner of HR
                     //if HR owner == removingUser

                     //find the correct hr
                     List<HealthRecord> healthRecords = userToDisallow.getHealthRecords();
                     boolean shouldRemove = false;
                     HealthRecord toRemove = null;

                    //make sure we aren't removing ourself
                    if (removingUser.getUserId().compareTo(userId) == 0) {
                        shouldRemove = false;
                        logger.debug("Preventing self-removal attempt id1 {} id2 {}", userToDisallow.getUserId(), userId);
View Full Code Here

Examples of com.krminc.phr.domain.HealthRecord

                        User.class,
                        new Long(approvedRequest.getUserIdRequestor())
                    );
               
                //find the hrid we want to give access to
                HealthRecord approvedRecord = em.find(
                        HealthRecord.class,
                        new Long(approvedRequest.getRecIdRequested())
                    );

                //add the healthrecord to user object
View Full Code Here

Examples of com.krminc.phr.domain.HealthRecord

     * @param newEntity the entity containing the new data
     * @return the updated entity
     */
    protected Pain updateEntity(Pain entity, Pain newEntity) {
        EntityManager em = PersistenceService.getInstance().getEntityManager();
        HealthRecord hr = entity.getHealthRecord();
        HealthRecord hrNew = newEntity.getHealthRecord();
        entity = em.merge(newEntity);
        return entity;
    }
View Full Code Here

Examples of com.krminc.phr.domain.HealthRecord

     * @param newEntity the entity containing the new data
     * @return the updated entity
     */
    protected PeakFlow updateEntity(PeakFlow entity, PeakFlow newEntity) {
        EntityManager em = PersistenceService.getInstance().getEntityManager();
        HealthRecord hr = entity.getHealthRecord();
        HealthRecord hrNew = newEntity.getHealthRecord();
        entity = em.merge(newEntity);
        return entity;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.