Import a list of patient

Hi i would like to import a list of patients, the import will automatically register the patient based on the day supplied. Please is there a way to make it? Need help

Thank you.

Hi Jessica,
Could you give more details on what do you want to do? Is it related to appointments?

@Marco_Meza thank you, i have a list person that i do not want to register one by one. I would like to import that list in order to register them automatically. If i upload that list in CSV format for example i do not know which format openemr use, when i upload the file it should migrate that list in the system.

Hi Jessica-
This is a common project for OpenEMR devs and several posts have been made here to the forum on that topic. This link will show the results of a search on ‘import patient list’ so you can read all about that.
https://community.open-emr.org/search?q=import%20patient%20list

But the short answer is that you cannot simply ‘import a list’ into OpenEMR. A complete patient record contains data that is stored in several different places in the database and you need to get all the different parts interrelated correctly.

One method of importing patients requires a developer or a database- competent IT person to add the list in a SQL file to the OpenEMR database. Records can also be imported using the CareCoordination Module (look for posts talking about CCD or CCDA) but the input data file would need to be in the correct HL7 format, so you’d need to get the patient list from somebody who could generate the HL7 file.

BUT- this project has been performed by many people and the information how to do it is out there. Happy reading!

  • Harley

Jessica,

It looks as it is needed a custom template and custom sql query to insert patient data in bulk. If you need help with SQL (database language), you can ask here for help.

I’ve been “kicking the tires” on OpenEMR to see if it could replace the EMR system that I use for my optometry practice. That system has a feature where I can generate custom reports, which I’ve used to give me a comma delimited file with the patient demographics. I have been lurking on the forums, and as yet I have NOT found an example scripts, etc.

In any event, here is the SQL that I used to import such a file of patient demographics. This could be a STARTING POINT for others to do the same thing. In my case, if I end up using OpenEMR for my practice, this would be a ONE-TIME loading of all my patient information, so that we would not have to re-key all that information (it would also allow us to maintian “how long” we’ve been caring for each patient, etc.)…

LOAD DATA INFILE '/patient_data.csv'
INTO TABLE patient_data
FIELDS TERMINATED by ',' OPTIONALLY ENCLOSED BY '"'
IGNORE 1 LINES
(
    @pubpid
    , @title
    , @fname
    , @mname
    , @lname
    , @DOB
    , @ss
    , @sex
    , @street
    , @city
    , @state
    , @postal_code
    , @email
    , @phone_home
    , @home_ext
    , @phone_cell
    , @cell_ext
    , @phone_biz
    , @biz_ext
    , @reg_date
    , @preferred_name
) 
SET
    `pubpid` = @pubpid
    , `pid` = @pubpid
    , `title` = @title
    , `fname` = @fname
    , `mname` = @mname
    , `lname` = @lname
    , `DOB` = STR_TO_DATE(@DOB, '%m/%d/%Y')
    , `ss` = @ss
    , `sex` = @sex
    , `street` = @street
    , `city` = @city
    , `state` = @state
    , `postal_code` = @postal_code
    , `email` = @email
    , `phone_home` = @phone_home
    , `phone_cell` = @phone_cell
    , `phone_biz` = @phone_biz
    , `regdate` = STR_TO_DATE(@reg_date, '%m/%d/%Y')
    , `genericname1` = @preferred_name
    , `occupation` = ''
    , `date` = now()
    , `providerID` = 0
    , `ref_providerID` = 0
    , `billing_note` = ''
    , `financial_review` = '0000-00-00 00:00:00'
    , `hipaa_allowsms` = ''
    , `hipaa_allowemail` = ''
    , `guardiansname` = ''
    , `care_team_status` = 'active'
    , `industry` = ''
    , `imm_reg_status` = ''
    , `publicity_code` = ''
    , `protect_indicator` = ''
    , `guardianrelationship` = ''
    , `guardiansex` = ''
    , `guardianaddress` = ''
    , `guardiancity` = ''
    , `guardianpostalcode` = ''
    , `guardiancountry` = ''
    , `guardianphone` = ''
    , `guardianworkphone` = ''
    , `guardianemail` = ''
    , `sexual_orientation` = ''
    , `gender_identity` = ''
    , `birth_fname` = ''
    , `birth_lname` = ''
    , `dupscore` = 0
    , `suffix` = ''
    , `street_line_2` = ''
    , `patient_groups` = ''
    , `prevent_portal_apps` = ''
    , `created_by` = 1
    , `updated_by` = 1
;
update patient_data set pid = id;

All the hard-coded fields AFTER the ones that we’re loading from the CSV file were duplicated by adding a patient into openEMR “normally”, and then inspecting the values using SQL or phpMyAdmin. The final update statement mimics openEMR – pid always seemed to be the same as id for each record added.

I was able to use mysql from the command line to execute this code, and the ~4500 patients in my file were (pretty much instantly) added.