Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 435
  • Last Modified:

Generating ID and GUID

I have defined a PatientInfo table with following fields

PatientGUID      uniqueidentifier  not NULL
PatientID           bigint                 not NULL
LastName          Varchar(50)       not NULL
FirstName          Varchar(50)       not NULL
MiddleName       Varchar(50)
Gender              SmallInt             not NULL
VoterID              Varchar(50)
PAN                    Varchar(50)
DLNo                  Varchar(50)

PatientID can be a incrementing number starting from 1 while PatientGUID has to be generated in such a way that no two patient records have same GUID even on different installations - may be adding NIC MAC address or something.

What is the best way to generate these IDs?
0
sunnycoder
Asked:
sunnycoder
  • 4
  • 2
2 Solutions
 
rionrocCommented:
Hello

The best way to generate GUID is the finger print template.
But in your case, since there is no device attach with your program, you can use the ( PATIENT ID + LastName + Firstname  + Middle Name + Gender + Voter ID)

eq.
Patiend id: 234
Lastname: Roc
FirstName: Rob
MiddleName: Tab
Gender: Male
Voter id: 125

Bring out the first letter or number:
Result is:
Patient GUID: 2RRTM1

Or you can add some digits for long trusted Globally Unique Identifier.


Great is our GOD.
:)
0
 
rionrocCommented:
Oh!

You can add also the date like:
Patient GUID: 2RRTM1-OC0812
OC is for month october
08 is for year 2008
12 is for day 12

You can also add the time.
Patient GUID: 2RRTM1-OC0812-141505
14 is for the hours
15 is for the minutes
05 is for the seconds

I don't think there will be an identical GUID for that system.
And also it is an autogerated GUID if you apply that.


Great is our GOD.
:)
0
 
sunnycoderAuthor Commented:
VoterID is not a mandatory field - that increases the chance of a clash. Wondering if same patient registered at two different installation should have the same patientGUID. If yes then system specific GUID might be a bad ... hmm I need to give this a second thought.
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
rionrocCommented:
Hello

>>VoterID is not a mandatory field.
Well don't include the Voters ID in our GUID system.

>>Wondering if same patient registered at two different installation should have the same patientGUID.
It's not bad at all, our guid system has a date and time value, so it will never have an identical id.


Great is our GOD.
:)
0
 
TechTiger007Commented:
For creating PatientID you can create a "Sequence" in your database
http://www.ss64.com/ora/sequence_c.html.
In your code you will have to call SequenceName.NextVal, the value will be auto incremented by your database so you wont have to worry about creating/incrementing it

For creating a GUID you can use .NET's built in GUID class
GUID.NewGUID() will give you a globally unique identifier which uses NIC, current time, etc to create an unique identifier every time

Hope that helps
0
 
rionrocCommented:
Hello TechTiger007


Thanks for that answer, it gives direction to my comments for sunnycoder.



Great is our GOD.
:)
0
 
sunnycoderAuthor Commented:
Thank you
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now