我正在申请医生,我有两张桌子,一张患者餐桌和一对多关系的咨询表,当我创建一个网络服务时,我创建了两个网络服务,一个用于患者,一个用于咨询但是在ios应用程序中有一些复杂功能 我需要的是只创建一个带有嵌套对象的Web服务,这意味着每个患者都会在webb服务中的数组中进行咨询== 请有人帮帮我吗
这是患者网络服务:
<?php
header('Content-Type: application/json; charset=utf-8');
include('settings.php');
mysql_connect($host,$user,$password);
mysql_select_db($base);
mysql_query('SET CHARACTER SET utf8');
$req = "select * from patient";
$sql=mysql_query($req);
$nn=mysql_num_rows($sql);
$items = array("items" => NULL);
while ($data=mysql_fetch_array($sql))
{
$items["items"][] = array(
"id_patient" => $data['id_patient'],
"nom" => $data['nom'],
"prenom" => $data['prenom'],
"Sexe" => $data['Sexe'],
"date_de_naissance" => $data['date_de_naissance'],
"lieu_de_naissance" => $data['lieu_de_naissance'],
"adresse" =>$data['adresse'],
"latitude" => $data['latitude'],
"longitude" => $data['longitude'],
"telephone" => $data['telephone'],
"email" => $data['email'],
"situation_familiale" => $data['situation_familiale'],
"profession" => $data['profession'],
"numero_securite_sociale" => $data['numero_securite_sociale'],
"taille" => $data['taille'],
"poids" => $data['poids'],
"situation_familiale" => $data['situation_familiale'],
"groupe_sanguin" => $data['groupe_sanguin'],
"allergies" =>$data['allergies'],
"antecedents_chirurgicaux" => $data['antecedents_chirurgicaux'],
"antecedents_medicaux" => $data['antecedents_medicaux'],
"antecedents_familiaux" => $data['antecedents_familiaux'],
);
}
echo json_encode($items,JSON_UNESCAPED_UNICODE);
?>
这是咨询网络服务
<?php
header('Content-Type: application/json; charset=utf-8');
include('settings.php');
mysql_connect($host,$user,$password);
mysql_select_db($base);
mysql_query('SET CHARACTER SET utf8');
$patient = (int) $_GET['patient'];
//where id_patient= '".$patient."'
$req = "select * from consultation ";
$sql=mysql_query($req);
$nn=mysql_num_rows($sql);
$items = array("items" => array());
while ($data=mysql_fetch_array($sql))
{
$item = array(
"id_consultation" => $data['id_consultation'],
"id_patient" => $data['id_patient'],
"date_consultation" => $data['date_consultation'],
"motif_consultation" => $data['motif_consultation'],
"taille" => $data['taille'],
"poids" => $data['poids'],
"tension_arterielle" => $data['tension_arterielle'],
"pouls" => $data['pouls'],
"temperature" => $data['temperature'],
"observation" => $data['observation'],
"ordonnance" => $data['ordonnance']
);
array_push($items['items'], $item);
}
echo json_encode($items,JSON_UNESCAPED_UNICODE);
?>