(<pid> not found, generate [max+1])
If the <patient_id> source / value pair has not been added to the mapping table, a new PATIENT_NUM with value max(patient_num)+1 should be generated and all the PATIENT_NUMs for this patient will receive this value. The new patient number must also be added to the PATIENT_DIMENSION table.
Example:
New <patient_id> source / value pair = 'EMPI' / 1000000
Select max(patient_num) from patient_mapping = 527
New patient_num = max(patient_num) + 1 = 528
<span style="color: #0000ff"><</span><span style="color: #a31515">pid</span><span style="color: #0000ff">></span>
<span style="color: #0000ff"><</span><span style="color: #a31515">patient_id</span> <span style="color: #ff0000">source</span>="<span style="color: #0000ff">EMPI</span>"<span style="color: #0000ff">></span>1000000<span style="color: #0000ff"></</span><span style="color: #a31515">patient_id</span><span style="color: #0000ff">></span>
<span style="color: #0000ff"><</span><span style="color: #a31515">patient_map_id</span> <span style="color: #ff0000">source</span>="<span style="color: #0000ff">MGH</span>"<span style="color: #0000ff">></span>123<span style="color: #0000ff"></</span><span style="color: #a31515">patient_map_id</span><span style="color: #0000ff">></span>
<span style="color: #0000ff"><</span><span style="color: #a31515">patient_map_id</span> <span style="color: #ff0000">source</span>="<span style="color: #0000ff">BWH</span>"<span style="color: #0000ff">></span>777<span style="color: #0000ff"></</span><span style="color: #a31515">patient_map_id</span><span style="color: #0000ff">></span>
<span style="color: #0000ff"></</span><span style="color: #a31515">pid</span><span style="color: #0000ff">></span>
The rows in the PATIENT_MAPPING table will appear as follows:
PATIENT_IDE |
PATIENT_IDE_SOURCE |
PATIENT_NUM |
PATIENT_IDE_STATUS |
1000000 |
EMPI |
528 |
A |
123 |
MGH |
528 |
A |
777 |
BWH |
528 |
A |
528 |
HIVE |
528 |
A |