Arguably, Rev. Dimmesdale's condition is psychosomatic. This means that his physical ailments stem from a very disturbed state of mind, and that the latter manifests in physical symptoms that connect to the situation that he is going through.
In his case, guilt has made him weak to the point of consistent depression. This same guilt has made him self-mutilate by carving a letter "A" on his chest. It would be benighted to ignore the collateral issues that can surface from self-mutilation, namely, infection of the wounds, bleeding out profusely, pain, discomfort, fevers associated to the wounds, and much more.
In addition to this, Dimmesdale's consistent physical and mental pain can result in an overall shutdown of the body. It is no surprise that the man could nearly point out the minute he would die. He was already dying slowly for the seven years that he kept the secret of his sins.
Chillingworth was able to tell as much. It is he who decides that Dimmesdale has somewhat of an "animal" nature, "saintly" as he may be. He also points to Dimmesdale about the sins of the soul and how they attack the body as disease.
Thus, a sickness,” continued Roger Chillingworth [..]confronting the emaciated and white-cheeked minister, with his low, dark, and misshapen figure,—“a sickness, a sore place, if we may so call it, in your spirit, hath immediately its appropriate manifestation in your bodily frame”
We know that Dimmesdale was emaciated, depressed, in pain, looking melancholy, and with every sign of illness in his body. The reason for all of this was his secret. If he did not have anything to hide, or had not been with Hester in the first place, he would have remained the "young divine" that everyone loved so much. Therefore, it is safe to argue that his illness was, indeed, psychosomatic.