当前位置: 首页>>代码示例>>Python>>正文


Python DBMIS.get_p_ids方法代码示例

本文整理汇总了Python中dbmis_connect2.DBMIS.get_p_ids方法的典型用法代码示例。如果您正苦于以下问题:Python DBMIS.get_p_ids方法的具体用法?Python DBMIS.get_p_ids怎么用?Python DBMIS.get_p_ids使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dbmis_connect2.DBMIS的用法示例。


在下文中一共展示了DBMIS.get_p_ids方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: pfile

# 需要导入模块: from dbmis_connect2 import DBMIS [as 别名]
# 或者: from dbmis_connect2.DBMIS import get_p_ids [as 别名]

#.........这里部分代码省略.........
    
    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)
            log.info(sout)

        if f_clinic_id <> p_obj.clinic_id:
            wrong_clinic += 1
            continue
	
	lname = p_obj.lname
	fname = p_obj.fname
	mname = p_obj.mname
	bd    = p_obj.birthday
	
	p_ids = dbc.get_p_ids(lname, fname, mname, bd)
	

	# check if person already 
	# has got a record in the clinical_checkups table
	
        l_exit = False
	for p_id in p_ids:
	    if person_in_cc(dbc, people_id):
		l_exit = True
		break
	    
	if l_exit: continue

        if check_person(dbc, people_id):

            # check if clinical_checkups table 
            
            cc_id = add_cc(dbc2, f_clinic_id, people_id)
	    
	    d_s = p_obj.document_series
	    d_n = p_obj.document_number
	    if (d_s is None) or (d_n is None): set_document(dbc2, people_id)
	    
            
            register_cc(dbmy, cc_id, people_id, f_clinic_id)
            
            dvn_number += 1


    sout = "Wrong clinic: {0}".format(wrong_clinic)
    log.info(sout)
    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)
开发者ID:sanluck,项目名称:MIS,代码行数:104,代码来源:dvn-f1.py

示例2: pclinic

# 需要导入模块: from dbmis_connect2 import DBMIS [as 别名]
# 或者: from dbmis_connect2.DBMIS import get_p_ids [as 别名]

#.........这里部分代码省略.........
            log.info(sout)
	
	
	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


	lname   = p_obj.lname
	fname   = p_obj.fname
	mname   = p_obj.mname
	bd      = p_obj.birthday
	
	p_ids = dbc.get_p_ids(lname, fname, mname, bd)
	
	if len(p_ids) > 1:
	    for p_id in p_ids:
		if p_id == people_id: continue
		cc_plist = get_cc_plist(dbc, p_id)
		for cc_id_d in cc_plist:
		    
		    cc_id_d_number += 1

		    s_sqlt = """DELETE FROM
		    clinical_checkup_results
		    WHERE clinical_checkup_id_fk = {0};"""
		    s_sql = s_sqlt.format(cc_id_d)
		    try:
			dbc2.con.execute_immediate(s_sql)
			dbc2.con.commit()
		    except:
			sout = "Delete from clinical_checkup_results error. cc_id: {0}".format(cc_id_d)
			log.warn( sout )
		    
		    s_sqlt = """DELETE FROM
		    clinical_checkups
		    WHERE clinical_checkup_id = {0};"""
		    s_sql = s_sqlt.format(cc_id_d)
		    try:
			dbc2.con.execute_immediate(s_sql)
			dbc2.con.commit()
		    except:
			sout = "Delete from clinical_checkups error. cc_id: {0}".format(cc_id_d)
			log.warn( sout )


    sout = "Deleted clinical checkups number: {0}".format(cc_id_d_number)
    log.info(sout)

    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()
    dbmy.close()
    localtime = time.asctime( time.localtime(time.time()) )
    log.info('Check for double patient Finish  '+localtime)
开发者ID:sanluck,项目名称:MIS,代码行数:104,代码来源:dvn-f3.py


注:本文中的dbmis_connect2.DBMIS.get_p_ids方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。