Browse Source

Merge branch 'master' of http://git.shengws.com/csx/gdyb

csx 3 years ago
parent
commit
5729f05838
2 changed files with 67 additions and 9 deletions
  1. 66 9
      controllers/zh/zh_his_api_controller.go
  2. 1 0
      models/zh_his_models.go

+ 66 - 9
controllers/zh/zh_his_api_controller.go View File

@@ -670,6 +670,60 @@ func (c *ZHHisApiController) GetZHInHospitalCheck() {
670 670
 
671 671
 	}
672 672
 
673
+	//InsuplcAdmdvs = res2.Output.
674
+
675
+	Iinfos, _ := json.Marshal(res2.Output.Iinfo)
676
+	infoStr := string(Iinfos)
677
+
678
+	var rf []*ResultFive
679
+	json.Unmarshal([]byte(infoStr), &rf)
680
+	var insutypes []*ResultFive
681
+	var insutype string
682
+	var insuplc_admdvs string
683
+	var is390 int = 0
684
+	var is310 int = 0
685
+
686
+	for _, item := range rf {
687
+		if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
688
+			insutypes = append(insutypes, item)
689
+		}
690
+	}
691
+
692
+	if len(insutypes) == 1 {
693
+		insutype = insutypes[0].Insutype
694
+		//insuplc_admdvs = insutypes[0].InsuplcAdmdvs
695
+	} else {
696
+		for _, i := range insutypes {
697
+			if i.Insutype == "390" {
698
+				is390 = 1
699
+			}
700
+
701
+			if i.Insutype == "310" {
702
+				is310 = 1
703
+			}
704
+		}
705
+	}
706
+	if is390 == 1 {
707
+		insutype = "390"
708
+	}
709
+
710
+	if is310 == 1 {
711
+		insutype = "310"
712
+	}
713
+
714
+	if len(insutypes) == 0 {
715
+		insutype = "310"
716
+	}
717
+
718
+	if len(insutypes) == 2 {
719
+		insutype = strconv.FormatInt(social_type, 10)
720
+	}
721
+	for _, item := range rf {
722
+		if item.Insutype == insutype {
723
+			insuplc_admdvs = item.InsuplcAdmdvs
724
+		}
725
+	}
726
+
673 727
 	if res2.Infcode == 0 {
674 728
 
675 729
 		//var insutypes []string
@@ -768,7 +822,7 @@ func (c *ZHHisApiController) GetZHInHospitalCheck() {
768 822
 			dises = append(dises, dise)
769 823
 		}
770 824
 		struct2401.Diseinfo = dises
771
-		result := service.ZHGdyb2401(struct2401, miConfig.SecretKey, miConfig.OrgName, miConfig.Code, role.UserName, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs)
825
+		result := service.ZHGdyb2401(struct2401, miConfig.SecretKey, miConfig.OrgName, miConfig.Code, role.UserName, insuplc_admdvs, miConfig.MdtrtareaAdmvs)
772 826
 
773 827
 		var dat map[string]interface{}
774 828
 		if err := json.Unmarshal([]byte(result), &dat); err == nil {
@@ -848,6 +902,7 @@ func (c *ZHHisApiController) GetZHInHospitalCheck() {
848 902
 				Phone:                phone,
849 903
 				BalanceAccountsType:  balance_accounts_type,
850 904
 				PsnType:              psn_type,
905
+				InsuplcAdmdvs:        insuplc_admdvs,
851 906
 			}
852 907
 			service.CreateHospitalRecord(inHospital)
853 908
 			c.ServeSuccessJSON(map[string]interface{}{
@@ -952,7 +1007,7 @@ func (this *ZHHisApiController) GetZHOutHospitalCheck() {
952 1007
 	struct2402.Diseinfo = dises
953 1008
 	struct2402.DiseName = sickConfig.ClassName
954 1009
 	struct2402.DiseCode = sickConfig.CountryCode
955
-	result := service.ZHGdyb2402(struct2402, miConfig.OrgName, role.UserName, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Code)
1010
+	result := service.ZHGdyb2402(struct2402, miConfig.OrgName, role.UserName, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Code)
956 1011
 
957 1012
 	var dat map[string]interface{}
958 1013
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
@@ -1089,7 +1144,7 @@ func (c *ZHHisApiController) GetSettleInfo() {
1089 1144
 
1090 1145
 	}
1091 1146
 
1092
-	result, src_resquest := service.ZHGdyb2304(record.PsnNo, record.Number, chrg_bchno, cert_no, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, "0", record.IdCardType, 0, 0, 0, 0, record.Certificates)
1147
+	result, src_resquest := service.ZHGdyb2304(record.PsnNo, record.Number, chrg_bchno, cert_no, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, "0", record.IdCardType, 0, 0, 0, 0, record.Certificates)
1093 1148
 	var dat map[string]interface{}
1094 1149
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
1095 1150
 		fmt.Println(dat)
@@ -1316,7 +1371,7 @@ func (c *ZHHisApiController) GetUploadInfo() {
1316 1371
 		data["med_type"] = strconv.FormatInt(record.MedType, 10)
1317 1372
 
1318 1373
 	}
1319
-	data["insuplc_admdvs"] = miConfig.InsuplcAdmdvs
1374
+	data["insuplc_admdvs"] = record.InsuplcAdmdvs
1320 1375
 	data["mdtrtarea_admvs"] = miConfig.MdtrtareaAdmvs
1321 1376
 	data["secret_key"] = miConfig.SecretKey
1322 1377
 	var ids []int64
@@ -1683,12 +1738,13 @@ func (c *ZHHisApiController) ZHRefund() {
1683 1738
 	adminUser := c.GetAdminUserInfo()
1684 1739
 	var order models.HisOrder
1685 1740
 	order, _ = service.GetHisOrderByID(order_id)
1741
+	record, _ := service.GetInHospitalRecordByNumber(order.MdtrtId)
1686 1742
 	roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
1687 1743
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
1688 1744
 	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
1689 1745
 	if config.IsOpen == 1 { //对接了医保,走医保流程
1690 1746
 
1691
-		result, src_resquest := service.Gdyb2305(order.PsnNo, order.MdtrtId, order.SetlId, miConfig.OrgName, roles.UserName, miConfig.SecretKey, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs)
1747
+		result, src_resquest := service.Gdyb2305(order.PsnNo, order.MdtrtId, order.SetlId, miConfig.OrgName, roles.UserName, miConfig.SecretKey, miConfig.Code, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs)
1692 1748
 
1693 1749
 		var dat map[string]interface{}
1694 1750
 		if err := json.Unmarshal([]byte(result), &dat); err == nil {
@@ -1783,7 +1839,7 @@ func (c *ZHHisApiController) ZHRefundDetail() {
1783 1839
 		var isSuccess bool = true
1784 1840
 
1785 1841
 		for _, item := range infos {
1786
-			result := service.Gdyb2302(record.PsnNo, record.Number, miConfig.OrgName, roles.UserName, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Code, item.FeedetlSn, 1)
1842
+			result := service.Gdyb2302(record.PsnNo, record.Number, miConfig.OrgName, roles.UserName, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Code, item.FeedetlSn, 1)
1787 1843
 			var dat map[string]interface{}
1788 1844
 			if err := json.Unmarshal([]byte(result), &dat); err == nil {
1789 1845
 				fmt.Println(dat)
@@ -1840,10 +1896,11 @@ func (c *ZHHisApiController) ZHRefundDetail() {
1840 1896
 		//prescriptions, _ = service.GetZHMonthHisUploadPrescription(adminUser.CurrentOrgId, patient_id, recordDateTime)
1841 1897
 		var order models.HisOrder
1842 1898
 		order, _ = service.GetHisOrderByID(order_id)
1899
+		record, _ := service.GetInHospitalRecordByNumber(order.MdtrtId)
1843 1900
 		config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
1844 1901
 		if config.IsOpen == 1 { //对接了医保,走医保流程
1845 1902
 
1846
-			result := service.Gdyb2302(order.PsnNo, order.MdtrtId, miConfig.OrgName, roles.UserName, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Code, "0000", 0)
1903
+			result := service.Gdyb2302(order.PsnNo, order.MdtrtId, miConfig.OrgName, roles.UserName, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Code, "0000", 0)
1847 1904
 			var dat map[string]interface{}
1848 1905
 			if err := json.Unmarshal([]byte(result), &dat); err == nil {
1849 1906
 				fmt.Println(dat)
@@ -1920,7 +1977,7 @@ func (this *ZHHisApiController) GetZHOutHospitalUnCheck() {
1920 1977
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInHospitalNoExistDataException)
1921 1978
 		return
1922 1979
 	}
1923
-	result := service.ZHGdyb2405(record.Number, record.PsnNo, miConfig.SecretKey, miConfig.OrgName, miConfig.Code, role.UserName, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs)
1980
+	result := service.ZHGdyb2405(record.Number, record.PsnNo, miConfig.SecretKey, miConfig.OrgName, miConfig.Code, role.UserName, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs)
1924 1981
 	var dat map[string]interface{}
1925 1982
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
1926 1983
 		fmt.Println(dat)
@@ -1978,7 +2035,7 @@ func (this *ZHHisApiController) GetZHInHospitalUnCheck() {
1978 2035
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInHospitalNoExistDataException)
1979 2036
 		return
1980 2037
 	}
1981
-	result := service.ZHGdyb2404(record.Number, record.PsnNo, miConfig.SecretKey, miConfig.OrgName, miConfig.Code, role.UserName, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs)
2038
+	result := service.ZHGdyb2404(record.Number, record.PsnNo, miConfig.SecretKey, miConfig.OrgName, miConfig.Code, role.UserName, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs)
1982 2039
 	var dat map[string]interface{}
1983 2040
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
1984 2041
 		fmt.Println(dat)

+ 1 - 0
models/zh_his_models.go View File

@@ -41,6 +41,7 @@ type HisHospitalCheckRecord struct {
41 41
 	Phone                string `gorm:"column:phone" json:"phone" form:"phone"`
42 42
 	BalanceAccountsType  int64  `gorm:"column:balance_accounts_type" json:"balance_accounts_type" form:"balance_accounts_type"`
43 43
 	PsnType              int64  `gorm:"column:psn_type" json:"psn_type" form:"psn_type"`
44
+	InsuplcAdmdvs        string `gorm:"column:insuplc_admdvs" json:"insuplc_admdvs" form:"insuplc_admdvs"`
44 45
 }
45 46
 
46 47
 func (HisHospitalCheckRecord) TableName() string {