本文整理汇总了Python中dbmis_connect2.DBMIS.close方法的典型用法代码示例。如果您正苦于以下问题:Python DBMIS.close方法的具体用法?Python DBMIS.close怎么用?Python DBMIS.close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dbmis_connect2.DBMIS
的用法示例。
在下文中一共展示了DBMIS.close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: pclinic
# 需要导入模块: from dbmis_connect2 import DBMIS [as 别名]
# 或者: from dbmis_connect2.DBMIS import close [as 别名]
def pclinic(clinic_id, mcod):
from dbmis_connect2 import DBMIS
from PatientInfo import get_patient_list
import time
localtime = time.asctime( time.localtime(time.time()) )
log.info('------------------------------------------------------------')
log.info('Create MO File. Start {0}'.format(localtime))
dbc = DBMIS(clinic_id, mis_host = HOST, mis_db = DB)
if dbc.ogrn == None:
CLINIC_OGRN = u""
else:
CLINIC_OGRN = dbc.ogrn
cogrn = CLINIC_OGRN.encode('utf-8')
cname = dbc.name.encode('utf-8')
sout = "clinic_id: {0} cod_mo: {1} clinic_name: {2} clinic_ogrn: {3}".format(clinic_id, mcod, cname, cogrn)
log.info(sout)
if DATE_RANGE is None:
s_sqlt = """SELECT * FROM vw_peoples p
JOIN area_peoples ap ON p.people_id = ap.people_id_fk
JOIN areas ar ON ap.area_id_fk = ar.area_id
JOIN clinic_areas ca ON ar.clinic_area_id_fk = ca.clinic_area_id
WHERE ca.clinic_id_fk = {0} AND ca.basic_speciality = 1
AND ap.date_end is Null;"""
s_sql = s_sqlt.format(clinic_id)
else:
D1 = DATE_RANGE[0]
D2 = DATE_RANGE[1]
s_sqlt = """SELECT * FROM vw_peoples p
JOIN area_peoples ap ON p.people_id = ap.people_id_fk
JOIN areas ar ON ap.area_id_fk = ar.area_id
JOIN clinic_areas ca ON ar.clinic_area_id_fk = ca.clinic_area_id
WHERE ca.clinic_id_fk = {0} AND ca.basic_speciality = 1
AND ap.date_beg >= '{1}'
AND ap.date_beg <= '{2}'
AND ap.date_end is Null;"""
s_sql = s_sqlt.format(clinic_id, D1, D2)
cursor = dbc.con.cursor()
cursor.execute(s_sql)
results = cursor.fetchall()
localtime = time.asctime( time.localtime(time.time()) )
log.info('Patients has been selected {0}'.format(localtime))
patient_list = get_patient_list(results)
npatients = len(patient_list)
sout = "clinic has got {0} unique patients".format(npatients)
log.info( sout )
plist(dbc, clinic_id, mcod, patient_list)
dbc.close()
localtime = time.asctime( time.localtime(time.time()) )
log.info('Create MO File. Finish '+localtime)
示例2: get_uid_list
# 需要导入模块: from dbmis_connect2 import DBMIS [as 别名]
# 或者: from dbmis_connect2.DBMIS import close [as 别名]
def get_uid_list(clinic_id, d_start = D_START, d_end = D_FINISH):
import fdb
from datetime import datetime
from dbmis_connect2 import DBMIS
d1 = datetime.strptime(d_start, '%Y-%m-%d')
d2 = datetime.strptime(d_end, '%Y-%m-%d')
c_arr = []
dbc = DBMIS(clinic_id, mis_host = HOST, mis_db = DB)
cur = dbc.con.cursor()
dbc.con.begin(fdb.ISOLATION_LEVEL_READ_COMMITED_RO)
cur.execute(SQLT_TCOUNT, (clinic_id, d1, d2, ))
rec = cur.fetchone()
dbc.con.commit()
if rec is None: return c_arr, 0
t_count = rec[0]
cur.execute(SQLT_CLIST, (clinic_id, d1, d2, ))
results = cur.fetchall()
dbc.con.commit()
for rec in results:
ticket_id = rec[0]
ms_uid = rec[1]
c_arr.append([ticket_id, ms_uid])
dbc.close()
return c_arr, t_count
示例3: get_peoples
# 需要导入模块: from dbmis_connect2 import DBMIS [as 别名]
# 或者: from dbmis_connect2.DBMIS import close [as 别名]
def get_peoples():
log.info('GET ALL PEOPLES. Start {0}'.format(localtime))
sout = "Database: {0}:{1}".format(HOST, DB)
log.info(sout)
p_enp = {}
p_oms = {}
try:
dbc = DBMIS(mis_host = HOST, mis_db = DB)
except:
log.warn("Can't connect to DBMIS")
return p_enp, p_oms
# Create new READ ONLY READ COMMITTED transaction
ro_transaction = dbc.con.trans(fdb.ISOLATION_LEVEL_READ_COMMITED_RO)
# and cursor
cur = ro_transaction.cursor()
cur.execute(SQLT_GET_PEOPLES)
results = cur.fetchall()
for rec in results:
people = PEOPLE()
people.people_id = rec[0]
people.birthday = rec[1]
people.enp = rec[2]
oms_ser = rec[3]
if oms_ser:
people.oms_ser = oms_ser.strip()
else:
people.oms_ser = None
oms_num = rec[4]
if oms_num:
people.oms_num = oms_num.strip()
if (people.enp is None) and len(people.oms_num) == 16:
people.enp = people.oms_num
else:
people.oms_num = None
if people.enp: p_enp[people.enp] = people
if people.oms_ser:
oms_sn = people.oms_ser
else:
oms_sn = u""
if people.oms_num:
oms_sn += people.oms_num
if len(oms_sn) > 0: p_oms[oms_sn] = people
dbc.con.commit()
dbc.close()
log.info('GET ALL PEOPLES. Finish {0}'.format(localtime))
log.info('len(p_enp): {0} len(p_oms): {1}'.format(len(p_enp), len(p_oms)))
return p_enp, p_oms
示例4: get_plist
# 需要导入模块: from dbmis_connect2 import DBMIS [as 别名]
# 或者: from dbmis_connect2.DBMIS import close [as 别名]
def get_plist(insorg_id=INSORG_ID, oms_ser=OMS_SER, clinic_id=CLINIC_ID):
import fdb
from dbmis_connect2 import DBMIS
from people import PEOPLE
sout = "database: {0}:{1}".format(HOST, DB)
log.info( sout )
dbc = DBMIS(clinic_id, mis_host = HOST, mis_db = DB)
cname = dbc.name.encode('utf-8')
sout = "clinic_id: {0} clinic_name: {1}".format(clinic_id, cname)
log.info(sout)
# Create new READ ONLY READ COMMITTED transaction
ro_transaction = dbc.con.trans(fdb.ISOLATION_LEVEL_READ_COMMITED_RO)
# and cursor
ro_cur = ro_transaction.cursor()
plist = []
if oms_ser:
if insorg_id != 0:
ro_cur.execute(s_sqlt0, (insorg_id, oms_ser, clinic_id, ))
else:
ro_cur.execute(s_sqlt0, (oms_ser, clinic_id, ))
else:
if insorg_id != 0:
ro_cur.execute(s_sqlt0, (insorg_id, clinic_id, ))
else:
ro_cur.execute(s_sqlt0, (clinic_id,) )
results = ro_cur.fetchall()
for rec in results:
people_id = rec[0]
lname = rec[1]
fname = rec[2]
mname = rec[3]
birthday = rec[4]
p = PEOPLE()
p.people_id = people_id
p.lname = lname.strip()
p.fname = fname.strip()
if mname:
p.mname = mname.strip()
else:
p.mname = None
p.birthday = birthday
plist.append(p)
dbc.close()
return plist
示例5: find_peoples
# 需要导入模块: from dbmis_connect2 import DBMIS [as 别名]
# 或者: from dbmis_connect2.DBMIS import close [as 别名]
def find_peoples(ddd):
sout = "Database: {0}:{1}".format(HOST, DB)
log.info(sout)
dbc = DBMIS(mis_host = HOST, mis_db = DB)
# Create new READ ONLY READ COMMITTED transaction
ro_transaction = dbc.con.trans(fdb.ISOLATION_LEVEL_READ_COMMITED_RO)
# and cursor
ro_cur = ro_transaction.cursor()
nnf = 0 # number of not found peoples
nfd = 0 # number of found duplicated peoples
nna = 0 # number of peoples without area_number
nda = 0 # number of peoples having more than one area number
for d_key in ddd.keys():
d = ddd[d_key]
nfound = set_people_id(ro_cur, d)
if nfound:
ddd[d_key] = d
if nfound > 1: nfd += 1
else:
nnf += 1
continue
nap = set_people_area(ro_cur, d)
if nap:
ddd[d_key] = d
if nap > 1: nda += 1
else:
nna += 1
dbc.close()
sout = "Not found peoples: {0}".format(nnf)
log.info(sout)
sout = "Found duplicates: {0}".format(nfd)
log.info(sout)
sout = "Number of peoples without area_number: {0}".format(nna)
log.info(sout)
sout = "Number of peoples having more than one area number: {0}".format(nda)
log.info(sout)
示例6: get_c_list
# 需要导入模块: from dbmis_connect2 import DBMIS [as 别名]
# 或者: from dbmis_connect2.DBMIS import close [as 别名]
def get_c_list():
clinic_id = CLINIC_ID
dbc = DBMIS(clinic_id, mis_host = HOST, mis_db = DB)
cur = dbc.con.cursor()
cur.execute(SQLT_CLIST)
result = cur.fetchall()
c_arr = []
for rec in result:
clinic_id = rec[0]
c_arr.append(clinic_id)
dbc.close()
return c_arr
示例7: get_uid
# 需要导入模块: from dbmis_connect2 import DBMIS [as 别名]
# 或者: from dbmis_connect2.DBMIS import close [as 别名]
def get_uid(ticket_id):
import fdb
from dbmis_connect2 import DBMIS
dbc = DBMIS(clinic_id = CLINIC_ID, mis_host = HOST, mis_db = DB)
cur = dbc.con.cursor()
dbc.con.begin(fdb.ISOLATION_LEVEL_READ_COMMITED_RO)
cur.execute(SQLT_CNCL, (ticket_id, ))
rec = cur.fetchone()
dbc.con.commit()
if rec is None: return None, None
ms_uid = rec[2]
c_id = rec[1]
dbc.close()
return ms_uid, c_id
示例8: pclinic
# 需要导入模块: from dbmis_connect2 import DBMIS [as 别名]
# 或者: from dbmis_connect2.DBMIS import close [as 别名]
def pclinic(clinic_id, mcod):
from dbmis_connect2 import DBMIS
import time
localtime = time.asctime( time.localtime(time.time()) )
log.info('-----------------------------------------------------------------------------------')
log.info('Insurance Belongings Request Start {0}'.format(localtime))
sout = "Database: {0}:{1}".format(HOST, DB)
log.info(sout)
dbc = DBMIS(clinic_id, mis_host = HOST, mis_db = DB)
if dbc.ogrn == None:
CLINIC_OGRN = u""
else:
CLINIC_OGRN = dbc.ogrn
cogrn = CLINIC_OGRN.encode('utf-8')
cname = dbc.name.encode('utf-8')
if SKIP_OGRN: CLINIC_OGRN = u""
sout = "clinic_id: {0} clinic_name: {1} clinic_ogrn: {2} cod_mo: {3}".format(clinic_id, cname, cogrn, mcod)
log.info(sout)
if DATE_RANGE is None:
s_sqlt = """SELECT DISTINCT * FROM vw_peoples p
JOIN area_peoples ap ON p.people_id = ap.people_id_fk
JOIN areas ar ON ap.area_id_fk = ar.area_id
JOIN clinic_areas ca ON ar.clinic_area_id_fk = ca.clinic_area_id
WHERE ca.clinic_id_fk = {0} AND ca.basic_speciality = 1
AND ap.date_end is Null;"""
s_sql = s_sqlt.format(clinic_id)
sout = "Do not use DATE_RANGE"
log.info(sout)
else:
d_start = DATE_RANGE[0]
d_finish = DATE_RANGE[1]
s_sqlt = """SELECT DISTINCT * FROM vw_peoples p
JOIN area_peoples ap ON p.people_id = ap.people_id_fk
JOIN areas ar ON ap.area_id_fk = ar.area_id
JOIN clinic_areas ca ON ar.clinic_area_id_fk = ca.clinic_area_id
WHERE ca.clinic_id_fk = {0} AND ca.basic_speciality = 1
AND ap.date_beg >= '{1}' AND ap.date_beg <= '{2}'
AND ap.date_end is Null;"""
s_sql = s_sqlt.format(clinic_id, d_start, d_finish)
sout = "date_range: [{0}] - [{1}]".format(d_start, d_finish)
log.info(sout)
cursor = dbc.con.cursor()
cursor.execute(s_sql)
results = cursor.fetchall()
fname = FPATH + "/" + FNAME.format(mcod)
sout = "Output to file: {0}".format(fname)
log.info(sout)
plist(dbc, fname, results, clinic_id)
dbc.close()
localtime = time.asctime( time.localtime(time.time()) )
log.info('Insurance Belongings Request Finish '+localtime)
示例9: pmo
# 需要导入模块: from dbmis_connect2 import DBMIS [as 别名]
# 或者: from dbmis_connect2.DBMIS import close [as 别名]
def pmo(clinic_id):
from dbmis_connect2 import DBMIS
from PatientInfo2 import PatientInfo2
import time
birthplace_set = BIRTHPLACE.encode('cp1251')
localtime = time.asctime( time.localtime(time.time()) )
log.info('------------------------------------------------------------')
log.info('Check documents and birthplace Start {0}'.format(localtime))
p_obj = PatientInfo2()
dbc = DBMIS(clinic_id)
cname = dbc.name.encode('utf-8')
sout = "clinic_id: {0} clinic_name: {1} ".format(clinic_id, cname)
log.info(sout)
ppp = get_plist(dbc, clinic_id)
sout = "Totally {0} lines to be processed".format(len(ppp))
log.info(sout)
ncount = 0
dbc2 = DBMIS(clinic_id)
cur2 = dbc2.con.cursor()
dbmy = DBMY()
set_bplace_number = 0
set_doc_type_number = 0
set_doc_number = 0
for prec in ppp:
ncount += 1
cc_id = prec[0]
people_id = prec[1]
if ncount % STEP == 0:
sout = " {0} people_id: {1}".format(ncount, people_id)
log.info(sout)
p_obj.initFromDb(dbc, people_id)
bplace = p_obj.birthplace
if (bplace is None) or len(bplace) == 0:
s_sqlt = """UPDATE peoples
SET birthplace = '{0}'
WHERE people_id = {1};"""
s_sql = s_sqlt.format(birthplace_set, people_id)
dbc2.con.execute_immediate(s_sql)
dbc2.con.commit()
set_bplace_number += 1
doc_id = p_obj.document_type_id_fk
doc_series = p_obj.document_series
doc_number = p_obj.document_number
if (doc_id is None):
s_sqlt = """UPDATE peoples
SET document_type_id_fk = 14
WHERE people_id = {0};"""
s_sql = s_sqlt.format(people_id)
dbc2.con.execute_immediate(s_sql)
dbc2.con.commit()
set_doc_type_number += 1
if (doc_series is None) or (doc_number is None):
s_sqlt = """UPDATE peoples
SET
document_series = '01 01',
document_number = '111111'
WHERE people_id = {0};"""
s_sql = s_sqlt.format(people_id)
dbc2.con.execute_immediate(s_sql)
dbc2.con.commit()
set_doc_number += 1
sout = "Set birthplace number: {0}".format(set_bplace_number)
log.info(sout)
sout = "Set doc_type number: {0}".format(set_doc_type_number)
log.info(sout)
sout = "Set doc number: {0}".format(set_doc_number)
log.info(sout)
dbc.close()
dbc2.close()
localtime = time.asctime( time.localtime(time.time()) )
log.info('Check documents and birthplace Finish '+localtime)
示例10: pclinic
# 需要导入模块: from dbmis_connect2 import DBMIS [as 别名]
# 或者: from dbmis_connect2.DBMIS import close [as 别名]
def pclinic(fname, clinic_id, mcod):
from dbmis_connect2 import DBMIS
from PatientInfo2 import PatientInfo2
from dbmysql_connect import DBMY
from insorglist import InsorgInfoList
import time
import random
localtime = time.asctime( time.localtime(time.time()) )
log.info('------------------------------------------------------------')
log.info('Insurance Belongings Results Processing Start {0}'.format(localtime))
ppp = plist_in(fname)
sout = "Totally {0} lines have been read from file <{1}>".format(len(ppp), fname)
log.info(sout)
p_obj = PatientInfo2()
insorgs = InsorgInfoList()
dbc = DBMIS(clinic_id)
if dbc.ogrn == None:
CLINIC_OGRN = u""
else:
CLINIC_OGRN = dbc.ogrn
cogrn = CLINIC_OGRN.encode('utf-8')
cname = dbc.name.encode('utf-8')
if SKIP_OGRN: CLINIC_OGRN = u""
sout = "clinic_id: {0} clinic_name: {1} clinic_ogrn: {2} cod_mo: {3}".format(clinic_id, cname, cogrn, mcod)
log.info(sout)
if dbc.clinic_areas == None:
sout = "Clinic has not got any areas"
log.warn(sout)
dbc.close()
return
else:
nareas = len(dbc.clinic_areas)
area_id = dbc.clinic_areas[0][0]
area_nu = dbc.clinic_areas[0][1]
sout = "Clinic has got {0} areas".format(nareas)
log.info(sout)
sout = "Using area_id: {0} area_number: {1}".format(area_id, area_nu)
log.info(sout)
not_belongs_2_clinic = 0
clinic_not_found = 0
no_areas = 0
wrong_insorg = 0
ncount = 0
dbc2 = DBMIS(clinic_id)
cur2 = dbc2.con.cursor()
dbm = DBMY()
curm = dbm.con.cursor()
for prec in ppp:
ncount += 1
people_id = prec[0]
insorg_mcod = prec[2]
if insorg_mcod == "":
insorg_id = 0
else:
insorg_id = int(insorg_mcod) - 22000
medical_insurance_series = prec[4]
medical_insurance_number = prec[5]
s_mcod = prec[7]
if s_mcod == "\r\n": continue
f_mcod = int(s_mcod)
try:
mo = modb[f_mcod]
f_clinic_id = mo.mis_code
except:
clinic_not_found += 1
sout = "People_id: {0}. Clinic was not found for mcod = {1}.".format(people_id, f_mcod)
log.warn(sout)
continue
p_obj.initFromDb(dbc, people_id)
if f_clinic_id <> p_obj.clinic_id:
not_belongs_2_clinic += 1
if SET_MO and (f_mcod in mo_list):
clinic_areas = get_clinic_areas(dbc, f_clinic_id)
if clinic_areas == None:
no_areas += 1
sout = "People_id: {0}. Clinic {1} has not got any areas".format(people_id, f_mcod)
log.warn(sout)
continue
else:
nareas = len(clinic_areas)
if nareas == 0:
no_areas += 1
sout = "Clinic {0} has not got any areas".format(f_clinic_id)
log.warn(sout)
continue
#.........这里部分代码省略.........
示例11: pfile
# 需要导入模块: from dbmis_connect2 import DBMIS [as 别名]
# 或者: from dbmis_connect2.DBMIS import close [as 别名]
def pfile(fname):
from dbmis_connect2 import DBMIS
from dbmysql_connect import DBMY
from PatientInfo2 import PatientInfo2
import time
localtime = time.asctime( time.localtime(time.time()) )
log.info('------------------------------------------------------------')
log.info('DVN List Processing Start {0}'.format(localtime))
ppp = plist_in(fname)
sout = "Totally {0} lines have been read from file <{1}>".format(len(ppp), fname)
log.info(sout)
i1 = fname.find("22M")
if i1 < 0:
sout = "Wrong file name <{0}>".format(fname)
log.warn(sout)
return
s_mcod = fname[i1+3:i1+9]
mcod = int(s_mcod)
try:
mo = modb[mcod]
clinic_id = mo.mis_code
sout = "clinic_id: {0} MO Code: {1}".format(clinic_id, mcod)
log.info(sout)
except:
sout = "Clinic not found for mcod = {0}".format(s_mcod)
log.warn(sout)
return
p_obj = PatientInfo2()
dbc = DBMIS(clinic_id)
if dbc.ogrn == None:
CLINIC_OGRN = u""
else:
CLINIC_OGRN = dbc.ogrn
cogrn = CLINIC_OGRN.encode('utf-8')
cname = dbc.name.encode('utf-8')
if SKIP_OGRN: CLINIC_OGRN = u""
sout = "clinic_id: {0} clinic_name: {1} clinic_ogrn: {2} cod_mo: {3}".format(clinic_id, cname, cogrn, mcod)
log.info(sout)
if dbc.clinic_areas == None:
sout = "Clinic has not got any areas"
log.warn(sout)
dbc.close()
return
else:
nareas = len(dbc.clinic_areas)
area_id = dbc.clinic_areas[0][0]
area_nu = dbc.clinic_areas[0][1]
sout = "Clinic has got {0} areas".format(nareas)
log.info(sout)
sout = "Using area_id: {0} area_number: {1}".format(area_id, area_nu)
log.info(sout)
wrong_clinic = 0
wrong_insorg = 0
ncount = 0
dbc2 = DBMIS(clinic_id)
cur2 = dbc2.con.cursor()
dbmy = DBMY()
dvn_number = 0
for prec in ppp:
ncount += 1
people_id = prec[0]
insorg_mcod = prec[2]
if insorg_mcod == "":
insorg_id = 0
else:
insorg_id = int(insorg_mcod) - 22000
medical_insurance_series = prec[4]
medical_insurance_number = prec[5]
p_obj.initFromDb(dbc, people_id)
s_mcod = prec[7]
if s_mcod == "\r\n": continue
f_mcod = int(s_mcod)
try:
mo = modb[f_mcod]
f_clinic_id = mo.mis_code
except:
sout = "People_id: {0}. Clinic was not found for mcod = {1}.".format(people_id, f_mcod)
log.warn(sout)
continue
if ncount % STEP == 0:
sout = " {0} people_id: {1} clinic_id: {2} dvn_number: {3}".format(ncount, people_id, p_obj.clinic_id, dvn_number)
#.........这里部分代码省略.........
示例12: do_card_n
# 需要导入模块: from dbmis_connect2 import DBMIS [as 别名]
# 或者: from dbmis_connect2.DBMIS import close [as 别名]
def do_card_n(clinic_id = CLINIC_ID):
from dbmis_connect2 import DBMIS
import time
import datetime
dbmy = DBMY()
curm_card = dbmy.con.cursor()
localtime = time.asctime( time.localtime(time.time()) )
log.info('-----------------------------------------------------------------------------------')
log.info('Prof Exam Export Start {0}'.format(localtime))
sout = "Database: {0}:{1}".format(HOST, DB)
log.info(sout)
mcod = modb.moCodeByMisId(clinic_id)
dbc = DBMIS(clinic_id, mis_host = HOST, mis_db = DB)
cname = dbc.name.encode('utf-8')
caddr = dbc.addr_jure.encode('utf-8')
sout = "clinic_id: {0} mcod: {1} clinic_name: {2}".format(clinic_id, mcod, cname)
log.info(sout)
sout = "address: {0}".format(caddr)
log.info(sout)
arr_arr = getC_list(dbc, clinic_id)
nnn = 0
nout_all = 0
for arr in arr_arr:
nnn += 1
c_list = arr
s_nnn = "%03d" % (nnn)
f_fname = FPATH + "/" + FNAME.format(mcod, s_nnn)
fo = open(f_fname, "wb")
sout = """<?xml version="1.0" encoding="UTF-8"?>
<children>"""
fo.write(sout)
iii = 0
nout = 0
for ccc in c_list:
iii += 1
e_id = ccc[0]
p_id = ccc[1]
d_bg = ccc[2]
docTXT = getCard(dbc, e_id, p_id, AGE_MODE)
if len(docTXT) > 0:
fo.write(docTXT)
fo.flush()
os.fsync(fo.fileno())
nout += 1
if REGISTER_CARDS:
dnow = datetime.datetime.now()
sdnow = str(dnow)
try:
curm_card.execute(SQLT_REGISTER_CARD, (e_id, sdnow, ))
except:
pass
sout = '</children>'
fo.write(sout)
fo.close()
sout = "Output to file: {0} {1} cards".format(f_fname, nout)
log.info(sout)
nout_all += nout
dbc.close()
dbmy.close()
sout = "Altogether cards has been written: {0}".format(nout_all)
log.info(sout)
localtime = time.asctime( time.localtime(time.time()) )
log.info('Prof Exam Export Finish '+localtime)
return nout_all
示例13: process_p_list
# 需要导入模块: from dbmis_connect2 import DBMIS [as 别名]
# 或者: from dbmis_connect2.DBMIS import close [as 别名]
def process_p_list(clinic_id, p_list):
from dbmis_connect2 import DBMIS
from dbmysql_connect import DBMY
from PatientInfo2 import PatientInfo2
import time
localtime = time.asctime( time.localtime(time.time()) )
log.info('------------------------------------------------------------')
log.info('DVN List Processing Start {0}'.format(localtime))
ppp = p_list
p_obj = PatientInfo2()
dbc = DBMIS(clinic_id, mis_host = HOST, mis_db = DB)
if dbc.ogrn == None:
CLINIC_OGRN = u""
else:
CLINIC_OGRN = dbc.ogrn
cogrn = CLINIC_OGRN.encode('utf-8')
cname = dbc.name.encode('utf-8')
if SKIP_OGRN: CLINIC_OGRN = u""
if dbc.clinic_areas == None:
sout = "Clinic has not got any areas"
log.warn(sout)
dbc.close()
return
else:
nareas = len(dbc.clinic_areas)
area_id = dbc.clinic_areas[0][0]
area_nu = dbc.clinic_areas[0][1]
sout = "Clinic has got {0} areas".format(nareas)
log.info(sout)
sout = "Using area_id: {0} area_number: {1}".format(area_id, area_nu)
log.info(sout)
wrong_clinic = 0
wrong_insorg = 0
ncount = 0
dbc2 = DBMIS(clinic_id, mis_host = HOST, mis_db = DB)
cur2 = dbc2.con.cursor()
dbmy = DBMY()
dvn_number = 0
for prec in ppp:
ncount += 1
people_id = prec[0]
insorg_id = prec[1]
if insorg_id is None:
insorg_id = 0
p_obj.initFromDb(dbc, people_id)
if ncount % STEP == 0:
sout = " {0} people_id: {1} clinic_id: {2} dvn_number: {3}".format(ncount, people_id, p_obj.clinic_id, dvn_number)
log.info(sout)
# check if person already
# has got a record in the clinical_checkups table
if person_in_cc(dbc, people_id): continue
lname = p_obj.lname
fname = p_obj.fname
mname = p_obj.mname
bd = p_obj.birthday
if check_person(dbc, people_id):
# check if clinical_checkups table
cc_id = add_cc(dbc2, clinic_id, people_id)
register_cc(dbmy, cc_id, people_id, clinic_id)
dvn_number += 1
sout = "DVN cases number: {0}".format(dvn_number)
log.info(sout)
dbc.close()
dbc2.close()
dbmy.close()
localtime = time.asctime( time.localtime(time.time()) )
log.info('DVN List Processing Finish '+localtime)
示例14: do_clinic
# 需要导入模块: from dbmis_connect2 import DBMIS [as 别名]
# 或者: from dbmis_connect2.DBMIS import close [as 别名]
#.........这里部分代码省略.........
row = 3
ws.write(row,0,u'people_id')
ws.write(row,1,u'#')
ws.write(row,2,u'FIO')
ws.write(row,3,u'BD')
ws.write(row,4,u'INSORG_ID')
ws.write(row,5,u'OMS SN')
ws.write(row,6,u'ENP')
ws.write(row,7,u'STAT CODE')
ws.write(row,8,u'LPU COUNT')
row = 5
n_double = 0
n_minus = 0
n_many = 0
n_many_n = 0
n_one_n = 0
for p_mo in mo_ar:
lname = p_mo.lname
fname = p_mo.fname
mname = p_mo.mname
bd = p_mo.birthday
oms_sn = p_mo.oms_sn
enp = p_mo.enp
p_list = get_people(curr, lname, fname, mname, bd)
n_pid = 0
for p_rec in p_list:
n_pid += 1
if n_pid ==2: n_double += 1
p_id = p_rec[0]
fio = p_rec[4]
pc_arr = get_pclinics(cur2, p_id)
l_pc_arr = len(pc_arr)
if (l_pc_arr == 1):
p_clinic = pc_arr[0]
p_clinic_id = p_clinic.clinic_id
if p_clinic_id == clinic_id:
stat_code = 0
else:
stat_code = 7
n_one_n += 1
elif l_pc_arr == 0:
stat_code = -1
else:
stat_code = 9
for p_clinic in pc_arr:
p_clinic_id = p_clinic.clinic_id
if p_clinic_id == clinic_id:
stat_code = 8
continue
else:
area_people_id = p_clinic.area_people_id
if SET_DATE_END:
curw.execute(SQLT_SOFF, (DATE_END, MOTIVE_ATTACH_END_ID, area_people_id, ))
dbc.con.commit()
if stat_code == -1: n_minus += 1
if stat_code == 9: n_many_n += 1
if l_pc_arr > 1: n_many += 1
row += 1
ws.write(row,0,p_id)
ws.write(row,1,n_pid)
ws.write(row,2,fio)
ws.write(row,3,bd)
ws.write(row,5,oms_sn)
ws.write(row,6,enp)
ws.write(row,7,stat_code)
ws.write(row,8,l_pc_arr)
wb.save(f_fname)
nnn = len(mo_ar)
sout = "Totally {0} records have been processed".format(nnn)
log.info(sout)
sout = " {0} peoples have got double (and more) people_id".format(n_double)
log.info(sout)
sout = " {0} peoples have not got MO".format(n_minus)
log.info(sout)
sout = " {0} peoples have got many MO".format(n_many)
log.info(sout)
sout = " {0} peoples have got many MO, but not equal to current MO".format(n_many_n)
log.info(sout)
sout = " {0} peoples have got one MO, but not equal to current MO".format(n_one_n)
log.info(sout)
dbc.close()
localtime = time.asctime( time.localtime(time.time()) )
log.info('------------------------------------------------------------')
log.info('Strike off the Register Procedure Finish {0}'.format(localtime))
示例15:
# 需要导入模块: from dbmis_connect2 import DBMIS [as 别名]
# 或者: from dbmis_connect2.DBMIS import close [as 别名]
if counta % STEP == 0:
sout = "{0} {1}".format(counta, people_id)
log.info( sout )
payment_type = people.p_payment_type_id_fk
if payment_type is not None: continue
p_bd = people.birthday
p_by = p_bd.year
age = y_now - p_by
if (age >= 18) and (age <= 60):
ppt = 1
else:
ppt = 2
curw.execute(s_sqlt1,(ppt, people_id))
conw.commit()
countg += 1
localtime = time.asctime( time.localtime(time.time()) )
log.info('Peoples Check 2 Finish '+localtime)
sout = "Totally {0} records of {1} have updated".format(countg, counta)
log.info( sout )
dbc.close()
dbcw.close()
sys.exit(0)