当前位置:网站首页>Read PDF image and identify content
Read PDF image and identify content
2022-06-28 09:54:00 【Pert-】
import pdfplumber
import pandas as pd
import fitz
from PIL import Image
from aip import AipOcr
import re
import threading
import xlwt
import numpy as np
import pandas as pd
from PIL import ImageFile
import time
ImageFile.LOAD_TRUNCATED_IMAGES = True
pdf_name='../ Medical Examination Report / Liuzhixia / Medical Examination Report ( Liuzhixia )2021 year 5 month 25 Japan .pdf'
error_list=[]
class Acqire:
def __init__(self):
self.APP_ID = ''
self.API_KEY = ''
self.SECRET_KEY = ''
### Change the picture size
def ResizeImage(self,path2,width,height):
filein = path2
fileout = path2
img = Image.open(filein)
out = img.resize((width, height),Image.ANTIALIAS)
out.save(fileout)
img.close()
def get_file_content(self,filepath,num,width,height):
def printI():
# re_size=threading.Thread(target = self.ResizeImage(filepath,width,height))
# re_size.start()
# re_size.join()
self.ResizeImage(filepath,width,height)
client = AipOcr(self.APP_ID,self.API_KEY,self.SECRET_KEY)
with open(filepath, 'rb') as fp:
image = fp.read()
fp.close()
# Define parameter variables
options={
'detect-direction': 'true',
'language-type': 'CHN_ENG'
}
result = client.general(image, options)
fp=open('../txt/{}.txt'.format(num),'w')
# print(result)
try:
for word in result['words_result']:
# fp.write(word['words'])
# fp.write('\n')
f.write(word['words'])
f.write('\n')
except:
print(num)
error_list.append(num)
fp.close()
return printI
def func(self,doc,i):
imglist = doc.getPageImageList(i)
for j, img in enumerate(imglist[:1]):
xref = img[0]
pix = fitz.Pixmap(doc, xref) # make pixmap from image
if pix.n - pix.alpha < 4: # can be saved as PNG
pix.writePNG("../img/p%s-%s.png" % (i+1, j+1))
else:
pix0 = fitz.Pixmap(fitz.csRGB, pix)
pix0.writePNG("../img/p%s-%s.png" % (i+1, j+1))
pix0 = None # free Pixmap resources
pix = None # free Pixmap resources
doc=fitz.open(pdf_name)
print(len(doc))
## take pdf Download all the pictures in
for i in range(len(doc)):
locals()['thread_'+str(i)]=threading.Thread(target = Acqire().func(doc,i))
locals()['thread_'+str(i)].start()
# ## Read text
# def read(_list,width=1500,height=2000):
# for x in _list:
# # x=17
# filepath='../img/p{}-1.png'.format(x)
# locals()['thread_'+str(x)]=threading.Thread(target = Acqire().get_file_content(filepath,num=x,height=height,width=width))
# locals()['thread_'+str(x)].start()
# locals()['thread_'+str(x)].join()
# time.sleep(0.5)
# f=open('../total.txt','w')
# primary=[x for x in range(11,32)]
# read(primary)
# if error_list:
# print(11111111111111)
# read(error_list,f,width=1200,height=1600)
# # print(error_list)
# doc.close()
# f.close()
import re
f=open('../total.txt','r')
content=''.join(f.readlines())
f.close()
# print(content)
### General inspection
a={}
### height
a[' height ']=re.findall(' height \n(.*)',content)[0]
### weight
a[' weight ']=re.findall(' weight \n(.*)',content)[0]
### Body mass index
a[' Body mass index ']=re.findall(' Body mass index \n(.*)',content)[0]
### systolic pressure
a[' systolic pressure ']=re.findall(' systolic pressure \n(.*)',content)[0]
### diastolic pressure
a[' diastolic pressure ']=re.findall(' diastolic pressure \n(.*)',content)[0]
print(a)
print('\n')
### internal medicine
b={}
### medical history
b[' medical history ']=re.findall(' medical history \n(.*)',content)[0]
### family history
b[' family history ']=re.findall(' family history \n(.*)',content)[0]
### heart rate
b[' heart rate ']=re.findall(' heart rate \n(.*)',content)[0]
### heart rate
b[' heart rate ']=re.findall(' heart rate \n(.*)',content)[0]
### Heart rate
b[' Heart rate ']=re.findall(' Heart rate \n(.*)',content)[0]
### heart sounds
b[' heart sounds ']=re.findall(' heart sounds \n(.*)',content)[0]
### Auscultation of the lungs
b[' Auscultation of the lungs ']=re.findall(' Auscultation of the lungs \n(.*)',content)[0]
### Palpation of the liver
b[' Palpation of the liver ']=re.findall(' Palpation of the liver \n(.*)',content)[0]
### Palpation of spleen
b[' Palpation of spleen ']=re.findall(' Palpation of spleen \n(.*)',content)[0]
### Renal percussion
b[' Renal percussion ']=re.findall(' Renal percussion \n(.*)',content)[0]
### Internal medicine others
b[' Internal medicine others ']=re.findall(' Internal medicine others \n(.*)',content)[0]
print(b)
print('\n')
### Surgery
c={}
### The skin
c[' The skin ']=re.findall(' The skin \n(.*)',content)[0]
### Superficial lymph nodes
c[' Superficial lymph nodes ']=re.findall(' Superficial lymph nodes \n(.*)',content)[0]
### thyroid ( Surgery )
c[' thyroid ( Surgery )']=re.findall(' thyroid .*\n(.*)',content)[0]
### Spine
c[' Spine ']=re.findall(' Spine \n(.*)',content)[0]
### The joints of the limbs
c[' The joints of the limbs ']=re.findall(' The joints of the limbs \n(.*)',content)[0]
### Surgery, others
c[' Surgery, others ']=re.findall(' Surgery, others \n(.*)',content)[0]
### Preliminary comments
c[' Preliminary comments ']=re.findall(' Preliminary comments (.*)',content)[0]
print(c)
print('\n')
### Department of gynaecology
d={}
### History of surgery
d[' History of surgery ']=re.findall(' Company \n History of surgery \n(.*)',content)[0]
### vulva
d[' vulva ']=re.findall(' vulva \n(.*)',content)[0]
### Vagina
d[' Vagina ']=re.findall(' Vagina \n(.*)',content)[0]
### Cervical
d[' Cervical ']=re.findall(' Cervical \n(.*)',content)[0]
### uterus
d[' uterus ']=re.findall(' uterus \n(.*)',content)[0]
### The attachment
d[' The attachment ']=re.findall(' The attachment \n(.*)',content)[0]
### Other gynecological
d[' Other gynecological ']=re.findall(' Other gynecological \n(.*)',content)[0]
print(d)
print('\n')
### Ophthalmology Department
e={}
### External eye
e[' External eye ']=re.findall(' External eye \n(.*)',content)[0]
### Ophthalmology others
e[' Ophthalmology others ']=re.findall(' Ophthalmology others \n(.*)',content)[0]
### Slit lamp inspection
e[' Slit lamp inspection ']=re.findall(' Slit lamp inspection \n(.*)',content)[0]
### Ophthalmoscopy
e[' Ophthalmoscopy ']=re.findall(' Ophthalmoscopy \n(.*)',content)[0]
### Non contact intraocular pressure in the left eye
e[' Non contact intraocular pressure in the left eye ']=re.findall(' Non contact intraocular pressure in the left eye \n(.*)',content)[0]
### Non contact intraocular pressure in the right eye
e[' Non contact intraocular pressure in the right eye ']=re.findall(' Non contact intraocular pressure in the right eye \n(.*)',content)[0]
print(e)
print('\n')
# ### E.N.T. Department
f={}
### Past history
f[' Past history ']=re.findall(' Past history \n(.*)',content)[0]
### External ear
f[' External ear ']=re.findall(' External ear \n(.*)',content)[0]
### External auditory canal
f[' External auditory canal ']=re.findall(' External auditory canal \n(.*)',content)[0]
### Tympanic membrane
f[' Tympanic membrane ']=re.findall(' Tympanic membrane \n(.*)',content)[0]
### nasal cavity
f[' nasal cavity ']=re.findall(' nasal cavity \n(.*)',content)[0]
### Nasal septum
f[' Nasal septum ']=re.findall(' Nasal septum \n(.*)',content)[0]
### pharynx
f[' pharynx ']=re.findall(' pharynx \n(.*)',content)[0]
### tonsil
f[' tonsil ']=re.findall(' tonsil \n(.*)',content)[0]
### Otorhinolaryngology and others
f[' Otorhinolaryngology and others ']=re.findall(' Otorhinolaryngology and others \n(.*)',content)[0]
print(f)
print('\n')
### routine blood test
g={}
### White blood cell count
g[' White blood cell count ']=re.findall(' White blood cell count \n.*\n(.*)',content)[0]
### Red blood cell count
g[' Red blood cell count ']=re.findall(' Red blood cell count \n.*\n(.*)',content)[0]
### Hemoglobin
g[' Hemoglobin ']=re.findall(' Hemoglobin \n(.*)',content)[0]
### Hematocrit
g[' Hematocrit ']=re.findall(' Hematocrit \n.*\n(.*)',content)[0]
### Mean corpuscular volume
g[' Mean corpuscular volume ']=re.findall(' Mean corpuscular volume \n.*\n(.*)',content)[0]
### Mean corpuscular hemoglobin content
g[' Mean corpuscular hemoglobin content ']=re.findall(' Mean corpuscular hemoglobin content \n.*\n(.*)',content)[0]
### Mean corpuscular hemoglobin concentration
g[' Mean corpuscular hemoglobin concentration ']=re.findall(' Mean corpuscular hemoglobin concentration \n.*\n(.*)',content)[0]
### Coefficient of variation of red blood cell distribution width
# g[' Coefficient of variation of red blood cell distribution width ']=re.findall(' Coefficient of variation of red blood cell distribution width \n RDW-CV (.*)',content)[0]
g[' Coefficient of variation of red blood cell distribution width ']=''
### Platelet count
g[' Platelet count ']=re.findall(' Platelet count \n.*\n(.*)',content)[0]
### Mean platelet volume
g[' Mean platelet volume ']=re.findall(' Mean platelet volume \n.*\n(.*)',content)[0]
### Platelet distribution width
g[' Platelet distribution width ']=re.findall(' Platelet distribution width \n.*\n(.*)',content)[0]
### Percentage of lymphocytes
g[' Percentage of lymphocytes ']=re.findall(' Percentage of lymphocytes \n.*%(.*)',content)[0]
### Percentage of neutrophils
g[' Percentage of neutrophils ']=re.findall(' Percentage of neutrophils \n.*%(.*)',content)[0]
### Absolute value of lymphocyte
# g[' Absolute value of lymphocyte ']=re.findall(' Absolute value of lymphocyte \n.*LYMPH (.*)',content)[0]
g[' Absolute value of lymphocyte ']=''
### Absolute neutrophil count
g[' Absolute neutrophil count ']=re.findall(' Absolute neutrophil count \n.*\n(.*)',content)[0]
### Standard deviation of red blood cell distribution width
# g[' Standard deviation of red blood cell distribution width ']=re.findall(' Standard deviation of red blood cell distribution width \n.*RDW-SD (.*)',content)[0]
g[' Standard deviation of red blood cell distribution width ']=''
### Hematocrit
g[' Hematocrit ']=re.findall(' Hematocrit \n.*\n(.*)',content)[0]
### Percentage of monocytes
g[' Percentage of monocytes ']=re.findall(' Percentage of monocytes \n.*%(.*)',content)[0]
### The absolute value of monocytes
g[' The absolute value of monocytes ']=re.findall(' The absolute value of monocytes \n.*\n(.*)',content)[0]
### Percentage of eosinophils
g[' Percentage of eosinophils ']=re.findall(' Percentage of eosinophils \n.*\n(.*)',content)[0]
### Eosinophil absolute value
g[' Eosinophil absolute value ']=re.findall(' Eosinophil absolute value \n.*\n(.*)',content)[0]
### Basophil percentage
g[' Basophil percentage ']=re.findall(' Basophil percentage \n.*%(.*)',content)[0]
### Basophil absolute value
g[' Basophil absolute value ']=re.findall(' Basophil absolute value \n.*\n(.*)',content)[0]
print(g)
print('\n')
### Urine routine
h={}
### Specific gravity of urine
h[' Specific gravity of urine ']=re.findall(' Specific gravity of urine \n.*\n(.*)',content)[0]
### Urine pH
h[' Urine pH ']=re.findall(' Urine pH \n.*\n(.*)',content)[0]
### Urine white blood cells
h[' Urine white blood cells ']=re.findall(' Urine white blood cells \n.*\n(.*)',content)[0]
### Urine nitrite
h[' Urine nitrite ']=re.findall(' Urine nitrite \n.*\n(.*)',content)[0]
### Urine protein
h[' Urine protein ']=re.findall(' Urine protein \n.*\n(.*)',content)[0]
### Urine sugar
h[' Urine sugar ']=re.findall(' Urine sugar \n.*\n(.*)',content)[0]
### Uroketone body
h[' Uroketone body ']=re.findall(' Uroketone body \n.*\n(.*)',content)[0]
### Urobilinogen
h[' Urobilinogen ']=re.findall(' Urobilinogen \n.*\n(.*)',content)[0]
### Urinary bilirubin
h[' Urinary bilirubin ']=re.findall(' Urinary bilirubin \n.*\n(.*)',content)[0]
### Urine occult blood
h[' Urine occult blood ']=re.findall(' Urine occult blood \n.*\n(.*)',content)[0]
### Urine ascorbic acid
h[' Urine ascorbic acid ']=re.findall(' Urine ascorbic acid \n.*\n(.*)',content)[0]
### Urinary microalbumin quantitation
# h[' Urinary microalbumin quantitation ']=re.findall(' Urinary microalbumin quantitation \n U-ALB\n(.*)',content)[0]
h[' Urinary microalbumin quantitation ']=''
### carbon 14- Urea breath test
# h[' carbon 14- Urea breath test ']=re.findall(' carbon 14 Urea breath test \n 14C-UBT (.*)',content)[0]
h[' carbon 14- Urea breath test ']=''
### Occult blood
h[' Occult blood ']=re.findall(' Occult blood \n(.*)',content)[0]
print(h)
print('\n')
### Department of gynaecology
i={}
### Leucorrhea cleanliness
i[' Leucorrhea cleanliness ']=re.findall(' Leucorrhea cleanliness \n(.*)',content)[0]
### Moniliform bacteria
i[' Moniliform bacteria ']=re.findall(' Moniliform bacteria \n(.*)',content)[0]
### trichomonad
i[' trichomonad ']=re.findall(' trichomonad \n(.*)',content)[0]
### Cervical TCT
i[' Cervical TCT']=re.findall(' Cervical TCT\n(.*)',content)[0]
print(i)
print('\n')
### Laboratory examination
j={}
### Anti thyroid peroxidase antibody
j[' Anti thyroid peroxidase antibody ']=re.findall(' Anti thyroid peroxidase antibody \nAnti-TPO\n(.*)',content)[0]
### Gastrin 17
j[' Gastrin 17']=re.findall(' Gastrin .*\n(.*)',content)[0]
### Alanine aminotransferase
j[' Alanine aminotransferase ']=re.findall(' Alanine aminotransferase \nALT\n(.*)',content)[0]
### Aspartate aminotransferase
j[' Aspartate aminotransferase ']=re.findall(' Aspartate aminotransferase \nAST\n(.*)',content)[0]
###γ- Glutamyltransferase
j['γ- Glutamyltransferase ']=re.findall('Y- Glutamyltransferase \nGGT\n(.*)',content)[0]
### Alkaline phosphatase
j[' Alkaline phosphatase ']=re.findall(' Alkaline phosphatase \nALP\n(.*)',content)[0]
### Total bile acid
j[' Total bile acid ']=re.findall(' Total bile acid \nTBA\n(.*)',content)[0]
### Cholinesterase
j[' Cholinesterase ']=re.findall(' Cholinesterase \nChE\n(.*)',content)[0]
### Total bilirubin
j[' Total bilirubin ']=re.findall(' Total bilirubin \nTBIL\n(.*)',content)[0]
### Direct bilirubin
j[' Direct bilirubin ']=re.findall(' Direct bilirubin \nDBIL(.*)',content)[0]
### Indirect bilirubin
j[' Indirect bilirubin ']=re.findall(' Indirect bilirubin \nIBIL\n(.*)',content)[0]
### Total protein
j[' Total protein ']=re.findall(' Total protein \nTP\n(.*)',content)[0]
### Albumin
j[' Albumin ']=re.findall(' Albumin \nALB\n(.*)',content)[0]
### Globulin
j[' Globulin ']=re.findall(' Globulin \nGLO\n(.*)',content)[0]
### Albumin / Globulin ratio
j[' Albumin / Globulin ratio ']=re.findall(' Albumin / Globulin ratio \nA/G\n(.*)',content)[0]
### urea
j[' urea ']=re.findall(' urea \nUREA\n(.*)',content)[0]
### creatinine
j[' creatinine ']=re.findall(' creatinine \nCr\n(\d+\.*\d*)',content)[0]
### uric acid
j[' uric acid ']=re.findall(' uric acid \nUA\n(.*)',content)[0]
###β2 Microglobulin
j['β2 Microglobulin ']=re.findall('β2 Microglobulin \nβ2-MG\n(.*)',content)[0]
### Serum cystatin C
j[' Serum cystatin C']=re.findall(' Serum cystatin C\n.*\n(.*)',content)[0]
### Fasting blood glucose
j[' Fasting blood glucose ']=re.findall(' Fasting blood glucose \nFBG\n(.*)',content)[0]
### glycosylated hemoglobin
j[' glycosylated hemoglobin ']=re.findall(' glycosylated hemoglobin \nHBA1c\n(.*)',content)[0]
### Insulin
j[' Insulin ']=re.findall(' Insulin \nINS\n(.*)',content)[0]
###C peptide
j['C peptide ']=re.findall('C.* peptide \n.*\n(.*)',content)[0]
### Total cholesterol
j[' Total cholesterol ']=re.findall(' Total cholesterol \nTc\n(.*)',content)[0]
### triglycerides
j[' triglycerides ']=re.findall(' triglycerides \nTG\n(.*)',content)[0]
### HDL cholesterol
j[' HDL cholesterol ']=re.findall(' HDL cholesterol \nHDL-C\n(.*)',content)[0]
### LDL cholesterol
j[' LDL cholesterol ']=re.findall(' LDL cholesterol \nLDL-C\n(.*)',content)[0]
### Apolipoproteins A1
j[' Apolipoproteins A1']=re.findall(' Apolipoproteins A1\n.*\n(.*)',content)[0]
### Apolipoproteins B
j[' Apolipoproteins B']=re.findall(' Apolipoproteins B\nApo-B\n(.*)',content)[0]
### Lipoproteins (a)
j[' Lipoproteins (a)']=re.findall(' Lipoproteins .*\n.*LP.*\n(.*)',content)[0]
### Phosphocreatine kinase
j[' Phosphocreatine kinase ']=re.findall('CK\n(.*)',content)[0]
### Phosphocreatine kinase isoenzyme
j[' Phosphocreatine kinase isoenzyme ']=re.findall(' Phosphocreatine kinase isoenzyme \n.*\n(.*)',content)[0]
### Lactate dehydrogenase
j[' Lactate dehydrogenase ']=re.findall(' Lactate dehydrogenase \nLDH\n(.*)',content)[0]
### Hypersensitivity C Reactive protein
j[' Hypersensitivity C Reactive protein ']=re.findall(' Hypersensitivity C Reactive protein \nHS-CRP(.*)',content)[0]
### Homocysteine
j[' Homocysteine ']=re.findall(' Homocysteine \n(.*)',content)[0]
### Whole blood viscosity 1
j[' Whole blood viscosity 1']=re.findall(' Whole blood viscosity 1\n(.*)',content)[0]
### Whole blood viscosity 5
j[' Whole blood viscosity 5']=re.findall(' Whole blood viscosity 5\n(.*)',content)[0]
### Whole blood viscosity 30
j[' Whole blood viscosity 30']=re.findall(' Whole blood viscosity 30\n(.*)',content)[0]
### Whole blood viscosity 200
j[' Whole blood viscosity 200']=re.findall(' Whole blood viscosity 200\n(.*)',content)[0]
### Plasma viscosity
j[' Plasma viscosity ']=re.findall(' Plasma viscosity \n(.*)',content)[0]
### esr
j[' esr ']=re.findall(' esr \n(.*)',content)[0]
### Accretion
j[' Accretion ']=re.findall(' Accretion \n(.*)',content)[0]
### Whole blood high shear relative index
j[' Whole blood high shear relative index ']=re.findall(' Whole blood high shear relative index \n(.*)',content)[0]
### Whole blood low shear relative index
j[' Whole blood low shear relative index ']=re.findall(' Whole blood low shear relative index \n(.*)',content)[0]
### ESR equation K value
j[' ESR equation K value ']=re.findall(' ESR equation K value \n(.*)',content)[0]
### Erythrocyte aggregation index
j[' Erythrocyte aggregation index ']=re.findall(' Erythrocyte aggregation index \nAgrbc\n(.*)',content)[0]
### Whole blood low shear reduction viscosity
j[' Whole blood low shear reduction viscosity ']=re.findall(' Whole blood low shear reduction viscosity \n(.*)',content)[0]
### Whole blood high shear reduction viscosity
j[' Whole blood high shear reduction viscosity ']=re.findall(' Whole blood high shear reduction viscosity \n(.*)',content)[0]
### Erythrocyte rigidity index
j[' Erythrocyte rigidity index ']=re.findall(' Erythrocyte rigidity index \n.*\n(.*)',content)[0]
### Erythrocyte deformability index
j[' Erythrocyte deformability index ']=re.findall(' Erythrocyte deformability index \n(.*)',content)[0]
### Rheumatoid factor
j[' Rheumatoid factor ']=re.findall(' Rheumatoid factor \nRF\n(.*)',content)[0]
### Anti streptolysin “0
j[' Anti streptolysin “0']=re.findall(' Anti streptolysin .*\n.*\n(.*)',content)[0]
### Lactate dehydrogenase
j[' Lactate dehydrogenase ']=re.findall(' Lactate dehydrogenase \nLDH\n(.*)',content)[0]
###HPV16 type
j['HPV16 type ']=re.findall('HPV16 type \n(.*)',content)[0]
###HPV18 type
j['HPV18 type ']=re.findall('HPV18 type \n(.*)',content)[0]
###HPV31 type
j['HPV31 type ']=re.findall('HPV31 type \n(.*)',content)[0]
###HPV33 type
j['HPV33 type ']=re.findall('HPV33 type \n(.*)',content)[0]
###HPV35 type
j['HPV35 type ']=re.findall('HPV35 type \n(.*)',content)[0]
###HPV39 type
j['HPV39 type ']=re.findall('HPV39 type \n(.*)',content)[0]
###HPV45 type
j['HPV45 type ']=re.findall('HPV45 type \n(.*)',content)[0]
###HPV51 type
j['HPV51 type ']=re.findall('.*PV51 type \n(.*)',content)[0]
###HPV52 type
j['HPV52 type ']=re.findall('HPV52 type \n(.*)',content)[0]
###HPV53 type
j['HPV53 type ']=re.findall('HPV53 type \n(.*)',content)[0]
###HPV56 type
j['HPV56 type ']=re.findall('HPV56 type \n(.*)',content)[0]
###HPV58 type
j['HPV58 type ']=re.findall('HPV58 type \n(.*)',content)[0]
###HPV59 type
j['HPV59 type ']=re.findall('HPV59 type \n(.*)',content)[0]
###HPV66 type
j['HPV66 type ']=re.findall('HPV66 type \n(.*)',content)[0]
###HPV68 type
j['HPV68 type ']=re.findall('HPV68 type \n(.*)',content)[0]
###HPV6 type
j['HPV6 type ']=re.findall('HPV6 type \n(.*)',content)[0]
###HPV11 type
j['HPV11 type ']=re.findall('HPV11 type \n(.*)',content)[0]
###HPV43 type
j['HPV43 type ']=re.findall('HPV43 type \n(.*)',content)[0]
###HPV42 type
j['HPV42 type ']=re.findall('HPV42 type \n(.*)',content)[0]
###HPV73 type
j['HPV73 type ']=re.findall('HPV73 type \n(.*)',content)[0]
###HPV81 type
j['HPV81 type ']=re.findall('HPV81 type \n(.*)',content)[0]
###HPV83 type
j['HPV83 type ']=re.findall('HPV83 type \n(.*)',content)[0]
###HPV82 type
j['HPV82 type ']=re.findall('HPV82 type \n(.*)',content)[0]
###EB Virus resistance - VCAIgA
j['EB Virus resistance - VCAIgA']=re.findall('EB Virus resistance .*\n(.*)',content)[0]
### Alpha fetoprotein (T-12)
j[' Alpha fetoprotein (T-12)']=re.findall(' Alpha fetoprotein .*\nAFP\n(.*)',content)[0]
### Carcinoembryonic antigen (T-12)
j[' Carcinoembryonic antigen (T-12)']=re.findall(' Carcinoembryonic antigen .*\nCEA\n(.*)',content)[0]
### Cytokeratin 19 fragment (T-12)
j[' Cytokeratin 19 fragment (T-12)']=re.findall(' Cytokeratin 19 fragment .*\nCYFRA21-1(.*)',content)[0]
### carbohydrate antigen 19-9(T-12)
j[' carbohydrate antigen 19-9(T-12)']=re.findall(' carbohydrate antigen 19-9.*\nCA19-9\n(.*)',content)[0]
### carbohydrate antigen 242(T-12)
j[' carbohydrate antigen 242(T-12)']=re.findall(' carbohydrate antigen 242.*\nCA242\n(.*)',content)[0]
### Neuron specific enolase (T-12)NSE
j[' Neuron specific enolase (T-12)NSE']=re.findall(' Neuron specific enolase \n.*\nNSE\n(.*)',content)[0]
### carbohydrate antigen 15-3(T-12)
j[' carbohydrate antigen 15-3(T-12)']=re.findall(' carbohydrate antigen 15-3.*\nCA15-3(.*)',content)[0]
### carbohydrate antigen 125(T-12)
j[' carbohydrate antigen 125(T-12)']=re.findall(' carbohydrate antigen 125.*\n.*\n(.*)',content)[0]
###PGl/PGIl(T-12)
j['PGl/PGIl(T-12)']=''
### Pepsinogen (T-12)
j[' Pepsinogen (T-12)']=re.findall(' Pepsinogen .*\n.*\nPG I\n(.*)',content)[0]
### Pepsinogen Ⅱ(T-12)
j[' Pepsinogen Ⅱ(T-12)']=''
### Human chorionic gonadotropin free β Subunits
j[' Human chorionic gonadotropin free β Subunits ']=''
### Lactate dehydrogenase
j[' Lactate dehydrogenase ']=re.findall(' Lactate dehydrogenase \nLDH\n(.*)',content)[0]
### Squamous cell carcinoma associated antigen (T-12)
j[' Squamous cell carcinoma associated antigen (T-12)']=re.findall(' Squamous cell carcinoma associated antigen .*\nSCC\n(.*)',content)[0]
### Triiodothyronine
j[' Triiodothyronine ']=re.findall(' Triiodothyronine \n(.*)',content)[0]
### Free triiodothyronine
j[' Free triiodothyronine ']=re.findall(' Free triiodothyronine \n(.*)',content)[0]
### Thyroxine
j[' Thyroxine ']=re.findall(' Thyroxine \nT4\n(.*)',content)[0]
### Free thyroxine
j[' Free thyroxine ']=re.findall(' Free thyroxine \nFT4\n(.*)',content)[0]
### Thyrotropin
j[' Thyrotropin ']=re.findall(' Thyrotropin \nTSH\n(.*)',content)[0]
### Anti thyroglobulin antibodies
j[' Anti thyroglobulin antibodies ']=re.findall(' Anti thyroglobulin antibodies \nTG-Ab\n(.*)',content)[0]
### progesterone
j[' progesterone ']=re.findall(' progesterone \n(.*)',content)[0]
### Estradiol
j[' Estradiol ']=re.findall(' Estradiol \n.*\n(.*)',content)[0]
### Follicle stimulating hormone
j[' Follicle stimulating hormone ']=re.findall(' Follicle stimulating hormone \n.*\n.*\n(.*)',content)[0]
### Luteinizing hormone
j[' Luteinizing hormone ']=re.findall(' Luteinizing hormone \n.*\n(.*)',content)[0]
### testosterone
j[' testosterone ']=re.findall(' testosterone \n.*\n(.*)',content)[0]
### Prolactin
j[' Prolactin ']=re.findall(' Prolactin \nPRL\n(.*)',content)[0]
### immunoglobulin A
j[' immunoglobulin A']=re.findall(' immunoglobulin A\nIgA\n(.*)',content)[0]
### immunoglobulin G
j[' immunoglobulin G']=re.findall(' immunoglobulin G\n.*\n(.*)',content)[0]
### immunoglobulin M
j[' immunoglobulin M']=re.findall(' immunoglobulin M\n.*\n(.*)',content)[0]
### immunoglobulin E
j[' immunoglobulin E']=re.findall(' immunoglobulin E\n(.*)',content)[0]
### complement C3
j[' complement C3']=re.findall(' complement C3\nC3\n(.*)',content)[0]
### complement C4
j[' complement C4']=re.findall(' complement C4\nC4\n(.*)',content)[0]
### serum Ⅲ Type I procollagen
j[' serum Ⅲ Type I procollagen ']=re.findall(' serum . Type I procollagen \nPCII\n(.*)',content)[0]
### serum Ⅳ Type collagen
j[' serum Ⅳ Type collagen ']=re.findall(' serum . Type collagen \nCIV\n(.*)',content)[0]
### Serum laminin
j[' Serum laminin ']=re.findall(' Serum laminin \nLN\n(.*)',content)[0]
### Serum hyaluronic acid
j[' Serum hyaluronic acid ']=re.findall('(.*)\n.*\n Serum hyaluronic acid ',content)[0]
print(j)
print('\n')
### ECG Room
k={}
### electrocardiogram
k[' electrocardiogram ']=''.join(list(re.findall(' electrocardiogram \n(.*)',content)[0]))
print(k)
print('\n')
### Ultrasonic room examination
l={}
### liver
l[' liver ']=re.findall(' liver \n(.*?)\n gallbladder ',content,re.S)[0]
### gallbladder
l[' gallbladder ']=re.findall(' gallbladder \n(.*?)\n pancreas ',content,re.S)[0]
### pancreas
l[' pancreas ']=re.findall(' gallbladder \n.*?( pancreas .*)\n pancreas ',content,re.S)[0]
### The spleen
l[' The spleen ']=re.findall(' The spleen \n(.*?)\n Double kidney ',content,re.S)[0]
### Double kidney
l[' Double kidney ']=re.findall(' Double kidney \n(.*?)\n uterus ',content,re.S)[0]
### uterus
l[' uterus ']=re.findall(' Double kidney \n.*?\n uterus \n(.*?)\n The attachment ',content,re.S)[0]
### The attachment
l[' The attachment ']=re.findall(' Double kidney \n.*?\n uterus \n.*?\n The attachment (.*?)\n Ai Kang ',content,re.S)[0]
### Breast
l[' Breast ']=re.findall(' Breast \n(.*?)\n thyroid ',content,re.S)[0]
### thyroid
l[' thyroid ']=''.join(list(re.findall('( thyroid .*?)\n thyroid \n(.*\n Large lymph node )',content)[0]))
### Carotid artery
l[' Carotid artery ']=''.join(list(re.findall(' thyroid \n.*\n Large lymph node .*\n(.*)\n.*\n(.*\n.*)',content)[0]))
### The heart
l[' The heart ']=re.findall(' Check what you see .*\n(1.*?)\n Bladder ',content,re.S)[0]
### Bladder
l[' Bladder ']=re.findall(' Bladder \n(.*)',content)[0]
print(l)
print('\n')
###CT
m={}
m[' Head ']=''.join(list(re.findall('(.*)\n Head .CT.\n(.*)\n(.*)',content)[0]))
m[' chest ']=re.findall(' chest .CT.\n(.*?) Preliminary comments ',content,re.S)[0]
print(m)
print('\n')
### bone density
n={}
n[' bone density ']=re.findall(' bone density \n(.*)',content)[0]
print(n)
print('\n')
### Arteriosclerosis test room
o={}
o[' Arteriosclerosis test ']=re.findall(' Arteriosclerosis test \n(.*)\n Transcranial Doppler examination room ',content,re.S)[0]
o[' Transcranial Doppler ']=re.findall(' Transcranial Doppler examination room .*? Company \n(.*?)\n Preliminary comments ',content,re.S)[0]
print(o)
print('\n')
### Hepatitis B test report
p={}
p[' Hepatitis B virus surface antigen ']=re.findall(' Hepatitis B virus surface antigen \n.*\n.*\n.*\n(.*)',content)[0]
p[' Hepatitis B virus surface antibody ']=re.findall(' Hepatitis B virus surface antibody \n.*\n(.*)',content)[0]
p[' Hepatitis B virus e antigen ']=re.findall(' Hepatitis B virus e antigen \n.*\n.*\n(.*)',content)[0]
p[' Hepatitis B virus e antibody ']=re.findall(' Hepatitis B virus e antibody \n.*\n(.*)',content)[0]
p[' Hepatitis B virus core antibody ']=re.findall(' Hepatitis B virus core antibody \n.*\n(.*)',content)[0]
print(p)
print('\n')
_list=[' General inspection ',' internal medicine ',' Surgery ',' Department of gynaecology ',' Ophthalmology Department ',' E.N.T. Department ',' routine blood test ',' Urine routine ',' Department of gynaecology ',' Laboratory examination ',' ECG Room ',' Ultrasonic room examination ','CT',' bone density ',' During arteriosclerosis test ',' Hepatitis B test report ']
_list2=[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p]
total={x:y for x,y in zip(_list,_list2)}
# print(total)
total_list=[]
for x in _list2:
_list3=[]
for key,value in x.items():
_list3.append([key,value])
total_list.append(_list3)
writer=pd.ExcelWriter(" Liuzhixia Aikang report .xlsx")
for index,x in enumerate(total_list):
data=np.array(x)
df=pd.DataFrame(data)
df.to_excel(writer, sheet_name=_list[index], header=False, index=False)
writer.save()
边栏推荐
- Function sub file writing
- Inventory of excellent note taking software: good-looking and powerful visual note taking software, knowledge map tools heptabase, hydrogen map, walling, reflect, infranodus, tiddlywiki
- 卸载oracle报错
- 剑指Offer | 链表转置
- Summary of PMP learning experience
- English translation plug-in installation of idea
- 我大抵是卷上瘾了,横竖睡不着!竟让一个Bug,搞我两次!
- R语言使用car包中的avPlots函数创建变量添加图(Added-variable plots)、在图像交互中,在变量添加图中手动标识(添加)对于每一个预测变量影响较大的强影响点
- PHP curl forged IP address and header information code instance - Alibaba cloud
- bad zipfile offset (local header sig)
猜你喜欢

Explain final, finally, and finalize
![1180: fractional line delimitation /p1068 [noip2009 popularization group] fractional line delimitation](/img/1a/162b060a6498e58278b6ca50e4953c.png)
1180: fractional line delimitation /p1068 [noip2009 popularization group] fractional line delimitation

Function sub file writing

Dbeaver installation and use tutorial (super detailed installation and use tutorial)

Bron filter Course Research Report

HDI的盲孔设计,你注意到这个细节了吗?

再见!IE浏览器,这条路由Edge替IE继续走下去

Adapter mode

Unity AssetBundle资源打包与资源加载

如图 用sql行转列 图一原表,图二希望转换后
随机推荐
Machine virtuelle 14 installer win7 (tutoriel)
Threads and processes
小米旗下支付公司被罚 12 万,涉违规开立支付账户等:雷军为法定代表人,产品包括 MIUI 钱包 App
优秀笔记软件盘点:好看且强大的可视化笔记软件、知识图谱工具Heptabase、氢图、Walling、Reflect、InfraNodus、TiddlyWiki
再见!IE浏览器,这条路由Edge替IE继续走下去
Naming rules and specifications for identifiers
结巴分词器_分词器原理
1181: integer parity sort
Explain final, finally, and finalize
Wechat applet development log
函数的分文件编写
PMP Exam key summary IX - closing
==And eqauls()
How to view the web password saved by Google browser
JSON数据与List集合之间的正确转换
Adapter mode
MySQL的开发环境和测试环境有什么区别??
2020-10-27
PMP考试重点总结五——执行过程组
For the development of short video app, the elder warned me to choose the open source code