如何在XML中单独返回每个分组?

时间:2014-01-02 21:27:33

标签: sql-server xml tsql path

我在T-SQL中开发了这个查询:

; with prov as (
select  NPI,FileCreationDate, FileCreationTime
from TN_DataFeed2
group by NPI,FileCreationDate, FileCreationTime
)

SELECT   
NPI as [NPI], 
FileCreationDate as [FileCreationDate], 
FileCreationTime as [FileCreationTime],
(

Select  
ProviderPatientNo ,
LastName as [LastName],
FirstName as [FirstName],
SSN as [SSN],
DOB as [DOB],
Gender as [Gender],
Race as [Race],
Ethnicity as [Ethnicity],

(
Select  
t_phone.ProviderPhoneAssessmentId,
t_phone.ProviderF2FAssessmentId,
CallEndDate, 
CallEndTime,
DispatchDate, 
DispatchTime, 
CallDisposition, 
DispositionOther, 
Notes,

(
select   
ProviderF2FAssessmentId,
AssessmentDate, 
[ArrivalTime] ,
ResidentialStatus AS [ResidentialStatus],
County AS [County], 
EmploymentStatus AS [EmploymentStatus], 
MaritalStatus AS [MaritalStatus], 
MilitaryStatus AS [MilitaryStatus],
NumArrests30Days AS [NumArrests30Days], 
AttendedSchoolLast3Months AS [AttendedSchoolLast3Months]

FROM #Assessments t_assess
where t_phone.ProviderPatientNo = t_assess.ProviderPatientNo
and t_assess.ProviderF2FAssessmentId is not null
FOR XML PATH('F2FAssessment'), type) AS [*]

FROM (select distinct ProviderPatientNo, ProviderPhoneAssessmentId,ProviderF2FAssessmentId,CallEndDate,CallEndTime,DispatchDate,DispatchTime, 
CallDisposition,DispositionOther,Notes from #phones where CallDisposition in (1,5,8) 
and ProviderPhoneAssessmentId = t_base.ProviderPhoneAssessmentId) t_phone
FOR XML PATH('PhoneAssessment'), type) AS [*]

FROM (select distinct ProviderPhoneAssessmentId, ProviderPatientNo,LastName,FirstName,SSN,DOB,Gender,Race,Ethnicity  from #base) t_base
FOR XML PATH('Patient'), type
)
from prov
for xml path(''), root('Provider')

返回如下数据:

  <Patient>
    <ProviderPatientNo>00200791</ProviderPatientNo>
    <LastName>Rob</LastName>
    <FirstName>Chris</FirstName>
    <SSN>7570193</SSN>
    <DOB>2005-09-21</DOB>
    <Gender>2</Gender>
    <Race>6</Race>
    <Ethnicity>2</Ethnicity>
    <PhoneAssessment>
      <ProviderPhoneAssessmentId>0A923156-A8F9-4B92-9FFE-7630B99CBE8D</ProviderPhoneAssessmentId>
      <CallEndDate>2013-09-01</CallEndDate>
      <CallEndTime>13:55:00</CallEndTime>
      <CallDisposition>8</CallDisposition>
      <F2FAssessment>
        <ProviderF2FAssessmentId>BDEC13F5-E175-4A36-A7EA-760DC0E3E786</ProviderF2FAssessmentId>
        <AssessmentDate>2014-01-02</AssessmentDate>
        <ArrivalTime>15:05:00</ArrivalTime>
        <ResidentialStatus>11</ResidentialStatus>
        <County>75</County>
        <EmploymentStatus>10</EmploymentStatus>
        <MaritalStatus>6</MaritalStatus>
        <MilitaryStatus>4</MilitaryStatus>
        <AttendedSchoolLast3Months>1</AttendedSchoolLast3Months>
      </F2FAssessment>
      <F2FAssessment>
        <ProviderF2FAssessmentId>CE0AE86F-1DE3-4B7D-A8FC-B3D07D09B495</ProviderF2FAssessmentId>
        <AssessmentDate>2014-01-02</AssessmentDate>
        <ArrivalTime>13:40:00</ArrivalTime>
        <ResidentialStatus>11</ResidentialStatus>
        <County>97</County>
        <EmploymentStatus>10</EmploymentStatus>
        <MaritalStatus>6</MaritalStatus>
        <MilitaryStatus>4</MilitaryStatus>
        <AttendedSchoolLast3Months>3</AttendedSchoolLast3Months>
      </F2FAssessment>
    </PhoneAssessment>
  </Patient>

但我希望这些数据看起来像:

  <Patient>
    <ProviderPatientNo>00200791</ProviderPatientNo>
    <LastName>Rob</LastName>
    <FirstName>Chris</FirstName>
    <SSN>7570193</SSN>
    <DOB>2005-09-21</DOB>
    <Gender>2</Gender>
    <Race>6</Race>
    <Ethnicity>2</Ethnicity>
    <PhoneAssessment>
      <ProviderPhoneAssessmentId>0A923156-A8F9-4B92-9FFE-7630B99CBE8D</ProviderPhoneAssessmentId>
      <CallEndDate>2013-09-01</CallEndDate>
      <CallEndTime>13:55:00</CallEndTime>
      <CallDisposition>8</CallDisposition>
      <F2FAssessment>
        <ProviderF2FAssessmentId>BDEC13F5-E175-4A36-A7EA-760DC0E3E786</ProviderF2FAssessmentId>
        <AssessmentDate>2014-01-02</AssessmentDate>
        <ArrivalTime>15:05:00</ArrivalTime>
        <ResidentialStatus>11</ResidentialStatus>
        <County>75</County>
        <EmploymentStatus>10</EmploymentStatus>
        <MaritalStatus>6</MaritalStatus>
        <MilitaryStatus>4</MilitaryStatus>
        <AttendedSchoolLast3Months>1</AttendedSchoolLast3Months>
      </F2FAssessment>
</PhoneAssessment>
    <PhoneAssessment>
      <ProviderPhoneAssessmentId>0A923156-A8F9-4B92-9FFE-7630B99CBE8D</ProviderPhoneAssessmentId>
      <CallEndDate>2013-09-01</CallEndDate>
      <CallEndTime>13:55:00</CallEndTime>
      <CallDisposition>8</CallDisposition>
      <F2FAssessment>
        <ProviderF2FAssessmentId>CE0AE86F-1DE3-4B7D-A8FC-B3D07D09B495</ProviderF2FAssessmentId>
        <AssessmentDate>2014-01-02</AssessmentDate>
        <ArrivalTime>13:40:00</ArrivalTime>
        <ResidentialStatus>11</ResidentialStatus>
        <County>97</County>
        <EmploymentStatus>10</EmploymentStatus>
        <MaritalStatus>6</MaritalStatus>
        <MilitaryStatus>4</MilitaryStatus>
        <AttendedSchoolLast3Months>3</AttendedSchoolLast3Months>
      </F2FAssessment>
    </PhoneAssessment>
  </Patient>

如何相应地修改SQL查询? 此外,这是来自这些临时表的数据。

select * from #Assessments where ProviderPatientNo = '00200791'
people_id   ProviderPatientNo   ProviderF2FAssessmentId ProviderPhoneAssessmentId   AssessmentDate  ArrivalTime ResidentialStatus   County  EmploymentStatus    MaritalStatus   MilitaryStatus  NumArrests30Days    AttendedSchoolLast3Months   EducationLevel  PrimaryPayorSource  SecondaryPayorSource    AnnualHouseholdIncome   NumberInHousehold   CurrentServices MHTreatmentDeclaration  MOTStatus   DurablePOA  AssessmentLocation  TransportedByLE TelevideoAssessment CurrentDetoxSymptoms    HistoryOfDetoxSymptoms  PrimaryDSMDiagnosis SecondaryDSMDiagnosis   CompletedByLastName CompletedByFirstName    DateDispositionCompleted    TimeDispositionCompleted    RecommendedTransportMode    DateTransportedToFacility   TimeTransportedToFacility   FollowupContacted   FollowupReportedServiceHelpful  ContactAttempts VoluntaryAdmissionRecommended   AdmissionAssessmentViaTelehealth    IsAdmitted  FirstHospitalization    PrimaryProblem  IntellectualDisability  MedicalInstability  MedicationIssues    PastTrauma  SubstanceAbuse  RowNumber
9E94386B-BBEE-4E47-BD80-77FA08D9CEA2    00200791    BDEC13F5-E175-4A36-A7EA-760DC0E3E786    NULL    2014-01-02  15:05:00    11  75  10  6   4   NULL    1   23  8   9   NULL    NULL    8   2   2   2   4   0   0   0   0   V71.09  V71.09  Brad    Reb 2013-09-03  11:55:19    NULL    2013-09-03  11:55:19    1   1   1   NULL    NULL    0   1   10  3   3   3   3   3   1
9E94386B-BBEE-4E47-BD80-77FA08D9CEA2    00200791    CE0AE86F-1DE3-4B7D-A8FC-B3D07D09B495    NULL    2014-01-02  13:40:00    11  97  10  6   4   NULL    3   22  8   9   NULL    NULL    8   2   2   2   12  0   0   0   0   V71.09  V71.09  Alex    Phyl    2013-09-23  20:51:13    NULL    2013-09-23  20:51:13    1   1   1   NULL    NULL    0   1   10  3   3   3   3   3   1

select * from #phones where ProviderPatientNo = '00200791'
people_id   ProviderPatientNo   ProviderPhoneAssessmentId   ProviderF2FAssessmentId CallEndDate CallEndTime DispatchDate    DispatchTime    CallDisposition DispositionOther    Notes
9E94386B-BBEE-4E47-BD80-77FA08D9CEA2    00200791    0A923156-A8F9-4B92-9FFE-7630B99CBE8D    NULL    2013-09-01  13:55:00    NULL    NULL    8   NULL    NULL
select * from #base where ProviderPatientNo = '00200791'
NPI FileCreationDate    FileCreationTime    ProviderPatientNo   ProviderF2FAssessmentId ProviderPhoneAssessmentId   people_id   LastName    FirstName   SSN DOB Gender  Race    Ethnicity
1306875695  2014-01-02  14:21:08    00200791    NULL    0A923156-A8F9-4B92-9FFE-7630B99CBE8D    9E94386B-BBEE-4E47-BD80-77FA08D9CEA2    Rob Chris   7570193 2005-09-21  2   6   2
1306875695  2014-01-02  14:21:08    00200791    BDEC13F5-E175-4A36-A7EA-760DC0E3E786    NULL    9E94386B-BBEE-4E47-BD80-77FA08D9CEA2    Rob Chris   7570193 2005-09-21  2   6   2
1306875695  2014-01-02  14:21:08    00200791    CE0AE86F-1DE3-4B7D-A8FC-B3D07D09B495    NULL    9E94386B-BBEE-4E47-BD80-77FA08D9CEA2    Rob Chris   7570193 2005-09-21  2   6   2

2 个答案:

答案 0 :(得分:1)

查看FOR XML EXPLICIT子句。它允许您定义层次结构。您只需要正确排序数据。

http://technet.microsoft.com/en-us/library/ms189068.aspx

您还可以创建一个xml架构,并将结果存储到使用此类型列定义的表中。这将确保在传输到另一个系统之前正确输入输出。

http://technet.microsoft.com/en-us/library/ms176009.aspx

无论哪种方式,在任何人可以帮助您完成具体示例之前,都需要样本表和数据。

答案 1 :(得分:0)

就像我上面所说的那样,您可以提供的信息越多越好。我在自己的时间做这项工作。

因此,我将不得不强迫人们发布示例(完整代码),如下所示。否则,我将不得不拒绝帮助。只需设置表格并添加数据就需要一个多小时。

以下是使用您提供的示例数据在tempdb中设置三个表的代码。我猜测数据类型,因为没有给出。我没有添加任何参照完整性。

-- Playing around
use tempdb
go


--
-- Table 1
--

-- Remove if it exists
if object_id('base') > 0
drop table base
go

-- Create the first table  
create table base
(
    NPI varchar(16),
    FileCreationDate date,
    FileCreationTime time,  
    ProviderPatientNo varchar(16),          
    ProviderF2FAssessmentId uniqueidentifier default null, 
    ProviderPhoneAssessmentId uniqueidentifier default null, 
    people_id uniqueidentifier default null,
    LastName varchar(64),    
    FirstName varchar(64),   
    SSN varchar(9),
    DOB date,
    Gender int,
    Race int,   
    Ethnicity int
);
go

-- Add row 1
insert into base values 
('1306875695',
'2014-01-02',
'14:21:08',
'00200791',
NULL,                   
'0A923156-A8F9-4B92-9FFE-7630B99CBE8D',
'9E94386B-BBEE-4E47-BD80-77FA08D9CEA2',
'Rob',
'Chris',   
'7570193',
'2005-09-21',
2,
6,
2);
go

-- Add row 2
insert into base values 
('1306875695',
'2014-01-02',
'14:21:08',
'00200791',
'BDEC13F5-E175-4A36-A7EA-760DC0E3E786',
NULL,
'9E94386B-BBEE-4E47-BD80-77FA08D9CEA2',
'Rob', 
'Chris',
'7570193', 
'2005-09-21',
2,
6,
2);
go

-- Add row 3
insert into base values 
('1306875695',
'2014-01-02',
'14:21:08',
'00200791',
'CE0AE86F-1DE3-4B7D-A8FC-B3D07D09B495',
NULL,
'9E94386B-BBEE-4E47-BD80-77FA08D9CEA2',
'Rob', 
'Chris',
'7570193', 
'2005-09-21',
2,
6,
2);
go

-- Show the data
select * from base 
where ProviderPatientNo = '00200791';
go


--
-- Table 2
--

-- Remove if it exists
if object_id('phones') > 0
drop table phones
go

-- Create the second table  
create table phones
(
    people_id uniqueidentifier default null,  
    ProviderPatientNo varchar(16),
    ProviderPhoneAssessmentId uniqueidentifier default null,   
    ProviderF2FAssessmentId uniqueidentifier default null, 
    CallEndDate date,
    CallEndTime time,
    DispatchDate date,   
    DispatchTime time,   
    CallDisposition int,
    DispositionOther int,   
    Notes varchar(max)
);
go

-- Add row 1
insert into phones values 
(
'9E94386B-BBEE-4E47-BD80-77FA08D9CEA2',
'00200791',    
'0A923156-A8F9-4B92-9FFE-7630B99CBE8D',   
NULL,  
'2013-09-01',  
'13:55:00',    
NULL,    
NULL,    
8,   
NULL,    
NULL
);
go

-- Show the data
select * from phones 
where ProviderPatientNo = '00200791';
go


--
-- Table 3
--

-- Remove if it exists
if object_id('assessments') > 0
drop table assessments
go

-- Create the third table  
create table assessments
(
    people_id uniqueidentifier default null,
    ProviderPatientNo varchar(16),
    ProviderF2FAssessmentId uniqueidentifier default null,
    ProviderPhoneAssessmentId uniqueidentifier default null,
    AssessmentDate date,
    ArrivalTime time ,
    ResidentialStatus int,
    County int,
    EmploymentStatus int,
    MaritalStatus int,
    MilitaryStatus int,
    NumArrests30Days int,
    AttendedSchoolLast3Months int,
    EducationLevel int,
    PrimaryPayorSource int,
    SecondaryPayorSource int,
    AnnualHouseholdIncome money,
    NumberInHousehold int,
    CurrentServices int ,
    MHTreatmentDeclaration int,
    MOTStatus int,
    DurablePOA int,
    AssessmentLocation int,
    TransportedByLE int,
    TelevideoAssessment int,
    CurrentDetoxSymptoms int,
    HistoryOfDetoxSymptoms int,
    PrimaryDSMDiagnosis varchar(8),
    SecondaryDSMDiagnosis varchar(8),
    CompletedByLastName varchar(64),
    CompletedByFirstName varchar(64),
    DateDispositionCompleted date,
    TimeDispositionCompleted time,
    RecommendedTransportMode int,
    DateTransportedToFacility date,
    TimeTransportedToFacility time,
    FollowupContacted int,
    FollowupReportedServiceHelpful int,
    ContactAttempts int,
    VoluntaryAdmissionRecommended int,
    AdmissionAssessmentViaTelehealth int,
    IsAdmitted int,
    FirstHospitalization int,
    PrimaryProblem int,
    IntellectualDisability int,
    MedicalInstability int,
    MedicationIssues int,
    PastTrauma int,
    SubstanceAbuse int,
    RowNumber int
);


-- Add row 1
insert into assessments values 
(
'9E94386B-BBEE-4E47-BD80-77FA08D9CEA2',
'00200791',
'BDEC13F5-E175-4A36-A7EA-760DC0E3E786',
NULL,
'2014-01-02',
'15:05:00',
11,
75,
10,
6,
4,
NULL,
1,
23,
8,
9,
NULL,
NULL,
8,
2,
2,
2,
4,
0,
0,
0,
0,
'V71.09',
'V71.09',
'Brad',
'Reb',
'2013-09-03',
'11:55:19',
NULL,
'2013-09-03',
'11:55:19',
1,
1,
1,
NULL,
NULL,
0,
1,
10,
3,
3,
3,
3,
3,
1);
go

-- Add row 2
insert into assessments values 
('9E94386B-BBEE-4E47-BD80-77FA08D9CEA2',
'00200791',
'CE0AE86F-1DE3-4B7D-A8FC-B3D07D09B495',
NULL,
'2014-01-02',
'13:40:00',
11,
97,
10,
6,
4,
NULL,
3,
22,
8,
9,
NULL,
NULL,
8,
2,
2,
2,
12,
0,
0,
0,
0,
'V71.09',
'V71.09',
'Alex',
'Phyl',
'2013-09-23',
'20:51:13',
NULL,
'2013-09-23',
'20:51:13',
1,
1,
1,
NULL,
NULL,
0,
1,
10,
3,
3,
3,
3,
3 ,
1);
go

-- Show the data
select * from assessments 
where ProviderPatientNo = '00200791';
go

好的,现在我们有数据,我们可以谈谈解决方案。以下是一些观察结果。

1 - 您希望将患者总记录数减少到1个。

2 - 您希望拥有与评估相同数量的电话记录。因此,我们需要添加(复制)一些数据。

3 - 您希望一条评估记录在一条电话记录中。

同样,该解决方案适用于XML Explicit。

http://technet.microsoft.com/en-us/library/ms189068.aspx

我选择使用@ProviderPatientNo参数执行此操作。如果您想要整个表,请更改下面代码中FROM子句中的选择以连接回基表。

解决方案如下:

--
-- Explicit = supports simple hierarchies
--

  -- Dump for a particular id
  DECLARE @ProviderPatientNo varchar(16) = '00200791';

  -- Define elemenents @ level 1
  SELECT
      1 AS Tag,
      NULL as Parent,
      NULL as 'Patients!1!element',

      NULL as 'Patient!2!sort!hide',
      NULL as 'Patient!2!ProviderPatientNo!Element',
      NULL as 'Patient!2!LastName!Element',
      NULL as 'Patient!2!FirstName!Element',
      NULL as 'Patient!2!SSN!Element',
      NULL as 'Patient!2!DOB!Element',
      NULL as 'Patient!2!Gender!Element',
      NULL as 'Patient!2!Race!Element',   
      NULL as 'Patient!2!Ethnicity!Element',

      NULL as 'PhoneAssessment!3!ProviderPhoneAssessmentId!Element',
      NULL as 'PhoneAssessment!3!ProviderF2FAssessmentId!Element',
      NULL as 'PhoneAssessment!3!CallEndDate!Element',
      NULL as 'PhoneAssessment!3!CallEndTime!Element',
      NULL as 'PhoneAssessment!3!DispatchDate!Element',
      NULL as 'PhoneAssessment!3!DispatchTime!Element',
      NULL as 'PhoneAssessment!3!CallDisposition!Element',
      NULL as 'PhoneAssessment!3!DispositionOther!Element',
      NULL as 'PhoneAssessment!3!Notes!Element',

      NULL as 'F2FAssessment!4!ProviderF2FAssessmentId!Element',
      NULL as 'F2FAssessment!4!AssessmentDate!Element',
      NULL as 'F2FAssessment!4!ArrivalTime!Element',
      NULL as 'F2FAssessment!4!ResidentialStatus!Element',
      NULL as 'F2FAssessment!4!County!Element',
      NULL as 'F2FAssessment!4!EmploymentStatus!Element',
      NULL as 'F2FAssessment!4!MaritalStatus!Element',
      NULL as 'F2FAssessment!4!MilitaryStatus!Element',
      NULL as 'F2FAssessment!4!NumArrests30Days!Element',
      NULL as 'F2FAssessment!4!AttendedSchoolLast3Months!Element'

  UNION ALL

  -- Patient info @ level 2
  SELECT DISTINCT
      2 as Tag,
      1 as Parent,
      NULL,

      b.ProviderPatientNo + '000' as sort,
      ProviderPatientNo,
      LastName,
      FirstName,
      SSN,
      DOB,
      Gender,
      Race,
      Ethnicity,

      NULL,
      NULL,
      NULL,
      NULL,
      NULL,
      NULL,
      NULL,
      NULL, 
      NULL,

      NULL,
      NULL,
      NULL,
      NULL,
      NULL,
      NULL,
      NULL,
      NULL,
      NULL,
      NULL
  FROM base b
  WHERE b.ProviderPatientNo = @ProviderPatientNo

  UNION ALL

  -- Phone assement info @ level 3
  SELECT  
      3 as Tag,
      2 as Parent,
      NULL,

      p.ProviderPatientNo + REPLACE( STR( ROW_NUMBER() over (order by (select 0)), 3, 0), ' ', '0') as sort,
      NULL,
      NULL,
      NULL,
      NULL,
      NULL,
      NULL,
      NULL,
      NULL,

      p.ProviderPhoneAssessmentId,
      p.ProviderF2FAssessmentId,
      p.CallEndDate, 
      p.CallEndTime,
      p.DispatchDate, 
      p.DispatchTime, 
      p.CallDisposition, 
      p.DispositionOther, 
      p.Notes,

      NULL,
      NULL,
      NULL,
      NULL,
      NULL,
      NULL,
      NULL,
      NULL,
      NULL,
      NULL
  FROM phones p join assessments a 
  ON p.people_id = a.people_id  
  WHERE 
      p.CallDisposition in (1,5,8) and
      p.ProviderPatientNo = @ProviderPatientNo

  UNION ALL

  -- Provider assement info @ level 4
  SELECT  
      4 as Tag,
      3 as Parent,
      NULL,

      a.ProviderPatientNo + REPLACE( STR( ROW_NUMBER() over (order by (select 0)), 3, 0), ' ', '0') as sort,
      NULL,
      NULL,
      NULL,
      NULL,
      NULL,
      NULL,
      NULL,
      NULL,

      NULL,
      NULL,
      NULL,
      NULL,
      NULL,
      NULL,
      NULL,
      NULL,
      NULL, 

      a.ProviderF2FAssessmentId,
      a.AssessmentDate, 
      a.ArrivalTime,
      a.ResidentialStatus,
      a.County, 
      a.EmploymentStatus, 
      a.MaritalStatus, 
      a.MilitaryStatus,
      a.NumArrests30Days, 
      a.AttendedSchoolLast3Months
  FROM assessments a join phones p  
  ON a.people_id = p.people_id
  WHERE 
      a.ProviderF2FAssessmentId is not null and
      p.ProviderPatientNo = @ProviderPatientNo

  ORDER BY 'Patient!2!sort!hide' , Tag
  FOR XML EXPLICIT;

要回顾一下解决方案,您必须在每个级别的数据中的第一个select和union中定义结构。

我添加了一个隐藏的排序列来排序数据,这是解决方案的关键。根据患者ID和行号,因为在扩展到2条记录和2条评估记录的电话记录之间没有整理。

例如,如级别为4,在除了级别4的元素之外的所有数据中放置空值。需要提供标签和父级。

最后但并非最不重要的是,使用FOR XML EXPLICIT将列标题,数据和结构转换为XML。

正如您所看到的,这需要设置很多工作,但会返回请求的结果。

<Patients>
  <Patient>
    <ProviderPatientNo>00200791</ProviderPatientNo>
    <LastName>Rob</LastName>
    <FirstName>Chris</FirstName>
    <SSN>7570193</SSN>
    <DOB>2005-09-21</DOB>
    <Gender>2</Gender>
    <Race>6</Race>
    <Ethnicity>2</Ethnicity>
    <PhoneAssessment>
      <ProviderPhoneAssessmentId>0A923156-A8F9-4B92-9FFE-7630B99CBE8D</ProviderPhoneAssessmentId>
      <CallEndDate>2013-09-01</CallEndDate>
      <CallEndTime>13:55:00</CallEndTime>
      <CallDisposition>8</CallDisposition>
      <F2FAssessment>
        <ProviderF2FAssessmentId>BDEC13F5-E175-4A36-A7EA-760DC0E3E786</ProviderF2FAssessmentId>
        <AssessmentDate>2014-01-02</AssessmentDate>
        <ArrivalTime>15:05:00</ArrivalTime>
        <ResidentialStatus>11</ResidentialStatus>
        <County>75</County>
        <EmploymentStatus>10</EmploymentStatus>
        <MaritalStatus>6</MaritalStatus>
        <MilitaryStatus>4</MilitaryStatus>
        <AttendedSchoolLast3Months>1</AttendedSchoolLast3Months>
      </F2FAssessment>
    </PhoneAssessment>
    <PhoneAssessment>
      <ProviderPhoneAssessmentId>0A923156-A8F9-4B92-9FFE-7630B99CBE8D</ProviderPhoneAssessmentId>
      <CallEndDate>2013-09-01</CallEndDate>
      <CallEndTime>13:55:00</CallEndTime>
      <CallDisposition>8</CallDisposition>
      <F2FAssessment>
        <ProviderF2FAssessmentId>CE0AE86F-1DE3-4B7D-A8FC-B3D07D09B495</ProviderF2FAssessmentId>
        <AssessmentDate>2014-01-02</AssessmentDate>
        <ArrivalTime>13:40:00</ArrivalTime>
        <ResidentialStatus>11</ResidentialStatus>
        <County>97</County>
        <EmploymentStatus>10</EmploymentStatus>
        <MaritalStatus>6</MaritalStatus>
        <MilitaryStatus>4</MilitaryStatus>
        <AttendedSchoolLast3Months>3</AttendedSchoolLast3Months>
      </F2FAssessment>
    </PhoneAssessment>
  </Patient>
</Patients>