So the problem is the left join between A and B. I assume you cannot create the index suggested by query engine. What about using table variable to store the result of the sub-query and have the index there? You can then use that table in your CTE. Following pseudo-code should give you the idea:
DECLARE @tmp TABLE
(
MRN ???, VISIT_DATE ???, visit_id ???, PRIMARY KEY(MRN, VISIT_DATE)
)
INSERT INTO @tmp
SELECT MED_REC_NO AS MRN, vst_start_dtime AS VISIT_DATE, PT_NO AS VISIT_ID
FROM smsdss.BMH_PLM_PtAcct_V
WHERE
((
Plm_Pt_Acct_Type = 'I'
AND Adm_Source NOT IN
(
'RP'
)
)
OR pt_type = 'E')
AND vst_start_dtime >= @SD
AND vst_start_dtime < @ED
;WITH ERCNT AS (
SELECT A.MRN
, A.VISIT_ID
, A.VISIT_DATE
, COUNT(B.VISIT_ID) AS VISIT_COUNT
FROM @tmp A
LEFT JOIN @tmp B
ON A.MRN = B.MRN
AND A.VISIT_DATE > B.VISIT_DATE
GROUP BY A.MRN, A.VISIT_ID, A.VISIT_DATE
)