Browse Source

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

csx 2 years ago
parent
commit
a2d90cdb32

+ 1 - 1
conf/app.conf View File

@@ -45,7 +45,7 @@ appsecret="61ee2e6268497d5aa9de0b0187c39aea"
45 45
 
46 46
 
47 47
 [prod]
48
-org_id = 10191
48
+org_id = 10138
49 49
 
50 50
 mobile_token_expiration_second = 86400
51 51
 httpdomain = https://api.xt.kuyicloud.com

+ 30 - 0
controllers/hb/hbyb_controller.go View File

@@ -28,6 +28,36 @@ func HbybRegistRouters() {
28 28
 	beego.Router("/hbyb/5203", &HBybController{}, "get:PostTen")
29 29
 	beego.Router("/hbyb/2001", &HBybController{}, "get:Post2001")
30 30
 
31
+	beego.Router("/hbyb/4101", &HBybController{}, "post:Post4101")
32
+
33
+}
34
+func (c *HBybController) Post4101() {
35
+	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
36
+	var respJSON map[string]interface{}
37
+	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
38
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
39
+		return
40
+	}
41
+	userJSONBytes, _ := json.Marshal(respJSON["struct4101"])
42
+	var struct4101 service.Struct4101
43
+	if err := json.Unmarshal(userJSONBytes, &struct4101); err != nil {
44
+		utils.ErrorLog("解析失败:%v", err)
45
+		return
46
+	}
47
+	result, inputLog := service.Hbyb4101(struct4101, respJSON["secret_key"].(string), respJSON["org_name"].(string), respJSON["opera"].(string), respJSON["code"].(string), respJSON["insuplc_admdvs"].(string), respJSON["mdtrtarea_admvs"].(string))
48
+	var dat map[string]interface{}
49
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
50
+	} else {
51
+	}
52
+
53
+	var dat2 map[string]interface{}
54
+	if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
55
+	} else {
56
+	}
57
+	c.ServeSuccessJSON(map[string]interface{}{
58
+		"pre": dat,
59
+		"log": dat2,
60
+	})
31 61
 }
32 62
 func (c *HBybController) Post2001() {
33 63
 	org_name := c.GetString("org_name")

+ 97 - 33
controllers/sg/his_api_controller.go View File

@@ -3982,32 +3982,81 @@ func (c *HisApiController) GetBatchSettleList() {
3982 3982
 
3983 3983
 		struct4101.Ntly = "中国"
3984 3984
 		struct4101.AdmCaty = "A03.06"
3985
-		result := service.Gdyb4101(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, c.GetAdminUserInfo().CurrentOrgId)
3986
-		fmt.Println(result)
3985
+		var res ResultSeventeen
3986
+		if miConfig.MdtrtareaAdmvs == "421300" {
3987
+			data := make(map[string]interface{})
3988
+			data["struct4101"] = struct4101
3989
+			data["secret_key"] = miConfig.SecretKey
3990
+			data["org_name"] = miConfig.OrgName
3991
+			data["opera"] = curRoles.UserName
3992
+			data["code"] = miConfig.Code
3993
+			data["insuplc_admdvs"] = miConfig.InsuplcAdmdvs
3994
+			data["mdtrtarea_admvs"] = miConfig.MdtrtareaAdmvs
3995
+
3996
+			client := &http.Client{}
3997
+			bytesData, _ := json.Marshal(data)
3998
+			req, _ := http.NewRequest("POST", "http://192.168.124.4:9532/"+"hbyb/4101", bytes.NewReader(bytesData))
3999
+			resp, _ := client.Do(req)
4000
+			defer resp.Body.Close()
4001
+			body, ioErr := ioutil.ReadAll(resp.Body)
4002
+			if ioErr != nil {
4003
+				utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
4004
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4005
+				return
4006
+			}
4007
+			var respJSON map[string]interface{}
4008
+			if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
4009
+				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
4010
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4011
+				return
4012
+			}
4013
+
4014
+			respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
4015
+			userJSONBytes, _ := json.Marshal(respJSON)
4016
+			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
4017
+				utils.ErrorLog("解析失败:%v", err)
4018
+				//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4019
+				adminUser := c.GetAdminUserInfo()
4020
+				errlog := &models.HisOrderError{
4021
+					UserOrgId: adminUser.CurrentOrgId,
4022
+					Ctime:     time.Now().Unix(),
4023
+					Mtime:     time.Now().Unix(),
4024
+					ErrMsg:    res.ErrMsg + "解析失败",
4025
+					Status:    1,
4026
+					PatientId: order_id,
4027
+					Stage:     10088,
4028
+				}
4029
+				service.CreateErrMsgLog(errlog)
4030
+				continue
4031
+			}
3987 4032
 
3988
-		var dat map[string]interface{}
3989
-		if err := json.Unmarshal([]byte(result), &dat); err == nil {
3990
-			fmt.Println(dat)
3991 4033
 		} else {
3992
-			fmt.Println(err)
3993
-		}
3994
-		userJSONBytes, _ := json.Marshal(dat)
3995
-		var res ResultSeventeen
3996
-		if err := json.Unmarshal(userJSONBytes, &res); err != nil {
3997
-			utils.ErrorLog("解析失败:%v", err)
3998
-			//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3999
-			adminUser := c.GetAdminUserInfo()
4000
-			errlog := &models.HisOrderError{
4001
-				UserOrgId: adminUser.CurrentOrgId,
4002
-				Ctime:     time.Now().Unix(),
4003
-				Mtime:     time.Now().Unix(),
4004
-				ErrMsg:    res.ErrMsg + "解析失败",
4005
-				Status:    1,
4006
-				PatientId: order_id,
4007
-				Stage:     10106,
4034
+			result := service.Gdyb4101(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, c.GetAdminUserInfo().CurrentOrgId)
4035
+			fmt.Println(result)
4036
+
4037
+			var dat map[string]interface{}
4038
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
4039
+				fmt.Println(dat)
4040
+			} else {
4041
+				fmt.Println(err)
4042
+			}
4043
+			userJSONBytes, _ := json.Marshal(dat)
4044
+			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
4045
+				utils.ErrorLog("解析失败:%v", err)
4046
+				//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4047
+				adminUser := c.GetAdminUserInfo()
4048
+				errlog := &models.HisOrderError{
4049
+					UserOrgId: adminUser.CurrentOrgId,
4050
+					Ctime:     time.Now().Unix(),
4051
+					Mtime:     time.Now().Unix(),
4052
+					ErrMsg:    res.ErrMsg + "解析失败",
4053
+					Status:    1,
4054
+					PatientId: order_id,
4055
+					Stage:     10106,
4056
+				}
4057
+				service.CreateErrMsgLog(errlog)
4058
+				continue
4008 4059
 			}
4009
-			service.CreateErrMsgLog(errlog)
4010
-			continue
4011 4060
 		}
4012 4061
 
4013 4062
 		if res.Infcode != 0 {
@@ -9855,16 +9904,31 @@ func (c *HisApiController) GetCheckAccount() {
9855 9904
 			res.Infcode = infocode
9856 9905
 
9857 9906
 		} else if miConfig.MdtrtareaAdmvs == "350500" {
9858
-			//var baseParams models.BaseParams
9859
-			//baseParams.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
9860
-			//baseParams.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
9861
-			//baseParams.SecretKey = miConfig.SecretKey
9862
-			//baseParams.OrgName = miConfig.OrgName
9863
-			//baseParams.EncKey = miConfig.EncKey
9864
-			//baseParams.AppSecret = miConfig.AppSecret
9865
-			//baseParams.SignKey = miConfig.SignKey
9866
-			//
9867
-			//service.FJyb3201(baseParams)
9907
+			var baseParams models.BaseParams
9908
+			baseParams.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
9909
+			baseParams.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
9910
+			baseParams.SecretKey = miConfig.SecretKey
9911
+			baseParams.OrgName = miConfig.OrgName
9912
+			baseParams.EncKey = miConfig.EncKey
9913
+			baseParams.AppSecret = miConfig.AppSecret
9914
+			baseParams.SignKey = miConfig.SignKey
9915
+			baseParams.AppID = miConfig.Code
9916
+			baseParams.RequestUrl = miConfig.Url
9917
+
9918
+			businessParams := models.BusinessParams{
9919
+				Insutype:         insutype,
9920
+				ClrType:          clr_type,
9921
+				SetlOptins:       clr_org,
9922
+				StmtBegndate:     start_time,
9923
+				StmtEnddate:      end_time,
9924
+				MedfeeSumamt:     medfee_sumamt,
9925
+				FundPaySumamt:    fund_pay_sumamt,
9926
+				AcctPay:          acct_pay,
9927
+				FixmedinsSetlCnt: fixmedins_setl_cnt,
9928
+			}
9929
+			result, requestLog := service.FJyb3201(baseParams, businessParams)
9930
+			fmt.Println(requestLog)
9931
+			fmt.Println(result)
9868 9932
 
9869 9933
 		} else {
9870 9934
 			api := "http://127.0.0.1:9532/" + "gdyb/ten?" +

+ 7 - 34
service/fj_service.go View File

@@ -752,7 +752,7 @@ func FJyb6201(org_name string, doctor string, fixmedins_code string, insuplc_adm
752 752
 }
753 753
 
754 754
 //  医药机构费用结算对总账 func Gdyb3201( org_name string, doctor string, secret_key string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string) string {
755
-func FJyb3201(baseParams models.BaseParams, businessParams models.BusinessParams) string {
755
+func FJyb3201(baseParams models.BaseParams, businessParams models.BusinessParams) (string, string) {
756 756
 	fmt.Println("11222333-----")
757 757
 
758 758
 	fmt.Println(baseParams)
@@ -760,7 +760,6 @@ func FJyb3201(baseParams models.BaseParams, businessParams models.BusinessParams
760 760
 	// 生成签名
761 761
 	nonce := GetRandomString(32)
762 762
 	timestamp := time.Now().Unix()
763
-	signature := setSignature(timestamp, nonce, baseParams.SecretKey)
764 763
 
765 764
 	// 生成输入报文
766 765
 	inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
@@ -785,44 +784,18 @@ func FJyb3201(baseParams models.BaseParams, businessParams models.BusinessParams
785 784
 	fmt.Println(string(bytesData))
786 785
 	if err != nil {
787 786
 		fmt.Println(err.Error())
788
-		return err.Error()
787
+		return err.Error(), ""
789 788
 	}
790
-	reader := bytes.NewReader(bytesData)
791
-	gdyb_url := beego.AppConfig.String("gdyb_url")
792
-	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
793
-
794
-	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
795
-	url := gdyb_url + "3201"
796
-	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/3201"
797
-	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3201"
798 789
 
799
-	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3201"
800
-	request, err := http.NewRequest("POST", url, reader)
790
+	cmd := exec.Command("java", "-jar", "FJYB_SDK.jar", string(bytesData))
791
+	out, err := cmd.Output()
801 792
 	if err != nil {
802
-		fmt.Println(err.Error())
803
-		return err.Error()
793
+		fmt.Println("error:", err.Error())
804 794
 	}
805 795
 
806
-	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
807
-	request.Header.Set("x-tif-paasid", gdyb_paasid)
808
-	request.Header.Set("x-tif-signature", signature)
809
-	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
810
-	request.Header.Set("x-tif-nonce", nonce)
796
+	fmt.Println(string(out))
797
+	return ConvertToString(string(out), "gbk", "utf-8"), string(bytesData)
811 798
 
812
-	client := http.Client{}
813
-	resp, err := client.Do(request)
814
-	if err != nil {
815
-		fmt.Println(err.Error())
816
-		return err.Error()
817
-	}
818
-	respBytes, err := ioutil.ReadAll(resp.Body)
819
-	if err != nil {
820
-		fmt.Println(err.Error())
821
-		return err.Error()
822
-	}
823
-	str := string(respBytes)
824
-	fmt.Println(str)
825
-	return str
826 799
 }
827 800
 
828 801
 //文件上传

+ 3 - 3
service/gdyb_service.go View File

@@ -976,8 +976,8 @@ func Gdyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
976 976
 		feedetailInfo["bilg_dr_name"] = item.DoctorName              // 开单医师姓名
977 977
 		feedetailInfo["acord_dept_codg"] = ""                        // 受单科室编码
978 978
 		feedetailInfo["acord_dept_name"] = ""                        // 受单科室名称
979
-		feedetailInfo["orders_dr_code"] = ""                         // 受单医生编码
980
-		feedetailInfo["orders_dr_name"] = ""                         // 受单医生姓名
979
+		feedetailInfo["orders_dr_code"] = item.DoctorNumber          // 受单医生编码
980
+		feedetailInfo["orders_dr_name"] = item.DoctorName            // 受单医生姓名
981 981
 		if balance_accounts_type == "8" {
982 982
 			feedetailInfo["hosp_appr_flag"] = "2" // 医院审批标志
983 983
 		} else {
@@ -997,7 +997,7 @@ func Gdyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
997 997
 
998 998
 		}
999 999
 
1000
-		feedetailInfo["tcmdrug_used_way"] = "" // 中药使用方式
1000
+		//feedetailInfo["tcmdrug_used_way"] = "" // 中药使用方式
1001 1001
 		feedetailInfo["etip_flag"] = ""        // 外检标志
1002 1002
 		feedetailInfo["etip_hosp_code"] = ""   // 外检医院编码
1003 1003
 		feedetailInfo["dscg_tkdrug_flag"] = "" // 出院带药标志

+ 182 - 210
service/hbyb_service.go View File

@@ -1655,216 +1655,188 @@ func Hbyb5301(psnNo string, insutype string, org_name string, doctor string, fix
1655 1655
 }
1656 1656
 
1657 1657
 //
1658
-//func Hbyb4101(struct4101 Struct4101, secret_key string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string) string {
1659
-//	// 生成签名
1660
-//	nonce := GetRandomString(32)
1661
-//	timestamp := time.Now().Unix()
1662
-//	signature := setSignature(timestamp, nonce, secret_key)
1663
-//
1664
-//	// 生成输入报文
1665
-//	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
1666
-//	input := make(map[string]interface{})
1667
-//	inputData := make(map[string]interface{})
1668
-//	inputMessage["infno"] = "4101" // 交易编码
1669
-//
1670
-//	year := time.Now().Format("2006")
1671
-//	month := time.Now().Format("01")
1672
-//	day := time.Now().Format("02")
1673
-//
1674
-//	inputData["mdtrt_id"] = struct4101.MdtrtId                // 就诊 ID  必填(来自2201接口返回)
1675
-//	inputData["setl_id"] = struct4101.SetlId                  // 结算 ID  必填
1676
-//	inputData["fixmedins_name"] = org_name                    // 定点医药机构名称  必填
1677
-//	inputData["fixmedins_code"] = fixmedins_code              // 定点医药机构编码  必填
1678
-//	inputData["hi_setl_lv"] = ""                              // 医保结算等级
1679
-//	inputData["hi_no"] = ""                                   // 医保编号
1680
-//	inputData["medcasno"] = struct4101.PsnNo                  // 病案号  必填
1681
-//	inputData["dcla_time"] = year + "-" + month + "-" + day   // 申报时间  必填
1682
-//	inputData["psn_name"] = struct4101.PsnName                // 人员姓名  必填
1683
-//	inputData["gend"] = struct4101.Gend                       // 性别  必填
1684
-//	inputData["brdy"] = struct4101.Brdy                       // 出生日期  必填
1685
-//	inputData["age"] = struct4101.Age                         // 年龄  必填
1686
-//	inputData["ntly"] = struct4101.Ntly                       // 国籍  必填
1687
-//	inputData["nwb_age"] = ""                                 // 年龄  必填
1688
-//	inputData["naty"] = struct4101.Naty                       // 民族  必填
1689
-//	inputData["patn_cert_type"] = struct4101.PatnCertType     // 患者证件类别  必填
1690
-//	inputData["certno"] = struct4101.Certno                   // 证件号码  必填
1691
-//	inputData["prfs"] = struct4101.Prfs                       // 职业  必填
1692
-//	inputData["curr_addr"] = ""                               // 现住址  必填
1693
-//	inputData["emp_name"] = ""                                // 单位名称  必填
1694
-//	inputData["emp_addr"] = ""                                // 单位地址  必填
1695
-//	inputData["emp_tel"] = ""                                 // 单位电话  必填
1696
-//	inputData["poscode"] = ""                                 // 邮编  必填
1697
-//	inputData["coner_name"] = struct4101.ConerName            // 联系人姓名  必填
1698
-//	inputData["patn_rlts"] = struct4101.PatnRlts              // 与患者关系  必填
1699
-//	inputData["coner_addr"] = struct4101.ConerAddr            // 联系人地址  必填
1700
-//	inputData["coner_tel"] = struct4101.ConerTel              // 联系人电话  必填
1701
-//	inputData["hi_type"] = struct4101.HiType                  // 医保类型  必填
1702
-//	inputData["insuplc"] = struct4101.Insuplc                 // 参保地  必填
1703
-//	inputData["sp_psn_type"] = ""                             // 特殊人员类型  必填
1704
-//	inputData["nwb_adm_type"] = ""                            // 新生儿入院类型  必填
1705
-//	inputData["nwb_bir_wt"] = ""                              // 新生儿出生体重  必填
1706
-//	inputData["nwb_adm_wt"] = ""                              // 新生儿入院体重  必填
1707
-//	inputData["opsp_diag_caty"] = ""                          // 门诊慢特病诊断  必填
1708
-//	inputData["opsp_mdtrt_date"] = ""                         // 门诊慢特病就诊日期  必填
1709
-//	inputData["ipt_med_type"] = struct4101.IptMedType         // 住院医疗类型  必填
1710
-//	inputData["adm_way"] = ""                                 // 入院途径  必填
1711
-//	inputData["trt_type"] = ""                                // 治疗类别  必填
1712
-//	inputData["adm_time"] = ""                                // 入院时间  必填
1713
-//	inputData["adm_caty"] = struct4101.AdmCaty                // 入院科别  必填
1714
-//	inputData["refldept_dept"] = ""                           // 转科科别  必填
1715
-//	inputData["dscg_time"] = ""                               // 出院时间  必填
1716
-//	inputData["dscg_caty"] = struct4101.AdmCaty               // 出院科别  必填
1717
-//	inputData["act_ipt_days"] = ""                            // 实际住院天数  必填
1718
-//	inputData["otp_wm_dise"] = ""                             // 门(急) 诊西医诊断  必填
1719
-//	inputData["wm_dise_code"] = ""                            // 门(急) 诊中医诊断  必填
1720
-//	inputData["otp_tcm_dise"] = ""                            // 西医诊断疾病代码  必填
1721
-//	inputData["tcm_dise_code"] = ""                           // 中医诊断代码  必填
1722
-//	inputData["oprn_oprt_code_cnt"] = ""                      // 手术操作代码计数  必填
1723
-//	inputData["vent_used_dura"] = ""                          // 呼吸机使用时长  必填
1724
-//	inputData["pwcry_bfadm_coma_dura"] = ""                   // 颅脑损伤患者入院前昏迷时长  必填
1725
-//	inputData["pwcry_afadm_coma_dura"] = ""                   // 颅脑损伤患者入院后昏迷时长  必填
1726
-//	inputData["bld_cat"] = ""                                 // 输血品种  必填
1727
-//	inputData["bld_amt"] = ""                                 // 输血量  必填
1728
-//	inputData["bld_unt"] = ""                                 // 输血计量单位  必填
1729
-//	inputData["spga_nurscare_days"] = ""                      // 特级护理天数  必填
1730
-//	inputData["lv1_nurscare_days"] = ""                       // 一级护理天数  必填
1731
-//	inputData["scd_nurscare_days"] = ""                       // 二级护理天数  必填
1732
-//	inputData["lv3_nurscare_days"] = ""                       // 三级护理天数  必填
1733
-//	inputData["acp_medins_name"] = ""                         // 拟接收机构名称  必填
1734
-//	inputData["acp_optins_code"] = ""                         // 拟接收机构代码  必填
1735
-//	inputData["bill_code"] = struct4101.BillCode              // 票据代码  必填
1736
-//	inputData["bill_no"] = struct4101.BillNo                  // 票据号码  必填
1737
-//	inputData["biz_sn"] = struct4101.BizSn                    // 业务流水号  必填
1738
-//	inputData["days_rinp_flag_31"] = ""                       // 出院 31 天内再住院计划标志  必填
1739
-//	inputData["days_rinp_pup_31"] = ""                        // 出院 31 天内再住院目的  必填
1740
-//	inputData["chfpdr_name"] = ""                             // 主诊医师姓名  必填
1741
-//	inputData["chfpdr_code"] = ""                             // 主诊医师代码  必填
1742
-//	inputData["setl_begn_date"] = struct4101.SetlBegnDate     // 结算开始日期  必填
1743
-//	inputData["setl_end_date"] = struct4101.SetlEndDate       // 结算结束日期  必填
1744
-//	inputData["psn_selfpay"] = struct4101.PsnSelfPay          // 个人自付  必填
1745
-//	inputData["psn_ownpay"] = struct4101.PsnOwnPay            // 个人自费  必填
1746
-//	inputData["acct_pay"] = struct4101.AcctPay                // 个人账户支出  必填
1747
-//	inputData["hi_paymtd"] = struct4101.HiPaymtd              // 医保支付方式  必填
1748
-//	inputData["hsorg"] = struct4101.Hsorg                     // 医保机构  必填
1749
-//	inputData["hsorg_opter"] = struct4101.HsorgOpter          // 医保机构经办人  必填
1750
-//	inputData["medins_fill_dept"] = struct4101.MedinsFillDept // 医疗机构填报部门  必填
1751
-//	inputData["medins_fill_psn"] = struct4101.MedinsFillPsn   // 医疗机构填报人  必填
1752
-//	inputData["psn_cashpay"] = struct4101.PsnCashpay          // 医疗机构填报人  必填
1753
-//
1754
-//	payinfo := make([]map[string]interface{}, 0) // 基金支付信息
1755
-//	for _, item := range struct4101.CustomStruct {
1756
-//		payinfotemp := make(map[string]interface{})
1757
-//		if item.FundPayType == "310100" || item.FundPayType == "310200" || item.FundPayType == "320100" || item.FundPayType == "330100" || item.FundPayType == "340100" || item.FundPayType == "350100" || item.FundPayType == "370100" || item.FundPayType == "390100" || item.FundPayType == "610100" || item.FundPayType == "640100" || item.FundPayType == "620100" {
1758
-//			payinfotemp["fund_pay_type"] = item.FundPayType // 基金支付类型  必填
1759
-//			payinfotemp["fund_payamt"] = item.FundPayamt    // 基金支付金额
1760
-//			payinfo = append(payinfo, payinfotemp)
1761
-//		}
1762
-//	}
1763
-//	opspdiseinfo := make([]map[string]interface{}, 0) // 门诊慢特病诊断信息
1764
-//	for _, item := range struct4101.OpspdiseinfoStruct {
1765
-//		opspdiseinfotemp := make(map[string]interface{})
1766
-//		opspdiseinfotemp["diag_name"] = item.DiagName // 诊断名称  必填
1767
-//		opspdiseinfotemp["diag_code"] = item.DiagCode // 诊断代码 必填
1768
-//		opspdiseinfotemp["oprn_oprt_name"] = ""       // 手术操作名称 必填
1769
-//		opspdiseinfotemp["oprn_oprt_code"] = ""       // 手术操作代码 必填
1770
-//
1771
-//		opspdiseinfo = append(opspdiseinfo, opspdiseinfotemp)
1772
-//	}
1773
-//
1774
-//	diseinfo := make([]map[string]interface{}, 0) // 住院诊断信息
1775
-//	for _, item := range struct4101.OpspdiseinfoStruct {
1776
-//		fmt.Println(item.DiagName)
1777
-//		diseinfotemp := make(map[string]interface{})
1778
-//		diseinfotemp["maindiag_flag"] = item.MaindiagFlag // 手术操作代码 必填
1779
-//		diseinfotemp["diag_type"] = item.MaindiagFlag     // 诊断类别  必填
1780
-//		diseinfotemp["diag_code"] = item.DiagCode         // 诊断代码 必填
1781
-//		diseinfotemp["diag_name"] = item.DiagName         // 诊断名称 必填
1782
-//		diseinfotemp["adm_cond_type"] = "3"               // 入院病情类型 必填
1783
-//		diseinfo = append(diseinfo, diseinfotemp)
1784
-//	}
1785
-//
1786
-//	iteminfo := make([]map[string]interface{}, 0) // 住院诊断信息
1787
-//	for _, item := range struct4101.IteminfoStruct {
1788
-//		iteminfotemp := make(map[string]interface{})
1789
-//		iteminfotemp["med_chrgitm"] = item.MedChrgitm            // 医疗收费项目  必填
1790
-//		iteminfotemp["amt"] = item.Amt                           // 金额 必填
1791
-//		iteminfotemp["claa_sumfee"] = item.ClaaSumfee            // 甲类费用合计 必填
1792
-//		iteminfotemp["clab_amt"] = item.ClabAmt                  // 乙类金额 必填
1793
-//		iteminfotemp["fulamt_ownpay_amt"] = item.FulamtOwnpayAmt // 全自费金额 必填
1794
-//		iteminfotemp["oth_amt"] = item.OthAmt                    // 其他金额 必填
1795
-//		iteminfo = append(iteminfo, iteminfotemp)
1796
-//	}
1797
-//
1798
-//	oprninfo := make([]map[string]interface{}, 0) // 手术操作信息
1799
-//	oprninfotemp := make(map[string]interface{})
1800
-//	oprninfotemp["oprn_oprt_type"] = "" // 手术操作类别  必填
1801
-//	oprninfotemp["oprn_oprt_name"] = "" // 手术操作名称 必填
1802
-//	oprninfotemp["oprn_oprt_code"] = "" // 手术操作代码 必填
1803
-//	oprninfotemp["oprn_oprt_date"] = "" // 手术操作日期 必填
1804
-//	oprninfotemp["anst_way"] = ""       // 麻醉方式 必填
1805
-//	oprninfotemp["oper_dr_name"] = ""   // 术者医师姓名 必填
1806
-//	oprninfotemp["oper_dr_code"] = ""   // 术者医师代码 必填
1807
-//	oprninfotemp["anst_dr_name"] = ""   // 麻醉医师姓名 必填
1808
-//	oprninfotemp["anst_dr_code"] = ""   // 麻醉医师代码 必填
1809
-//	oprninfo = append(oprninfo, oprninfotemp)
1810
-//
1811
-//	icuinfo := make([]map[string]interface{}, 0) // 重症监护信息
1812
-//	icuinfotemp := make(map[string]interface{})
1813
-//	icuinfotemp["scs_cutd_ward_type"] = ""   // 重症监护病房类型  必填
1814
-//	icuinfotemp["scs_cutd_inpool_time"] = "" // 重症监护进入时间 必填
1815
-//	icuinfotemp["scs_cutd_exit_time"] = ""   // 重症监护退出时间 必填
1816
-//	icuinfotemp["scs_cutd_sum_dura"] = ""    // 重症监护合计时长 必填
1817
-//	icuinfo = append(icuinfo, icuinfotemp)
1818
-//
1819
-//	input["setlinfo"] = inputData
1820
-//	input["payinfo"] = payinfo
1821
-//	//input["opspdiseinfo"] = opspdiseinfo
1822
-//	input["diseinfo"] = diseinfo
1823
-//	input["iteminfo"] = iteminfo
1824
-//	//input["oprninfo"] = oprninfo
1825
-//	//input["icuinfo"] = icuinfo
1826
-//	inputMessage["input"] = input //交易输入
1827
-//
1828
-//	bytesData, err := json.Marshal(inputMessage)
1829
-//	fmt.Println(string(bytesData))
1830
-//	if err != nil {
1831
-//		fmt.Println(err.Error())
1832
-//		return err.Error()
1833
-//	}
1834
-//	reader := bytes.NewReader(bytesData)
1835
-//
1836
-//	gdyb_url := beego.AppConfig.String("gdyb_url")
1837
-//	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
1838
-//	url := gdyb_url + "4101"
1839
-//
1840
-//	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/4101"
1841
-//	request, err := http.NewRequest("POST", url, reader)
1842
-//	if err != nil {
1843
-//		fmt.Println(err.Error())
1844
-//		return err.Error()
1845
-//	}
1846
-//
1847
-//	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
1848
-//	request.Header.Set("x-tif-paasid", gdyb_paasid)
1849
-//	request.Header.Set("x-tif-signature", signature)
1850
-//	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
1851
-//	request.Header.Set("x-tif-nonce", nonce)
1852
-//
1853
-//	client := http.Client{}
1854
-//	resp, err := client.Do(request)
1855
-//	if err != nil {
1856
-//		fmt.Println(err.Error())
1857
-//		return err.Error()
1858
-//	}
1859
-//	respBytes, err := ioutil.ReadAll(resp.Body)
1860
-//	if err != nil {
1861
-//		fmt.Println(err.Error())
1862
-//		return err.Error()
1863
-//	}
1864
-//	str := string(respBytes)
1865
-//	fmt.Println(str)
1866
-//	return str
1867
-//}
1658
+func Hbyb4101(struct4101 Struct4101, secret_key string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string) (string, string) {
1659
+	// 生成签名
1660
+	nonce := GetRandomString(32)
1661
+	timestamp := time.Now().Unix()
1662
+
1663
+	// 生成输入报文
1664
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
1665
+	input := make(map[string]interface{})
1666
+	inputData := make(map[string]interface{})
1667
+	inputMessage["infno"] = "4101A" // 交易编码
1668
+
1669
+	year := time.Now().Format("2006")
1670
+	month := time.Now().Format("01")
1671
+	day := time.Now().Format("02")
1672
+
1673
+	inputData["mdtrt_id"] = struct4101.MdtrtId // 就诊 ID  必填(来自2201接口返回)
1674
+	inputData["setl_id"] = struct4101.SetlId   // 结算 ID  必填
1675
+	inputData["psn_no"] = struct4101.PsnNo     // 结算 ID  必填
1676
+
1677
+	inputData["fixmedins_name"] = org_name                    // 定点医药机构名称  必填
1678
+	inputData["fixmedins_code"] = fixmedins_code              // 定点医药机构编码  必填
1679
+	inputData["hi_setl_lv"] = ""                              // 医保结算等级
1680
+	inputData["hi_no"] = struct4101.PsnNo                     // 医保编号
1681
+	inputData["medcasno"] = struct4101.PsnNo                  // 病案号  必填
1682
+	inputData["dcla_time"] = year + "-" + month + "-" + day   // 申报时间  必填
1683
+	inputData["psn_name"] = struct4101.PsnName                // 人员姓名  必填
1684
+	inputData["gend"] = struct4101.Gend                       // 性别  必填
1685
+	inputData["brdy"] = struct4101.Brdy                       // 出生日期  必填
1686
+	inputData["age"] = struct4101.Age                         // 年龄  必填
1687
+	inputData["ntly"] = struct4101.Ntly                       // 国籍  必填
1688
+	inputData["nwb_age"] = ""                                 // 年龄  必填
1689
+	inputData["naty"] = struct4101.Naty                       // 民族  必填
1690
+	inputData["patn_cert_type"] = struct4101.PatnCertType     // 患者证件类别  必填
1691
+	inputData["certno"] = struct4101.Certno                   // 证件号码  必填
1692
+	inputData["prfs"] = struct4101.Prfs                       // 职业  必填
1693
+	inputData["curr_addr"] = ""                               // 现住址  必填
1694
+	inputData["emp_name"] = ""                                // 单位名称  必填
1695
+	inputData["emp_addr"] = ""                                // 单位地址  必填
1696
+	inputData["emp_tel"] = ""                                 // 单位电话  必填
1697
+	inputData["poscode"] = ""                                 // 邮编  必填
1698
+	inputData["coner_name"] = struct4101.ConerName            // 联系人姓名  必填
1699
+	inputData["patn_rlts"] = struct4101.PatnRlts              // 与患者关系  必填
1700
+	inputData["coner_addr"] = struct4101.ConerAddr            // 联系人地址  必填
1701
+	inputData["coner_tel"] = struct4101.ConerTel              // 联系人电话  必填
1702
+	inputData["hi_type"] = struct4101.HiType                  // 医保类型  必填
1703
+	inputData["insuplc"] = struct4101.Insuplc                 // 参保地  必填
1704
+	inputData["sp_psn_type"] = ""                             // 特殊人员类型  必填
1705
+	inputData["nwb_adm_type"] = ""                            // 新生儿入院类型  必填
1706
+	inputData["nwb_bir_wt"] = ""                              // 新生儿出生体重  必填
1707
+	inputData["nwb_adm_wt"] = ""                              // 新生儿入院体重  必填
1708
+	inputData["opsp_diag_caty"] = ""                          // 门诊慢特病诊断  必填
1709
+	inputData["opsp_mdtrt_date"] = ""                         // 门诊慢特病就诊日期  必填
1710
+	inputData["ipt_med_type"] = struct4101.IptMedType         // 住院医疗类型  必填
1711
+	inputData["adm_way"] = ""                                 // 入院途径  必填
1712
+	inputData["trt_type"] = ""                                // 治疗类别  必填
1713
+	inputData["adm_time"] = struct4101.AdmTime                // 入院时间  必填
1714
+	inputData["adm_caty"] = struct4101.AdmCaty                // 入院科别  必填
1715
+	inputData["refldept_dept"] = ""                           // 转科科别  必填
1716
+	inputData["dscg_time"] = struct4101.AdmEndTime            // 出院时间  必填
1717
+	inputData["dscg_caty"] = struct4101.AdmCaty               // 出院科别  必填
1718
+	inputData["act_ipt_days"] = ""                            // 实际住院天数  必填
1719
+	inputData["otp_wm_dise"] = ""                             // 门(急) 诊西医诊断  必填
1720
+	inputData["wm_dise_code"] = ""                            // 门(急) 诊中医诊断  必填
1721
+	inputData["otp_tcm_dise"] = ""                            // 西医诊断疾病代码  必填
1722
+	inputData["tcm_dise_code"] = ""                           // 中医诊断代码  必填
1723
+	inputData["oprn_oprt_code_cnt"] = ""                      // 手术操作代码计数  必填
1724
+	inputData["vent_used_dura"] = ""                          // 呼吸机使用时长  必填
1725
+	inputData["pwcry_bfadm_coma_dura"] = ""                   // 颅脑损伤患者入院前昏迷时长  必填
1726
+	inputData["pwcry_afadm_coma_dura"] = ""                   // 颅脑损伤患者入院后昏迷时长  必填
1727
+	inputData["bld_cat"] = ""                                 // 输血品种  必填
1728
+	inputData["bld_amt"] = ""                                 // 输血量  必填
1729
+	inputData["bld_unt"] = ""                                 // 输血计量单位  必填
1730
+	inputData["spga_nurscare_days"] = ""                      // 特级护理天数  必填
1731
+	inputData["lv1_nurscare_days"] = ""                       // 一级护理天数  必填
1732
+	inputData["scd_nurscare_days"] = ""                       // 二级护理天数  必填
1733
+	inputData["lv3_nurscare_days"] = ""                       // 三级护理天数  必填
1734
+	inputData["acp_medins_name"] = ""                         // 拟接收机构名称  必填
1735
+	inputData["acp_optins_code"] = ""                         // 拟接收机构代码  必填
1736
+	inputData["bill_code"] = struct4101.BillCode              // 票据代码  必填
1737
+	inputData["bill_no"] = struct4101.BillNo                  // 票据号码  必填
1738
+	inputData["biz_sn"] = struct4101.BizSn                    // 业务流水号  必填
1739
+	inputData["days_rinp_flag_31"] = ""                       // 出院 31 天内再住院计划标志  必填
1740
+	inputData["days_rinp_pup_31"] = ""                        // 出院 31 天内再住院目的  必填
1741
+	inputData["chfpdr_name"] = ""                             // 主诊医师姓名  必填
1742
+	inputData["chfpdr_code"] = ""                             // 主诊医师代码  必填
1743
+	inputData["setl_begn_date"] = struct4101.SetlBegnDate     // 结算开始日期  必填
1744
+	inputData["setl_end_date"] = struct4101.SetlEndDate       // 结算结束日期  必填
1745
+	inputData["psn_selfpay"] = struct4101.PsnSelfPay          // 个人自付  必填
1746
+	inputData["psn_ownpay"] = struct4101.PsnOwnPay            // 个人自费  必填
1747
+	inputData["acct_pay"] = struct4101.AcctPay                // 个人账户支出  必填
1748
+	inputData["hi_paymtd"] = struct4101.HiPaymtd              // 医保支付方式  必填
1749
+	inputData["hsorg"] = struct4101.Hsorg                     // 医保机构  必填
1750
+	inputData["hsorg_opter"] = struct4101.HsorgOpter          // 医保机构经办人  必填
1751
+	inputData["medins_fill_dept"] = struct4101.MedinsFillDept // 医疗机构填报部门  必填
1752
+	inputData["medins_fill_psn"] = struct4101.MedinsFillPsn   // 医疗机构填报人  必填
1753
+	inputData["psn_cashpay"] = struct4101.PsnCashpay          // 医疗机构填报人  必填
1754
+
1755
+	payinfo := make([]map[string]interface{}, 0) // 基金支付信息
1756
+	for _, item := range struct4101.CustomStruct {
1757
+		payinfotemp := make(map[string]interface{})
1758
+		if item.FundPayType == "310100" || item.FundPayType == "310200" || item.FundPayType == "320100" || item.FundPayType == "330100" || item.FundPayType == "340100" || item.FundPayType == "350100" || item.FundPayType == "370100" || item.FundPayType == "390100" || item.FundPayType == "610100" || item.FundPayType == "640100" || item.FundPayType == "620100" {
1759
+			payinfotemp["fund_pay_type"] = item.FundPayType // 基金支付类型  必填
1760
+			payinfotemp["fund_payamt"] = item.FundPayamt    // 基金支付金额
1761
+			payinfo = append(payinfo, payinfotemp)
1762
+		}
1763
+	}
1764
+	opspdiseinfo := make([]map[string]interface{}, 0) // 门诊慢特病诊断信息
1765
+
1766
+	opspdiseinfotemp := make(map[string]interface{})
1767
+	opspdiseinfotemp["diag_name"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagName      // 诊断名称  必填
1768
+	opspdiseinfotemp["diag_code"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagCode      // 诊断代码 必填
1769
+	opspdiseinfotemp["oprn_oprt_name"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagName // 手术操作名称 必填
1770
+	opspdiseinfotemp["oprn_oprt_code"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagCode // 手术操作代码 必填
1771
+	opspdiseinfo = append(opspdiseinfo, opspdiseinfotemp)
1772
+
1773
+	diseinfo := make([]map[string]interface{}, 0) // 住院诊断信息
1774
+	for _, item := range struct4101.Diseinfo {
1775
+		diseinfotemp := make(map[string]interface{})
1776
+		diseinfotemp["maindiag_flag"] = item.MaindiagFlag // 手术操作代码 必填
1777
+		diseinfotemp["diag_type"] = item.DiagType         // 诊断类别  必填
1778
+		diseinfotemp["diag_code"] = item.DiagCode         // 诊断代码 必填
1779
+		diseinfotemp["diag_name"] = item.DiagName         // 诊断名称 必填
1780
+		diseinfotemp["adm_cond_type"] = "3"               // 入院病情类型 必填
1781
+		diseinfo = append(diseinfo, diseinfotemp)
1782
+	}
1783
+
1784
+	iteminfo := make([]map[string]interface{}, 0)
1785
+	for _, item := range struct4101.IteminfoStruct {
1786
+		iteminfotemp := make(map[string]interface{})
1787
+		iteminfotemp["med_chrgitm"] = item.MedChrgitm            // 医疗收费项目  必填
1788
+		iteminfotemp["amt"] = item.Amt                           // 金额 必填
1789
+		iteminfotemp["claa_sumfee"] = item.ClaaSumfee            // 甲类费用合计 必填
1790
+		iteminfotemp["clab_amt"] = item.ClabAmt                  // 乙类金额 必填
1791
+		iteminfotemp["fulamt_ownpay_amt"] = item.FulamtOwnpayAmt // 全自费金额 必填
1792
+		iteminfotemp["oth_amt"] = item.OthAmt                    // 其他金额 必填
1793
+		iteminfo = append(iteminfo, iteminfotemp)
1794
+	}
1795
+
1796
+	oprninfo := make([]map[string]interface{}, 0) // 手术操作信息
1797
+	oprninfotemp := make(map[string]interface{})
1798
+	oprninfotemp["oprn_oprt_type"] = "" // 手术操作类别  必填
1799
+	oprninfotemp["oprn_oprt_name"] = "" // 手术操作名称 必填
1800
+	oprninfotemp["oprn_oprt_code"] = "" // 手术操作代码 必填
1801
+	oprninfotemp["oprn_oprt_date"] = "" // 手术操作日期 必填
1802
+	oprninfotemp["anst_way"] = ""       // 麻醉方式 必填
1803
+	oprninfotemp["oper_dr_name"] = ""   // 术者医师姓名 必填
1804
+	oprninfotemp["oper_dr_code"] = ""   // 术者医师代码 必填
1805
+	oprninfotemp["anst_dr_name"] = ""   // 麻醉医师姓名 必填
1806
+	oprninfotemp["anst_dr_code"] = ""   // 麻醉医师代码 必填
1807
+	oprninfo = append(oprninfo, oprninfotemp)
1808
+
1809
+	icuinfo := make([]map[string]interface{}, 0) // 重症监护信息
1810
+	icuinfotemp := make(map[string]interface{})
1811
+	icuinfotemp["scs_cutd_ward_type"] = ""   // 重症监护病房类型  必填
1812
+	icuinfotemp["scs_cutd_inpool_time"] = "" // 重症监护进入时间 必填
1813
+	icuinfotemp["scs_cutd_exit_time"] = ""   // 重症监护退出时间 必填
1814
+	icuinfotemp["scs_cutd_sum_dura"] = ""    // 重症监护合计时长 必填
1815
+	icuinfo = append(icuinfo, icuinfotemp)
1816
+
1817
+	input["setlinfo"] = inputData
1818
+	input["payinfo"] = payinfo
1819
+	input["opspdiseinfo"] = opspdiseinfo
1820
+	input["diseinfo"] = diseinfo
1821
+	input["iteminfo"] = iteminfo
1822
+	inputMessage["input"] = input //交易输入
1823
+
1824
+	bytesData, err := json.Marshal(inputMessage)
1825
+	fmt.Println(string(bytesData))
1826
+	if err != nil {
1827
+		fmt.Println(err.Error())
1828
+		return err.Error(), ""
1829
+	}
1830
+	var json2 string
1831
+	cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "4101A", string(bytesData), json2)
1832
+	out, err := cmd.Output()
1833
+	if err != nil {
1834
+		fmt.Println("error:", err.Error())
1835
+	}
1836
+
1837
+	fmt.Println(string(out))
1838
+	return ConvertToString(string(out), "gbk", "utf-8"), string(bytesData)
1839
+}
1868 1840
 
1869 1841
 //func Gdyb1201(psnNo string, org_name string, doctor string) string {
1870 1842
 //	// 生成签名