Produced by Araxis Merge on 11/16/2017 4:02:22 PM Eastern Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | CUI-CPP-v2.3.1-release.zip\app\controllers\vista | veterans_controller.rb | Fri Oct 20 20:13:45 2017 UTC |
| 2 | CUI-CPP-v2.3.1-release.zip\app\controllers\vista | veterans_controller.rb | Thu Nov 16 17:30:12 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 316 |
| Changed | 1 | 6 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | class Vist a::Veteran sControlle r < Applic ationContr oller | |
| 2 | ||
| 3 | ||
| 4 | ||
| 5 | # Method triggered by the a Search sub mit from t he user | |
| 6 | def sear ch | |
| 7 | if par ams[:commi t].present ? | |
| 8 | if p arams[:com mit] == "S earch" | |
| 9 | if params[:l ast_name]. blank? && params[:fi rst_name]. blank? && params[:ve teran_birt h_date].bl ank? && pa rams[:ssn] .blank? | |
| 10 | flash.now[ :alert] = "Please fi ll in at l east one f ield in or der to sea rch" | |
| 11 | el sif cookie = authent ication_re quest | |
| 12 | results = search_req uest(param s[:last_na me], param s[:first_n ame], para ms[:vetera n_birth_da te], param s[:ssn], c ookie) | |
| 13 | if results .code == 2 00 | |
| 14 | @veteran s = eval(r esults.bod y)[:data][ :items] | |
| 15 | @veteran s.count < 1 ? flash. now[:alert ] = "No ma tching Vet erans were found." : flash.now [:notice] = "The fol lowing res ults for V eterans we re found:" | |
| 16 | else | |
| 17 | flash.no w[:alert] = eval(res ults.body) [:message] | |
| 18 | end | |
| 19 | el se | |
| 20 | flash.now[ :alert] = "Unable to obtain au thenticati on for req uest " | |
| 21 | en d | |
| 22 | end | |
| 23 | end | |
| 24 | end | |
| 25 | ||
| 26 | ||
| 27 | def sele cted | |
| 28 | if par ams.try(:[ ], :commit ) == "Subm it" | |
| 29 | @vet erans = [] | |
| 30 | para ms[:select ].each do |s| | |
| 31 | ve t = {} | |
| 32 | fi elds = s[0 ].split(", ") | |
| 33 | ve t[:fullNam e] = field s[0] | |
| 34 | ve t[:age] = fields[1] | |
| 35 | ve t[:genderN ame] = fie lds[2] | |
| 36 | ve t[:birthDa te] = fiel ds[3] | |
| 37 | ve t[:ssn] = fields[4] | |
| 38 | ve t[:city] = fields[5] | |
| 39 | ve t[:state] = fields[6 ] | |
| 40 | ve t[:zip] = fields[7] | |
| 41 | @v eterans << vet | |
| 42 | fl ash.now[:n otice] = " You have s elected th e followin g Veteran( s) " | |
| 43 | end | |
| 44 | elsif params.try (:[], :com mit) == "A dd" | |
| 45 | @vet erans = [] | |
| 46 | vet = {} | |
| 47 | vet[ :fullName] = params[ :first_nam e] + " " + params[:l ast_name] | |
| 48 | vet[ :birthDate ] = params [:veteran_ birth_date ] | |
| 49 | vet[ :ssn] = pa rams[:ssn] | |
| 50 | vet[ :city] = p arams[:cit y] | |
| 51 | vet[ :state] = params[:st ate] | |
| 52 | vet[ :zip] = pa rams[:zip] | |
| 53 | @vet erans << v et | |
| 54 | flas h.now[:not ice] = "Yo u have suc cessfully added the following Veteran " | |
| 55 | end | |
| 56 | end | |
| 57 | ||
| 58 | ||
| 59 | def add | |
| 60 | if par ams[:commi t].present ? | |
| 61 | proc eed = true | |
| 62 | para ms[:first_ name].blan k? ? (@fna me_blank = true; pro ceed=false ) : false | |
| 63 | para ms[:last_n ame].blank ? ? (@lnam e_blank = true; proc eed=false) : false | |
| 64 | para ms[:ssn].b lank? ? (@ ssn_blank = true; pr oceed=fals e) : false | |
| 65 | para ms[:vetera n_birth_da te].blank? ? (@veter an_birth_d ate_blank = true; pr oceed=fals e) : false | |
| 66 | para ms[:email] .blank? ? (@email_bl ank = true ; proceed= false) : f alse | |
| 67 | para ms[:phone_ number].bl ank? ? (@p hone_numbe r_blank = true; proc eed=false) : false | |
| 68 | para ms[:city]. blank? ? ( @city_blan k = true; proceed=fa lse) : fal se | |
| 69 | para ms[:state] .blank? ? (@state_bl ank = true ; proceed= false) : f alse | |
| 70 | para ms[:zip].b lank? ? (@ zip_blank = true; pr oceed=fals e) : false | |
| 71 | ||
| 72 | if p roceed == false | |
| 73 | fl ash.now[:a lert] = "P lease fill in the re quired fie lds below: " | |
| 74 | elsi f cookie = authentic ation_requ est | |
| 75 | re sponse = a dd_veteran (params[:l ast_name], params[:f irst_name] , params[: ssn], para ms[:vetera n_birth_da te], param s[:email], params[:p hone_numbe r], params [:city], p arams[:sta te], param s[:zip], c ookie) | |
| 76 | if response[ :code] == 200 | |
| 77 | redirect_t o :action => :select ed, :param s => reque st.request _parameter s | |
| 78 | el se | |
| 79 | flash.now[ :alert] = "Unable to add Veter an. Please check tha t all requ ired infor mation has been subm itted." | |
| 80 | en d | |
| 81 | else | |
| 82 | fl ash.now[:a lert] = "U nable to o btain auth entication for reque st " | |
| 83 | end | |
| 84 | end | |
| 85 | end | |
| 86 | ||
| 87 | ||
| 88 | ||
| 89 | private | |
| 90 | ||
| 91 | # Get authorizat ion from V istA. Must be obtain ed to esta blish a se ssion for further co mmunicatio n with Vis tA. | |
| 92 | def au thenticati on_request | |
| 93 | url = "https:/ /ehmp.vaft l.us/resou rce/authen tication" | |
| 94 | requ est = HTTP I::Request .new(url) | |
| 95 | requ est.auth.s sl.verify_ mode = :no ne | |
| 96 | requ est.header s["Content -Type"] = "applicati on/json" | |
| 97 | requ est.header s["Cache-C ontrol"] = "no-cache " | |
| 98 | requ est.body = | |
| 99 | '{ | |
| 100 | "accessCod e": " AI ", | |
| 101 | "verifyCod e": " AI !!", | |
| 102 | "site": " VsID " | |
| 103 | }' | |
| 104 | resp onse = HTT PI.post(re quest) | |
| 105 | puts response. body | |
| 106 | cook ie = respo nse.header s['set-coo kie'] | |
| 107 | resp onse.code == 200 ? c ookie : fa lse | |
| 108 | end | |
| 109 | ||
| 110 | ||
| 111 | # Send search re quest to V istA. | |
| 112 | def se arch_reque st(lname, fname, ssn , bdate, c ookie) | |
| 113 | puts "\n-- IN SEARCH_REQ UEST -- \n " | |
| 114 | url = "https:/ /ehmp.vaft l.us/resou rce/patien t-search/g lobal?name .last=&nam e.first=&s sn=&date.b irth=" | |
| 115 | requ est = HTTP I::Request .new(url) | |
| 116 | requ est.auth.s sl.verify_ mode = :no ne | |
| 117 | requ est.header s["Content -Type"] = "applicati on/json" | |
| 118 | requ est.header s["Cookie" ] = cookie | |
| 119 | body _string = '{' | |
| 120 | !lna me.blank? ? body_str ing += '"n ame.last": "'+lname+ '", ' : fa lse | |
| 121 | !fna me.blank? ? body_str ing += '"n ame.first" : "'+fname +'", ' : f alse | |
| 122 | !ssn .blank? ? body_strin g += '"ssn ": "'+ssn+ '", ' : fa lse | |
| 123 | !bda te.blank? ? body_str ing += '"d ate.birth" : "'+bdate +'", ' : f alse | |
| 124 | body _string.le ngth > 5 ? body_stri ng.chomp!( ", ") : fa lse | |
| 125 | body _string += '}' | |
| 126 | requ est.body = body_stri ng | |
| 127 | resp onse = HTT PI.post(re quest) | |
| 128 | puts response. body | |
| 129 | retu rn respons e | |
| 130 | end | |
| 131 | ||
| 132 | ||
| 133 | def ad d_veteran( lname, fna me, ssn, b date, emai l, phone_n umber, cit y, state, zip, cooki e) | |
| 134 | puts "\n-- IN ADD_VETERA N -- \n" | |
| 135 | url = "https:/ /ehmp.vaft l.us/resou rce/patien t-search/g lobal?name .last=&nam e.first=&s sn=&date.b irth=" | |
| 136 | requ est = HTTP I::Request .new(url) | |
| 137 | requ est.auth.s sl.verify_ mode = :no ne | |
| 138 | requ est.header s["Content -Type"] = "applicati on/json" | |
| 139 | requ est.header s["Cookie" ] = cookie | |
| 140 | body _string = '{' | |
| 141 | !lna me.blank? ? body_str ing += '"n ame.last": "'+lname+ '", ' : fa lse | |
| 142 | !fna me.blank? ? body_str ing += '"n ame.first" : "'+fname +'", ' : f alse | |
| 143 | !ssn .blank? ? body_strin g += '"ssn ": "'+ssn+ '", ' : fa lse | |
| 144 | !bda te.blank? ? body_str ing += '"d ate.birth" : "'+bdate +'", ' : f alse | |
| 145 | !ema il.blank? ? body_str ing += '"e mail": "'+ email+'", ' : false | |
| 146 | !pho ne_number. blank? ? b ody_string += '"phon e.number": "'+phone_ number+'", ' : false | |
| 147 | !cit y.blank? ? body_stri ng += '"ci ty": "'+ci ty+'", ' : false | |
| 148 | !sta te.blank? ? body_str ing += '"s tate": "'+ state+'", ' : false | |
| 149 | !zip .blank? ? body_strin g += '"zip ": "'+zip+ '", ' : fa lse | |
| 150 | ||
| 151 | body _string.le ngth > 5 ? body_stri ng.chomp!( ", ") : fa lse | |
| 152 | body _string += '}' | |
| 153 | requ est.body = body_stri ng | |
| 154 | # res ponse = HT TPI.post(r equest) | |
| 155 | resp onse = {} | |
| 156 | resp onse[:code ] = 200 | |
| 157 | # put s response .body | |
| 158 | retu rn respons e | |
| 159 | end | |
| 160 | ||
| 161 | end |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.