def new(): enc_type = gmCfgDB.get4user( option='encounter.default_type', workplace=gmPraxis.gmCurrentPraxisBranch().active_workplace) if enc_type is None: enc_type = gmEMRStructItems.get_most_commonly_used_encounter_type() if enc_type is None: enc_type = 'in surgery' enc = gmEMRStructItems.create_encounter(fk_patient=patient.ID, enc_type=enc_type) saved = edit_encounter(parent=parent, encounter=enc) if saved: return True gmEMRStructItems.delete_encounter(pk_encounter=enc['pk_encounter']) return False
def new(): cfg_db = gmCfg.cCfgSQL() enc_type = cfg_db.get2 ( option = u'encounter.default_type', workplace = gmPraxis.gmCurrentPraxisBranch().active_workplace, bias = u'user' ) if enc_type is None: enc_type = gmEMRStructItems.get_most_commonly_used_encounter_type() if enc_type is None: enc_type = u'in surgery' enc = gmEMRStructItems.create_encounter(fk_patient = patient.ID, enc_type = enc_type) saved = edit_encounter(parent = parent, encounter = enc) if saved: return True gmEMRStructItems.delete_encounter(pk_encounter = enc['pk_encounter']) return False
def _decide_on_active_encounter(pk_identity): enc = _get_very_recent_encounter(pk_identity) if enc is not None: return enc _here = gmPraxis.gmCurrentPraxisBranch() cfg_db = gmCfg.cCfgSQL() enc_type = cfg_db.get2 ( option = u'encounter.default_type', workplace = _here.active_workplace, bias = u'user' ) if enc_type is None: enc_type = gmEMRStructItems.get_most_commonly_used_encounter_type() if enc_type is None: enc_type = u'in surgery' enc = gmEMRStructItems.create_encounter(fk_patient = pk_identity, enc_type = enc_type) enc['pk_org_unit'] = _here['pk_org_unit'] enc.save() _log.debug('new encounter [%s] initiated' % enc['pk_encounter']) return enc