MSH-6 will have the abbrev name of the home location of care for the patient. If you want the document location you need to do a DB query to get that information. The same goes for the provider name as only the login is put in the pv1-7.1 segment.
Here is some sample queries for the Document location of care
EMR 9.5 – 9.8 or oracle databases
result = qie.doQuery(channelCache.getValue('dbName'),
"SELECT abbrevname\n" +
" FROM (((document d LEFT JOIN obs r ON d.sdid = r.sdid)\n" +
" LEFT JOIN obshead o ON r.hdid = o.hdid)\n" +
" LEFT JOIN locreg l ON d.locofcare = l.locid)\n" +
" LEFT JOIN person p ON r.PID = p.pid\n" +
" WHERE p.patientid = '{PID-3}'\n" +
" and o.mlcode = '{OBX[1]-3.1}'\n" +
" and r.obsdate = to_date('{OBX[1]-14}', 'yyyymmddHH24MISS')");
CPS 10, 11, 12 or Microsoft SQL Server databases
result = qie.doQuery(channelCache.getValue('dbName'),
"SELECT abbrevname\n" +
" FROM (((document d LEFT JOIN obs r ON d.sdid = r.sdid)\n" +
" LEFT JOIN obshead o ON r.hdid = o.hdid)\n" +
" LEFT JOIN locreg l ON d.locofcare = l.locid)\n" +
" LEFT JOIN PatientProfile p ON r.PID = p.pid\n" +
" WHERE p.patientid = '{PID-3}'\n" +
" and o.mlcode = '{OBX[1]-3.1}'\n" +
" and r.obsdate = '" + obsDate + "'");
SQL for the provider:
var mdNameResult = qie.doQuery(dbName,
"select LoginName, LastName, FirstName from USR\n" +
" where loginname = '{PV1-7.1}'");
You can then use the .getNode('field') to retrieve the values.
Example:
Var firstName = mdNameResult.getNode('FirstName');