From dd2d2ec09a0b6d9a602cea5f7c5caf41b0396286 Mon Sep 17 00:00:00 2001
From: Tomas <tomasysh@gmail.com>
Date: 星期一, 31 七月 2023 08:26:27 +0800
Subject: [PATCH] Merge branch '2023_CR2' of https://dev.pollex.com.tw:8443/r/pcalife/PAM into 2023_CR2

---
 pamapi/src/doc/sql/20230727_j.sql |   38 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 37 insertions(+), 1 deletions(-)

diff --git a/pamapi/src/doc/sql/20230727_j.sql b/pamapi/src/doc/sql/20230727_j.sql
index 1f842ad..014c1b6 100644
--- a/pamapi/src/doc/sql/20230727_j.sql
+++ b/pamapi/src/doc/sql/20230727_j.sql
@@ -23,4 +23,40 @@
     c.name,
     a.consultation_method
    FROM appointment a
-     LEFT JOIN customer c ON a.customer_id = c.id;
\ No newline at end of file
+     LEFT JOIN customer c ON a.customer_id = c.id;
+     
+     
+     
+     
+-- public.appointment_customer_consultant_view source
+
+-- public.appointment_customer_consultant_view source
+
+CREATE OR REPLACE VIEW omo.appointment_customer_consultant_view
+AS SELECT appointment.id AS appointment_id,
+    appointment.phone,
+    appointment.email,
+    appointment.contact_type,
+    appointment.gender,
+    appointment.age,
+    appointment.job,
+    appointment.requirement,
+    appointment.communicate_status,
+    appointment.hope_contact_time,
+    appointment.other_requirement,
+    appointment.appointment_date,
+    appointment.last_modified_date,
+    appointment.agent_no,
+    appointment.consultant_view_time,
+    appointment.consultant_read_time,
+    appointment.contact_time,
+    appointment.status,
+    consultant.name AS consultant_name,
+    consultant.phone_number AS consultant_phone_number,
+    consultant.email AS consultant_email,
+    consultant.role AS consultant_role,
+    customer.name AS customer_name,
+    appointment.consultation_method as consultation_method
+   FROM appointment
+     LEFT JOIN consultant ON appointment.agent_no::text = consultant.agent_no::text
+     LEFT JOIN customer ON appointment.customer_id = customer.id;
\ No newline at end of file

--
Gitblit v1.8.0