This should be interesting but I don’t think it will fly.
If he had said for example that he had just flunked biology, and wanted to kill his biology professor, that would require the doctor to warn the professor and notify the authorities and notify the patient that she was doing so.
Things like this mass shooting are unpredictable at this stage in our knowledge and the false positives are way to high to begin restraining people for what most of the time is an idle expression of anger or resentment.