YUÁN Tiāngāng 袁天罡 = a magician, friendly to fishermen
A Dragon King, defender of fish
Lǐ Shìmín 李世民 = a Táng 唐 dynasty emperor
WÈI Zhēng 魏征 (= 魏徵) = his prime minister
QÍN Shūbǎo 秦叔宝 = a general in his service
YÙCHÍ Jìngdé 尉迟敬德 = another one
Although sometimes confused with the door gods of private houses, the door gods on temples are generals named QÍN Shūbǎo 秦叔宝 and YÙCHÍ Jìngdé 尉迟敬德 (or YÙCHÍ Gōng 尉迟恭). They served under LǏ Shìmín 李世民, known to history as the Great Ancestor (Tàizōng 太宗) of the Táng dynasty 唐朝 (reign 12a-2, AD 618-626).
Their story begins under the waters of a river. It is said that one day one of the police fish reported back to the dragon king who ruled the river that a certain magician and fortune teller by the name of YUÁN Tiāngāng 袁天罡 had discovered where schools of fish were to be found, and was helping the fishermen to have so much success that it threatened the stability of life in the river.
Although his initial instinct was simply to have the magician killed, the dragon king decided to find out whether the fortune teller could perhaps be put to some better use, so he changed into human form and approached him, offering great rewards if the fortune teller could predict the rain accurately, but punishment if he could not.
Now since the rain is controlled by the dragon kings of the world, the dragon king felt confident that he could discredit any but the very best fortune teller, since he was, after all, one of the dragon kings.
Fortune Teller Yuán made a very precise prediction, and the dragon king was ready to make sure it would not come true. But just then a message arrived from the Jade Emperor requiring an amount and timing of rain precisely as the fortune teller had anticipated. The dragon king was aghast. Figuring that the Jade emperor would not notice, however, he changed the amount and timing from what was given in the imperial decree, and then went back to confront the fortune teller.
Calmly, Fortune Teller Yuán informed him that because he had violated the imperial decree, he would be arrested, and he told him when. He also told the dragon king that he had known his identity all along.
Defeated, the dragon king threw himself on Yuán’s mercy. Moved, and possibly paid, Yuán foretold that the arrest was to be made by WÈI Zhēng 魏征, the prime minister of Lǐ Shìmín 李世民, the emperor. But Fortune teller Yuán told the dragon king that if he could keep the prime minister otherwise occupied, perhaps he could avoid arrest.
And so, acting on the fortune teller’s suggestion, the dragon king appeared to Lǐ Shìmín in a dream and ordered him to keep Prime Minister Wèi busy playing chess at that hour.
As they were playing chess, the elderly prime minister suddenly fell asleep, much to Lǐ Shìmín’s amusement. Lǐ reflected that it certainly made it easier to obey the dragon king’s command to keep the Prime Minister Wèi busy if this venerable gentleman was gently dozing in his chair.
What Lǐ did not know was that the prime minister was dreaming that he was arresting the dragon king of the river!
The spirit of the defeated dragon king returned night after night to haunt Lǐ Shìmín, reprimanding him for failing to keep Prime Minister Wèi engaged, as he had been ordered to do. These visits were so unpleasant that the mighty Táng emperor could get no rest. Finally in desperation, Lǐ stationed two guards outside the door of his bed chamber. This worked, and he rested well, but he hated to occupy mighty generals simply to stand outside the door resisting a ghostly visitor that only he himself could see, so he had their portraits painted on the door instead, which seemed to work just as well.
And thus it is that the portraits of Qín Shūbǎo and Yùchí Jìngdé are to be found painted or carved on the doors of temples and yamens (and occasionally houses) to this day.
(Unfortunately, the emperor’s condition continued to deteriorate, and his concern about what he felt was his impending death led to a famous visit to the kings of the underworld, but that is a different story.)