Internal forward link with add_rewrite_rule

The code below should work for you as long as:

  1. Your CPT slug is location.
  2. You don’t have a custom query_var registered for your CPT location. You probably don’t have. Refer to https://codex.wordpress.org/Function_Reference/register_post_type#query_var for more information, it’s very usefull, btw.

And I’m assuming the string nyc is the slug of your single custom post.

function rewrite_medical_url() {
    add_rewrite_rule( '^medical/[^/]+/([^/]+)/?', 'index.php?location=$matches[1]', 'top' );
}

add_action( 'init', 'rewrite_medical_url' );

Put the code in your functions.php file.

In order for the rewrite rule start taking effect you should visit Settings > Permalinks to flush your permalinks.