123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- import Common
- from LocalModel import BaZi
- def check_jiankang(bazi: BaZi):
- __check_shui_ruo_tu_wang(bazi)
- __check_jinshuiruo_fengshishang(bazi)
- __check_gaoneng(bazi)
- def __check_shui_ruo_tu_wang(bazi: BaZi):
- key = "水弱土旺"
- p1 = bazi.getPowerOfWuXing("水")
- p2 = bazi.getPowerOfWuXing("土")
- if p1 < p2:
- tip = "女命输卵管容易堵塞;男命容易精子存活率低。"
- key += "(" + str(p1) + "," + str(p2) + ")"
- bazi.jiankang[key] = tip
- def __check_jinshuiruo_fengshishang(bazi: BaZi):
- key = "金水弱且落于食伤"
- s1 = bazi.getWuXingState("金")
- s2 = bazi.getWuXingState("水")
- lst1 = bazi.getShiShensByWuXing("金")
- lst2 = bazi.getShiShensByWuXing("水")
- trigger = False
- if s1 == "衰" and s2 == "衰":
- if "食" in lst1:
- trigger = True
- elif "食" in lst2:
- trigger = True
- if trigger is True:
- tip = "不易生育"
- bazi.jiankang[key] = tip
- def __check_gaoneng(bazi: BaZi):
- __check_gaoneng_by_args("午", "丑", "穿", "容易糖尿病", bazi)
- __check_gaoneng_by_args("申", "亥", "穿", "容易消化道不好,容易吃安眠药或服毒", bazi)
- __check_gaoneng_by_args("申", "寅", "冲", "肝胆肠容易有急症", bazi)
- __check_gaoneng_by_args("甲", "庚", "冲", "容易破相、外伤", bazi)
- __check_gaoneng_by_args("巳", "亥", "冲", "容易患癌症", bazi)
- __check_gaoneng_by_args("卯", "辰", "穿", "容易出现脾胃伤、肠胃穿孔", bazi)
- __check_gaoneng_by_args("酉", "戌", "穿", "容易出现脾胃伤、肠胃穿孔", bazi)
- __check_gaoneng_and_shang("子", "未", "穿", "未", "牙齿容易不好(上火等)", bazi, "(丁火伤)")
- __check_gaoneng_and_shang("午", "丑", "穿", "午", "牙齿容易不好(上火等)", bazi, "(丁火伤)")
- __check_gaoneng_and_power("辰", "戌", "冲", "癸", "丁", "牙齿容易不好(上火等)", bazi, "(丁火伤)")
- __check_gaoneng_and_power("丑", "未", "冲", "癸", "丁", "牙齿容易不好(上火等)", bazi, "(丁火伤)")
- __check_tiangan_and_dizhi_by_wuxing("木", "土", "木克土", "皮肤容易不好", bazi)
- __check_gaoneng_by_args("申", "卯", "暗合", "自缢之相", bazi)
- __check_shishen_and_text("枭", "酉", "酉金为枭", "容易跳楼、自杀、自残", bazi)
- __check_shishen_and_wuxing("枭", "火", "火为枭", "容易卧轨、烧炭、自焚、坠崖", bazi)
- __check_riyuan_jian_zhu("庚", "壬", "戌", "庚金日元见壬戌", "容易煤炭、煤气自杀", bazi)
- __check_shishen_and_text("枭", "壬", "壬水为枭", "容易投河、跳海", bazi)
- def __check_gaoneng_by_args(arg1: str, arg2: str, guanxi: str, tip: str, bazi: BaZi):
- key = arg1 + arg2 + guanxi
- lst = bazi.findGaoNengByArgs(arg1, arg2, guanxi)
- if len(lst) > 0:
- bazi.jiankang[key] = tip
- # 检查高能关系,并且指定弱势方
- def __check_gaoneng_and_shang(arg1: str, arg2: str, guanxi: str, shang: str, tip: str, bazi: BaZi,
- additionKey: str = ""):
- key = arg1 + arg2 + guanxi + additionKey
- lst = bazi.findGaoNengByArgs(arg1, arg2, guanxi)
- trigger = False
- if len(lst) > 0:
- p1 = lst[0].power1
- p2 = lst[0].power2
- if p1 > p2 and lst[0].arg2 == shang:
- trigger = True
- if p1 < p2 and lst[0].arg1 == shang:
- trigger = True
- if trigger is True:
- bazi.jiankang[key] = tip
- # 比如辰戌冲,对比藏干中癸水和丁火的力量对比,如果强弱符合条件则触发
- def __check_gaoneng_and_power(arg1: str, arg2: str, guanxi: str, qiangText: str, ruoText: str, tip: str, bazi: BaZi,
- additionKey: str = ""):
- key = arg1 + arg2 + guanxi + additionKey
- lst = bazi.findGaoNengByArgs(arg1, arg2, guanxi)
- trigger = False
- if len(lst) > 0:
- ss1 = Common.get_shishen(qiangText, bazi.riGan.text)
- ss2 = Common.get_shishen(ruoText, bazi.riGan.text)
- p1 = bazi.getPowerOfShiShen(ss1)
- p2 = bazi.getPowerOfShiShen(ss2)
- if p1 > p2:
- trigger = True
- if trigger is True:
- bazi.jiankang[key] = tip
- def __check_tiangan_and_dizhi_by_wuxing(tianganWuXing: str, dizhiWuXing: str, key: str, tip: str, bazi: BaZi):
- trigger = False
- if bazi.nianGan.wuXing == tianganWuXing and bazi.nianZhi.wuXing == dizhiWuXing:
- trigger = True
- elif bazi.yueGan.wuXing == tianganWuXing and bazi.yueZhi.wuXing == dizhiWuXing:
- trigger = True
- elif bazi.riGan.wuXing == tianganWuXing and bazi.riZhi.wuXing == dizhiWuXing:
- trigger = True
- elif bazi.shiGan.wuXing == tianganWuXing and bazi.shiZhi.wuXing == dizhiWuXing:
- trigger = True
- if trigger is True:
- bazi.jiankang[key] = tip
- def __check_shishen_and_text(shishen: str, text: str, key: str, tip: str, bazi: BaZi):
- ss = Common.get_shishen(text, bazi.riGan.text)
- if ss == shishen:
- bazi.jiankang[key] = tip
- def __check_shishen_and_wuxing(shishen: str, wuxing: str, key: str, tip: str, bazi: BaZi):
- if bazi.guanxiInfo.shishen.keys().__contains__(wuxing):
- lst = bazi.guanxiInfo.shishen.get(wuxing)
- if shishen in lst:
- bazi.jiankang[key] = tip
- def __check_riyuan_jian_zhu(riyuan: str, jianTianGan: str, jianDiZhi: str, key: str, tip: str, bazi: BaZi):
- if bazi.riGan.text == riyuan:
- lst = bazi.findTianGanDiZhiInZhu(jianTianGan, jianDiZhi)
- if len(lst) > 0:
- bazi.jiankang[key] = tip
|