Enhancing Medical Dialogue Generation through Knowledge Refinement and Dynamic Prompt Adjustment