Read about OpenEMR's Response to the COVID-19 Pandemic at https://www.open-emr.org/covid19/

Help with pid error

I had entered a group as 00000 digit pid and then changed them back to regular numbers with no leading zeros and now it is trying to add a new patient as pid 100 but there is already a 100 we need it to start at 165. Help!

ERROR: insert failed: INSERT INTO patient_data SET pid = ‘100’, date = NOW(), title = ‘’, fname = ‘John’, mname = ‘’, lname = ‘Doe’, pubpid = ‘100’, DOB = ‘1989-08-11’, sex = ‘Male’, ss = ‘000-00-0000’, sexid = ‘’, drivers_license = ‘’, status = ‘’, LOC = ‘2.5PHP’, genericval1 = ‘’, genericname2 = ‘’, genericval2 = ‘’, billing_note = ‘’, street = ‘’, city = ‘’, state = ‘’, postal_code = ‘’, county = ‘’, country_code = ‘’, mothersname = ‘’, contact_relationship = ‘’, phone_contact = ‘’, phone_home = ‘’, phone_biz = ‘’, phone_cell = ‘’, email = ‘’, email_direct = ‘’, providerID = ‘’, ref_providerID = ‘’, pharmacy_id = ‘0’, hipaa_notice = ‘’, hipaa_voice = ‘’, hipaa_message = ‘’, hipaa_mail = ‘’, hipaa_allowsms = ‘’, hipaa_allowemail = ‘’, allow_imm_reg_use = ‘’, allow_imm_info_share = ‘’, allow_health_info_ex = ‘’, allow_patient_portal = ‘’, care_team = ‘’, cmsportal_login = ‘’, imm_reg_status = ‘’, imm_reg_stat_effdate = ‘’, publicity_code = ‘’, publ_code_eff_date = ‘’, protect_indicator = ‘’, prot_indi_effdate = ‘’, industry = ‘’, occupation = ‘’, language = ‘’, ethnicity = ‘’, race = ‘’, family_size = ‘’, financial_review = ‘’, monthly_income = ‘’, homeless = ‘’, interpretter = ‘’, migrantseasonal = ‘’, referral_source = ‘’, vfc = ‘’, religion = ‘’, deceased_reason = ‘’, pc = ‘’, cm = ‘’, groupcons = ‘’, just = ‘’, guardiansname = ‘’, guardianrelationship = ‘’, guardiansex = ‘’, guardianaddress = ‘’, guardiancity = ‘’, guardianstate = ‘’, guardianpostalcode = ‘’, guardiancountry = ‘’, guardianphone = ‘’, guardianworkphone = ‘’, guardianemail = ‘’

Error: Duplicate entry ‘100’ for key ‘pid’

/home/evolvebh/public_html/emr/library/patient.inc at 1179:sqlInsert
/home/evolvebh/public_html/emr/interface/new/new_comprehensive_save.php at 88:updatePatientData(100,Array,1)

I’m confused! where are you doing this. Was it a public pid(pubid)? How are you changing?
If you change pid, any resources for the changed pid will be lost.

Oh no. What should I do?

The patients are still coming up with the correct data but I can’t add a new one. Should I start all over with that table. I only have 164 patients.

First help me understand what you did to get into the situation you’re into now then what you’re trying to do and where you’re trying to do it

I made the pid into five digit text “numbers” Then I removed the leading zeros and now when it trys to add a new patient it is giving it the pid 100 but I have pid’s all the way to 165.

I didn’t change the data type of the pid. It is text right?

Do you mean with the patient demographics tab? I believe it’s populated with the pid by default but when you change it the value goes into the external ID field in the database.

Thanks so much for your help.