fix(onec): preserve patient instructions in Bitrix leads
Some checks failed
Deploy Dana Medical Site / deploy (push) Failing after 1s
Some checks failed
Deploy Dana Medical Site / deploy (push) Failing after 1s
This commit is contained in:
parent
25ddf86ac4
commit
7ac18ec61d
@ -354,6 +354,9 @@ func leadDraft(it storage.ConfirmItem, cfg storage.BookingSettings) bitrix.LeadD
|
|||||||
"Приём: " + formatSlotTime(it.Start),
|
"Приём: " + formatSlotTime(it.Start),
|
||||||
"Филиал: " + html.EscapeString(branchOrDash(it.Branch)),
|
"Филиал: " + html.EscapeString(branchOrDash(it.Branch)),
|
||||||
}
|
}
|
||||||
|
if it.Comment != "" {
|
||||||
|
lines = append(lines, "Комментарий пациента: "+html.EscapeString(it.Comment))
|
||||||
|
}
|
||||||
if it.ServiceName != "" {
|
if it.ServiceName != "" {
|
||||||
lines = append(lines, "Услуга: "+html.EscapeString(it.ServiceName))
|
lines = append(lines, "Услуга: "+html.EscapeString(it.ServiceName))
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,6 +52,7 @@ func (s *Storage) SetBookingSettings(ctx context.Context, b BookingSettings) err
|
|||||||
|
|
||||||
// ConfirmItem — запись с сайта, ждущая решения оператора, со всем, что нужно для лида в Битриксе и CRM.
|
// ConfirmItem — запись с сайта, ждущая решения оператора, со всем, что нужно для лида в Битриксе и CRM.
|
||||||
type ConfirmItem struct {
|
type ConfirmItem struct {
|
||||||
|
Comment string
|
||||||
ID int64
|
ID int64
|
||||||
Start time.Time
|
Start time.Time
|
||||||
CreatedAt time.Time
|
CreatedAt time.Time
|
||||||
@ -73,7 +74,7 @@ const confirmItemSelect = `
|
|||||||
SELECT a.id, a.start_at, a.created_at, a.patient_name, a.patient_phone, a.doctor_onec_id,
|
SELECT a.id, a.start_at, a.created_at, a.patient_name, a.patient_phone, a.doctor_onec_id,
|
||||||
COALESCE(NULLIF(o.full_name, ''), a.doctor_onec_id), COALESCE(NULLIF(b.address, ''), b.name, ''),
|
COALESCE(NULLIF(o.full_name, ''), a.doctor_onec_id), COALESCE(NULLIF(b.address, ''), b.name, ''),
|
||||||
COALESCE(sv.name, ''), a.onec_appointment_id, a.bitrix_lead_id, a.error,
|
COALESCE(sv.name, ''), a.onec_appointment_id, a.bitrix_lead_id, a.error,
|
||||||
a.crm_deal_id, a.crm_confirm_state, a.crm_error
|
a.crm_deal_id, a.crm_confirm_state, a.crm_error, a.patient_comment
|
||||||
FROM onec_appointments a
|
FROM onec_appointments a
|
||||||
LEFT JOIN onec_doctors o ON o.onec_id = a.doctor_onec_id
|
LEFT JOIN onec_doctors o ON o.onec_id = a.doctor_onec_id
|
||||||
LEFT JOIN onec_branches b ON b.onec_id = a.branch_onec_id
|
LEFT JOIN onec_branches b ON b.onec_id = a.branch_onec_id
|
||||||
@ -133,7 +134,7 @@ func (s *Storage) confirmItems(ctx context.Context, query string, limit int) ([]
|
|||||||
var c ConfirmItem
|
var c ConfirmItem
|
||||||
if err := rows.Scan(&c.ID, &c.Start, &c.CreatedAt, &c.Patient, &c.Phone, &c.DoctorOnec, &c.DoctorName,
|
if err := rows.Scan(&c.ID, &c.Start, &c.CreatedAt, &c.Patient, &c.Phone, &c.DoctorOnec, &c.DoctorName,
|
||||||
&c.Branch, &c.ServiceName, &c.OnecID, &c.BitrixLeadID, &c.Error,
|
&c.Branch, &c.ServiceName, &c.OnecID, &c.BitrixLeadID, &c.Error,
|
||||||
&c.CrmDealID, &c.CrmConfirmState, &c.CrmError); err != nil {
|
&c.CrmDealID, &c.CrmConfirmState, &c.CrmError, &c.Comment); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
out = append(out, c)
|
out = append(out, c)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user