ss_gw.php: add clinic-diagnose cmd (T_OrderHeaderNote per clinic order)
- start_date/end_date default to today, ids optional intersect - service <> 1 filter via EXISTS on t_orderdetail/t_testgroup
This commit is contained in:
38
ss_gw.php
38
ss_gw.php
@@ -118,6 +118,44 @@ if ($p["cmd"] == "clinic-service_req") {
|
|||||||
$dbh->jsonReply($resp, $dbh->info());
|
$dbh->jsonReply($resp, $dbh->info());
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
if ($p["cmd"] == "clinic-diagnose") {
|
||||||
|
$resp = $dbh->connect();
|
||||||
|
$dbh->exit_if_error($resp[0], $resp[1]);
|
||||||
|
$ids = isset($p["ids"]) ? implode(",", $p["ids"]) : "";
|
||||||
|
$start_date = isset($p["start_date"]) ? $p["start_date"] : "";
|
||||||
|
$end_date = isset($p["end_date"]) ? $p["end_date"] : "";
|
||||||
|
if ($start_date == "") {
|
||||||
|
$start_date = date("Y-m-d");
|
||||||
|
}
|
||||||
|
if ($end_date == "") {
|
||||||
|
$end_date = $start_date;
|
||||||
|
}
|
||||||
|
$params = [$start_date . " 00:00:00", $end_date . " 23:59:59"];
|
||||||
|
$where_ids = "";
|
||||||
|
if ($ids != "") {
|
||||||
|
$where_ids = " and T_OrderHeaderID in ($ids) ";
|
||||||
|
}
|
||||||
|
$sql = "select
|
||||||
|
T_OrderHeaderID,
|
||||||
|
T_OrderHeaderNote,
|
||||||
|
T_OrderHeaderDate
|
||||||
|
from t_orderheader
|
||||||
|
where T_OrderHeaderIsActive = 'Y'
|
||||||
|
and T_OrderHeaderDate >= ? and T_OrderHeaderDate <= ?
|
||||||
|
$where_ids
|
||||||
|
and exists (select 1
|
||||||
|
from t_orderdetail d
|
||||||
|
join t_test tt on d.T_OrderDetailT_TestID = tt.T_TestID
|
||||||
|
and tt.T_TestIsActive = 'Y'
|
||||||
|
join t_testgroup g on tt.T_TestT_TestGroupID = g.T_TestGroupID
|
||||||
|
and g.T_TestGroupT_ServiceID <> 1 and g.T_TestGroupIsActive = 'Y'
|
||||||
|
where d.T_OrderDetailT_OrderHeaderID = T_OrderHeaderID
|
||||||
|
and d.T_OrderDetailIsActive = 'Y')";
|
||||||
|
$resp = $dbh->query($sql, $params);
|
||||||
|
$dbh->exit_if_error($resp[0], $resp[1]);
|
||||||
|
$dbh->jsonReply($resp, $dbh->info());
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
if ($p["cmd"] == "clinic-encounter") {
|
if ($p["cmd"] == "clinic-encounter") {
|
||||||
$resp = $dbh->connect();
|
$resp = $dbh->connect();
|
||||||
|
|||||||
Reference in New Issue
Block a user