gilclei/search-cns

一个用于查询SUS用户数据的DATASUS数据库的库的项目

0.10.0 2022-09-10 15:42 UTC

This package is not auto-updated.

Last update: 2024-09-22 01:26:24 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License Size Size

Search-CNS

一个用于查询SUS用户数据的DATASUS数据库的库的项目

必需

PHP Version Require

参考文献

互操作性 - 服务目录 - DATASUS.

安装

使用composer来管理依赖关系并下载search-cns

composer require gilclei/search-cns

示例

<?php

require_once "vendor/autoload.php";

use Gilclei\SearchCns\CNS;


$userName = 'CADSUS.CNS.PDQ.PUBLICO';
$password = 'kUXNmiiii#RDdlOELdoe00966';
$cnes = '6963447';
$usuario = 'LEONARDO';
$service = 'https://servicoshm.saude.gov.br/cadsus/CadsusService/v5r0?wsdl';


$cpf = '66105234368';
try{
    $consulta = CNS::searchByCpf($cpf, $userName, $password, $cnes, $usuario, $service);
    echo json_encode($consulta, JSON_PRETTY_PRINT);
}catch (\Exception $e){
    echo $e->getMessage();
}

$cns = '703404696479515';
try{
    $consulta = CNS::searchByCns($cns, $userName, $password, $cnes, $usuario, $service);
    echo json_encode($consulta, JSON_PRETTY_PRINT);
}catch (\Exception $e){
    echo $e->getMessage();
}

$nome = "SERGIO ARAUJO CORREIA LIMA";
$dataNascimento =  "1981-11-10";
$nomeMae = "LINDYNALVA SOARES ARAUJO CORREIA LIMA";
try{
    $consulta = CNS::searchByName($nome, $nomeMae, $dataNascimento, $userName, $password, $cnes, $usuario, $service);
    echo json_encode($consulta, JSON_PRETTY_PRINT);
}catch (\Exception $e){
    echo $e->getMessage();
}

?>
php exemple.php
vendor/bin/phpunit tests/