Procházet zdrojové kódy

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

csx před 4 roky
rodič
revize
f35ffa5c8c
3 změnil soubory, kde provedl 295 přidání a 216 odebrání
  1. 24 24
      controllers/sg/his_api_controller.go
  2. 266 192
      service/gdyb_service.go
  3. 5 0
      service/his_service.go

+ 24 - 24
controllers/sg/his_api_controller.go Zobrazit soubor

@@ -1390,8 +1390,8 @@ func (c *HisApiController) GetUploadInfo() {
1390 1390
 	}
1391 1391
 
1392 1392
 	roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
1393
-
1394
-	his, _ := service.GetNewVMHisPatientInfo(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
1393
+	fmt.Println(his_patient_id)
1394
+	his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, id, recordDateTime)
1395 1395
 	timestamp := time.Now().Unix()
1396 1396
 	tempTime := time.Unix(timestamp, 0)
1397 1397
 	timeFormat := tempTime.Format("20060102150405")
@@ -2746,25 +2746,25 @@ func (c *HisApiController) Refund() {
2746 2746
 }
2747 2747
 
2748 2748
 func (c *HisApiController) RefundNumber() {
2749
-	//record_time := c.GetString("record_time")
2750
-	//patient_id, _ := c.GetInt64("patient_id")
2749
+	record_time := c.GetString("record_time")
2750
+	patient_id, _ := c.GetInt64("patient_id")
2751 2751
 	admin_user_id, _ := c.GetInt64("admin_user_id")
2752 2752
 
2753 2753
 	his_patient_id, _ := c.GetInt64("id")
2754 2754
 
2755
-	//timeLayout := "2006-01-02"
2756
-	//loc, _ := time.LoadLocation("Local")
2755
+	timeLayout := "2006-01-02"
2756
+	loc, _ := time.LoadLocation("Local")
2757 2757
 	adminUser := c.GetAdminUserInfo()
2758
-	//theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
2759
-	//fmt.Println(err)
2760
-	//if err != nil {
2761
-	//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2762
-	//	return
2763
-	//}
2764
-	//recordDateTime := theTime.Unix()
2765
-	//his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
2758
+	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
2759
+	fmt.Println(err)
2760
+	if err != nil {
2761
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2762
+		return
2763
+	}
2764
+	recordDateTime := theTime.Unix()
2765
+	his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
2766 2766
 
2767
-	his, _ := service.GetHisPatientRecord(adminUser.CurrentOrgId, his_patient_id)
2767
+	//his, _ := service.GetNewHisPatientRecord(adminUser.CurrentOrgId, patient_id)
2768 2768
 	//patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
2769 2769
 	//order, _ := service.GetHisOrderByID(order_id)
2770 2770
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
@@ -2932,15 +2932,15 @@ func (c *HisApiController) GetCheckAccount() {
2932 2932
 	startime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
2933 2933
 	endtime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
2934 2934
 	orders, _ := service.GetOrderByTime(startime.Unix(), endtime.Unix(), adminUser.CurrentOrgId, insutype, clr_type)
2935
-	orders_two, _ := service.GetOrderByTimeThree(startime.Unix(), endtime.Unix(), adminUser.CurrentOrgId, insutype, clr_type)
2936
-	fixmedins_setl_cnt := int64(len(orders_two))
2937
-
2938
-	//撤销的算2条数据为一笔
2939
-	for _, item := range orders_two {
2940
-		if item.OrderStatus == 3 {
2941
-			fixmedins_setl_cnt = fixmedins_setl_cnt + 1
2942
-		}
2943
-	}
2935
+	//orders_two, _ := service.GetOrderByTimeThree(startime.Unix(), endtime.Unix(), adminUser.CurrentOrgId, insutype, clr_type)
2936
+	fixmedins_setl_cnt := int64(len(orders))
2937
+	//
2938
+	////撤销的算2条数据为一笔
2939
+	//for _, item := range orders_two {
2940
+	//	if item.OrderStatus == 3 {
2941
+	//		fixmedins_setl_cnt = fixmedins_setl_cnt + 1
2942
+	//	}
2943
+	//}
2944 2944
 	var medfee_sumamt float64
2945 2945
 	var acct_pay float64
2946 2946
 	var fund_pay_sumamt float64

+ 266 - 192
service/gdyb_service.go Zobrazit soubor

@@ -2092,199 +2092,273 @@ func Gdyb5301(psnNo string, insutype string, org_name string, doctor string, fix
2092 2092
 	return str
2093 2093
 }
2094 2094
 
2095
-//  门诊结算撤销
2096
-//func Gdyb4101(psnNo string, mdtrtId string, setlId string) string {
2097
-//	// 生成签名
2098
-//	nonce := GetRandomString(32)
2099
-//	timestamp := time.Now().Unix()
2100
-//	signature := setSignature(timestamp, nonce)
2101
-//
2102
-//	// 生成输入报文
2103
-//	inputMessage := SetInputMessage(nonce, timestamp)
2104
-//	input := make(map[string]interface{})
2105
-//	inputData := make(map[string]interface{})
2106
-//	inputMessage["infno"] = "4101" // 交易编码
2107
-//
2108
-//	inputData["mdtrt_id"] = mdtrtId // 就诊 ID  必填(来自2201接口返回)
2109
-//	inputData["setl_id"] = setlId   // 结算 ID  必填
2110
-//	inputData["fixmedins_name"] = ""   // 定点医药机构名称  必填
2111
-//	inputData["fixmedins_code"] = ""   // 定点医药机构编码  必填
2112
-//	inputData["hi_setl_lv"] = ""   // 医保结算等级
2113
-//	inputData["hi_no"] = ""   // 医保编号
2114
-//	inputData["medcasno"] = ""   // 病案号  必填
2115
-//	inputData["dcla_time"] = ""   // 申报时间  必填
2116
-//	inputData["psn_name"] = ""   // 人员姓名  必填
2117
-//	inputData["gend"] = ""   // 性别  必填
2118
-//	inputData["brdy"] = ""   // 出生日期  必填
2119
-//	inputData["age"] = ""   // 年龄  必填
2120
-//	inputData["ntly"] = ""   // 国籍  必填
2121
-//	inputData["nwb_age"] = ""   // 年龄  必填
2122
-//	inputData["naty"] = ""   // 民族  必填
2123
-//	inputData["patn_cert_type"] = ""   // 患者证件类别  必填
2124
-//	inputData["certno"] = ""   // 证件号码  必填
2125
-//	inputData["prfs"] = ""   // 职业  必填
2126
-//	inputData["curr_addr"] = ""   // 现住址  必填
2127
-//	inputData["emp_name"] = ""   // 单位名称  必填
2128
-//	inputData["emp_addr"] = ""   // 单位地址  必填
2129
-//	inputData["emp_tel"] = ""   // 单位电话  必填
2130
-//	inputData["poscode"] = ""   // 邮编  必填
2131
-//	inputData["coner_name"] = ""   // 联系人姓名  必填
2132
-//	inputData["patn_rlts"] = ""   // 与患者关系  必填
2133
-//	inputData["coner_addr"] = ""   // 联系人地址  必填
2134
-//	inputData["coner_tel"] = ""   // 联系人电话  必填
2135
-//	inputData["hi_type"] = ""   // 医保类型  必填
2136
-//	inputData["insuplc"] = ""   // 参保地  必填
2137
-//	inputData["sp_psn_type"] = ""   // 特殊人员类型  必填
2138
-//	inputData["nwb_adm_type"] = ""   // 新生儿入院类型  必填
2139
-//	inputData["nwb_bir_wt"] = ""   // 新生儿出生体重  必填
2140
-//	inputData["nwb_adm_wt"] = ""   // 新生儿入院体重  必填
2141
-//	inputData["opsp_diag_caty"] = ""   // 门诊慢特病诊断  必填
2142
-//	inputData["opsp_mdtrt_date"] = ""   // 门诊慢特病就诊日期  必填
2143
-//	inputData["ipt_med_type"] = ""   // 住院医疗类型  必填
2144
-//	inputData["adm_way"] = ""   // 入院途径  必填
2145
-//	inputData["trt_type"] = ""   // 治疗类别  必填
2146
-//	inputData["adm_time"] = ""   // 入院时间  必填
2147
-//	inputData["adm_caty"] = ""   // 入院科别  必填
2148
-//	inputData["refldept_dept"] = ""   // 转科科别  必填
2149
-//	inputData["dscg_time"] = ""   // 出院时间  必填
2150
-//	inputData["dscg_caty"] = ""   // 出院科别  必填
2151
-//	inputData["act_ipt_days"] = ""   // 实际住院天数  必填
2152
-//	inputData["otp_wm_dise"] = ""   // 门(急) 诊西医诊断  必填
2153
-//	inputData["wm_dise_code"] = ""   // 门(急) 诊中医诊断  必填
2154
-//	inputData["otp_tcm_dise"] = ""   // 西医诊断疾病代码  必填
2155
-//	inputData["tcm_dise_code"] = ""   // 中医诊断代码  必填
2156
-//	inputData["oprn_oprt_code_cnt"] = ""   // 手术操作代码计数  必填
2157
-//	inputData["vent_used_dura"] = ""   // 呼吸机使用时长  必填
2158
-//	inputData["pwcry_bfadm_coma_dura"] = ""   // 颅脑损伤患者入院前昏迷时长  必填
2159
-//	inputData["pwcry_afadm_coma_dura"] = ""   // 颅脑损伤患者入院后昏迷时长  必填
2160
-//	inputData["bld_cat"] = ""   // 输血品种  必填
2161
-//	inputData["bld_amt"] = ""   // 输血量  必填
2162
-//	inputData["bld_unt"] = ""   // 输血计量单位  必填
2163
-//	inputData["spga_nurscare_days"] = ""   // 特级护理天数  必填
2164
-//	inputData["lv1_nurscare_days"] = ""   // 一级护理天数  必填
2165
-//	inputData["scd_nurscare_days"] = ""   // 二级护理天数  必填
2166
-//	inputData["lv3_nurscare_days"] = ""   // 三级护理天数  必填
2167
-//	inputData["acp_medins_name"] = ""   // 拟接收机构名称  必填
2168
-//	inputData["acp_optins_code"] = ""   // 拟接收机构代码  必填
2169
-//	inputData["bill_code"] = ""   // 票据代码  必填
2170
-//	inputData["bill_no"] = ""   // 票据号码  必填
2171
-//	inputData["biz_sn"] = ""   // 业务流水号  必填
2172
-//	inputData["days_rinp_flag_31"] = ""   // 出院 31 天内再住院计划标志  必填
2173
-//	inputData["days_rinp_pup_31"] = ""   // 出院 31 天内再住院目的  必填
2174
-//	inputData["chfpdr_name"] = ""   // 主诊医师姓名  必填
2175
-//	inputData["chfpdr_code"] = ""   // 主诊医师代码  必填
2176
-//	inputData["setl_begn_date"] = ""   // 结算开始日期  必填
2177
-//	inputData["setl_end_date"] = ""   // 结算结束日期  必填
2178
-//	inputData["psn_selfpay"] = ""   // 个人自付  必填
2179
-//	inputData["psn_ownpay"] = ""   // 个人自费  必填
2180
-//	inputData["acct_pay"] = ""   // 个人账户支出  必填
2181
-//	inputData["hi_paymtd"] = ""   // 医保支付方式  必填
2182
-//	inputData["hsorg"] = ""   // 医保机构  必填
2183
-//	inputData["hsorg_opter"] = ""   // 医保机构经办人  必填
2184
-//	inputData["medins_fill_dept"] = ""   // 医疗机构填报部门  必填
2185
-//	inputData["medins_fill_psn"] = ""   // 医疗机构填报人  必填
2186
-//
2187
-//	payinfo := make([]map[string]interface{},0)  // 基金支付信息
2188
-//	payinfotemp := make(map[string]interface{})
2189
-//	payinfotemp["fund_pay_type"] =  "" // 基金支付类型  必填
2190
-//	payinfotemp["fund_payamt"] = ""    // 基金支付金额
2191
-//	payinfo = append(payinfo,payinfotemp)
2192
-//
2193
-//	opspdiseinfo := make([]map[string]interface{},0) // 门诊慢特病诊断信息
2194
-//	opspdiseinfotemp := make(map[string]interface{})
2195
-//	opspdiseinfotemp["diag_name"] =  "" // 诊断名称  必填
2196
-//	opspdiseinfotemp["diag_code"] = ""    // 诊断代码 必填
2197
-//	opspdiseinfotemp["oprn_oprt_name"] = ""    // 手术操作名称 必填
2198
-//	opspdiseinfotemp["oprn_oprt_code"] = ""    // 手术操作代码 必填
2199
-//	opspdiseinfo = append(opspdiseinfo,opspdiseinfotemp)
2200
-//
2201
-//	diseinfo := make([]map[string]interface{},0) // 住院诊断信息
2202
-//	diseinfotemp := make(map[string]interface{})
2203
-//	diseinfotemp["diag_type"] =  "" // 诊断类别  必填
2204
-//	diseinfotemp["diag_code"] = ""    // 诊断代码 必填
2205
-//	diseinfotemp["diag_name"] = ""    // 诊断名称 必填
2206
-//	diseinfotemp["adm_cond_type"] = ""    // 入院病情类型 必填
2207
-//	diseinfo = append(diseinfo,diseinfotemp)
2208
-//
2209
-//	iteminfo := make([]map[string]interface{},0) // 住院诊断信息
2210
-//	iteminfotemp := make(map[string]interface{})
2211
-//	iteminfotemp["med_chrgitm"] =  "" // 医疗收费项目  必填
2212
-//	iteminfotemp["amt"] = ""    // 金额 必填
2213
-//	iteminfotemp["claa_sumfee"] = ""    // 甲类费用合计 必填
2214
-//	iteminfotemp["clab_amt"] = ""    // 乙类金额 必填
2215
-//	iteminfotemp["fulamt_ownpay_amt"] = ""    // 全自费金额 必填
2216
-//	iteminfotemp["oth_amt"] = ""    // 其他金额 必填
2217
-//	iteminfo = append(iteminfo,iteminfotemp)
2218
-//
2219
-//	oprninfo := make([]map[string]interface{},0) // 手术操作信息
2220
-//	oprninfotemp := make(map[string]interface{})
2221
-//	oprninfotemp["oprn_oprt_type"] =  "" // 手术操作类别  必填
2222
-//	oprninfotemp["oprn_oprt_name"] = ""    // 手术操作名称 必填
2223
-//	oprninfotemp["oprn_oprt_code"] = ""    // 手术操作代码 必填
2224
-//	oprninfotemp["oprn_oprt_date"] = ""    // 手术操作日期 必填
2225
-//	oprninfotemp["anst_way"] = ""    // 麻醉方式 必填
2226
-//	oprninfotemp["oper_dr_name"] = ""    // 术者医师姓名 必填
2227
-//	oprninfotemp["oper_dr_code"] = ""    // 术者医师代码 必填
2228
-//	oprninfotemp["anst_dr_name"] = ""    // 麻醉医师姓名 必填
2229
-//	oprninfotemp["anst_dr_code"] = ""    // 麻醉医师代码 必填
2230
-//	oprninfo = append(oprninfo,iteminfotemp)
2231
-//
2232
-//	icuinfo := make([]map[string]interface{},0) // 重症监护信息
2233
-//	icuinfotemp := make(map[string]interface{})
2234
-//	icuinfotemp["scs_cutd_ward_type"] =  "" // 重症监护病房类型  必填
2235
-//	icuinfotemp["scs_cutd_inpool_time"] = ""    // 重症监护进入时间 必填
2236
-//	icuinfotemp["scs_cutd_exit_time"] = ""    // 重症监护退出时间 必填
2237
-//	icuinfotemp["scs_cutd_sum_dura"] = ""    // 重症监护合计时长 必填
2238
-//	icuinfo = append(icuinfo,iteminfotemp)
2239
-//
2240
-//
2241
-//
2242
-//
2243
-//	input["setlinfo"] = inputData
2244
-//	input["payinfo"] = payinfo
2245
-//	input["opspdiseinfo"] = opspdiseinfo
2246
-//	input["diseinfo"] = diseinfo
2247
-//	input["iteminfo"] = iteminfo
2248
-//	input["oprninfo"] = oprninfo
2249
-//	input["icuinfo"] = icuinfo
2250
-//	inputMessage["input"] = input //交易输入
2251
-//
2252
-//	bytesData, err := json.Marshal(inputMessage)
2253
-//	fmt.Println(string(bytesData))
2254
-//	if err != nil {
2255
-//		fmt.Println(err.Error())
2256
-//		return err.Error()
2257
-//	}
2258
-//	reader := bytes.NewReader(bytesData)
2259
-//
2260
-//	url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2208"
2261
-//	request, err := http.NewRequest("POST", url, reader)
2262
-//	if err != nil {
2263
-//		fmt.Println(err.Error())
2264
-//		return err.Error()
2265
-//	}
2266
-//
2267
-//	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
2268
-//	request.Header.Set("x-tif-paasid", "test_hosp")
2269
-//	request.Header.Set("x-tif-signature", signature)
2270
-//	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
2271
-//	request.Header.Set("x-tif-nonce", nonce)
2095
+type CustomStruct struct {
2096
+	FundPayType string
2097
+	FundPayamt  string
2098
+}
2099
+
2100
+type OpspdiseinfoStruct struct {
2101
+	DiagName     string
2102
+	DiagCode     string
2103
+	OprnOprtName string
2104
+	OprnOprtCode string
2105
+	MaindiagFlag string
2106
+}
2107
+
2108
+type IteminfoStruct struct {
2109
+	MedChrgitm      string
2110
+	Amt             float64
2111
+	ClaaSumfee      float64
2112
+	ClabAmt         float64
2113
+	FulamtOwnpayAmt float64
2114
+	OthAmt          float64
2115
+}
2116
+
2117
+type Struct4101 struct {
2118
+	PsnNo              string
2119
+	MdtrtId            string
2120
+	SetlId             string
2121
+	HiSetlLv           string
2122
+	PsnName            string
2123
+	Gend               string
2124
+	Brdy               string
2125
+	Ntly               string
2126
+	Naty               string
2127
+	PatnCertType       string
2128
+	Certno             string
2129
+	Prfs               string
2130
+	ConerName          string
2131
+	PatnRlts           string
2132
+	ConerAddr          string
2133
+	ConerTel           string
2134
+	HiType             string
2135
+	Insuplc            string
2136
+	AdmCaty            string
2137
+	DscgCaty           string
2138
+	MaindiagFlag       string
2139
+	BillCode           string
2140
+	BillNo             string
2141
+	BizSn              string
2142
+	SetlBegnDate       string
2143
+	SetlEndDate        string
2144
+	PsnSelfPay         string
2145
+	PsnOwnPay          string
2146
+	AcctPay            string
2147
+	PsnCashpay         string
2148
+	HiPaymtd           string
2149
+	Hsorg              string
2150
+	HsorgOpter         string
2151
+	MedinsFillDept     string
2152
+	MedinsFillPsn      string
2153
+	CustomStruct       []CustomStruct
2154
+	OpspdiseinfoStruct []OpspdiseinfoStruct
2155
+	IteminfoStruct     []IteminfoStruct
2156
+}
2157
+
2272 2158
 //
2273
-//	client := http.Client{}
2274
-//	resp, err := client.Do(request)
2275
-//	if err != nil {
2276
-//		fmt.Println(err.Error())
2277
-//		return err.Error()
2278
-//	}
2279
-//	respBytes, err := ioutil.ReadAll(resp.Body)
2280
-//	if err != nil {
2281
-//		fmt.Println(err.Error())
2282
-//		return err.Error()
2283
-//	}
2284
-//	str := string(respBytes)
2285
-//	fmt.Println(str)
2286
-//	return str
2287
-//}
2159
+func Gdyb4101(struct4101 Struct4101, mdtrtId string, setlId string, secret_key string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string) string {
2160
+	// 生成签名
2161
+	nonce := GetRandomString(32)
2162
+	timestamp := time.Now().Unix()
2163
+	signature := setSignature(timestamp, nonce, secret_key)
2164
+
2165
+	// 生成输入报文
2166
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
2167
+	input := make(map[string]interface{})
2168
+	inputData := make(map[string]interface{})
2169
+	inputMessage["infno"] = "4101" // 交易编码
2170
+
2171
+	year := time.Now().Format("2006")
2172
+	month := time.Now().Format("01")
2173
+	day := time.Now().Format("02")
2174
+
2175
+	inputData["mdtrt_id"] = mdtrtId                           // 就诊 ID  必填(来自2201接口返回)
2176
+	inputData["setl_id"] = setlId                             // 结算 ID  必填
2177
+	inputData["fixmedins_name"] = org_name                    // 定点医药机构名称  必填
2178
+	inputData["fixmedins_code"] = fixmedins_code              // 定点医药机构编码  必填
2179
+	inputData["hi_setl_lv"] = ""                              // 医保结算等级
2180
+	inputData["hi_no"] = ""                                   // 医保编号
2181
+	inputData["medcasno"] = struct4101.PsnNo                  // 病案号  必填
2182
+	inputData["dcla_time"] = year + "-" + month + "-" + day   // 申报时间  必填
2183
+	inputData["psn_name"] = struct4101.PsnName                // 人员姓名  必填
2184
+	inputData["gend"] = struct4101.Gend                       // 性别  必填
2185
+	inputData["brdy"] = struct4101.Brdy                       // 出生日期  必填
2186
+	inputData["age"] = ""                                     // 年龄  必填
2187
+	inputData["ntly"] = struct4101.Ntly                       // 国籍  必填
2188
+	inputData["nwb_age"] = ""                                 // 年龄  必填
2189
+	inputData["naty"] = struct4101.Naty                       // 民族  必填
2190
+	inputData["patn_cert_type"] = struct4101.PatnCertType     // 患者证件类别  必填
2191
+	inputData["certno"] = struct4101.Certno                   // 证件号码  必填
2192
+	inputData["prfs"] = struct4101.Prfs                       // 职业  必填
2193
+	inputData["curr_addr"] = ""                               // 现住址  必填
2194
+	inputData["emp_name"] = ""                                // 单位名称  必填
2195
+	inputData["emp_addr"] = ""                                // 单位地址  必填
2196
+	inputData["emp_tel"] = ""                                 // 单位电话  必填
2197
+	inputData["poscode"] = ""                                 // 邮编  必填
2198
+	inputData["coner_name"] = struct4101.ConerName            // 联系人姓名  必填
2199
+	inputData["patn_rlts"] = struct4101.PatnRlts              // 与患者关系  必填
2200
+	inputData["coner_addr"] = struct4101.ConerAddr            // 联系人地址  必填
2201
+	inputData["coner_tel"] = struct4101.ConerTel              // 联系人电话  必填
2202
+	inputData["hi_type"] = struct4101.HiType                  // 医保类型  必填
2203
+	inputData["insuplc"] = struct4101.Insuplc                 // 参保地  必填
2204
+	inputData["sp_psn_type"] = ""                             // 特殊人员类型  必填
2205
+	inputData["nwb_adm_type"] = ""                            // 新生儿入院类型  必填
2206
+	inputData["nwb_bir_wt"] = ""                              // 新生儿出生体重  必填
2207
+	inputData["nwb_adm_wt"] = ""                              // 新生儿入院体重  必填
2208
+	inputData["opsp_diag_caty"] = ""                          // 门诊慢特病诊断  必填
2209
+	inputData["opsp_mdtrt_date"] = ""                         // 门诊慢特病就诊日期  必填
2210
+	inputData["ipt_med_type"] = ""                            // 住院医疗类型  必填
2211
+	inputData["adm_way"] = ""                                 // 入院途径  必填
2212
+	inputData["trt_type"] = ""                                // 治疗类别  必填
2213
+	inputData["adm_time"] = ""                                // 入院时间  必填
2214
+	inputData["adm_caty"] = struct4101.AdmCaty                // 入院科别  必填
2215
+	inputData["refldept_dept"] = ""                           // 转科科别  必填
2216
+	inputData["dscg_time"] = ""                               // 出院时间  必填
2217
+	inputData["dscg_caty"] = ""                               // 出院科别  必填
2218
+	inputData["act_ipt_days"] = ""                            // 实际住院天数  必填
2219
+	inputData["otp_wm_dise"] = ""                             // 门(急) 诊西医诊断  必填
2220
+	inputData["wm_dise_code"] = ""                            // 门(急) 诊中医诊断  必填
2221
+	inputData["otp_tcm_dise"] = ""                            // 西医诊断疾病代码  必填
2222
+	inputData["tcm_dise_code"] = ""                           // 中医诊断代码  必填
2223
+	inputData["oprn_oprt_code_cnt"] = ""                      // 手术操作代码计数  必填
2224
+	inputData["vent_used_dura"] = ""                          // 呼吸机使用时长  必填
2225
+	inputData["pwcry_bfadm_coma_dura"] = ""                   // 颅脑损伤患者入院前昏迷时长  必填
2226
+	inputData["pwcry_afadm_coma_dura"] = ""                   // 颅脑损伤患者入院后昏迷时长  必填
2227
+	inputData["bld_cat"] = ""                                 // 输血品种  必填
2228
+	inputData["bld_amt"] = ""                                 // 输血量  必填
2229
+	inputData["bld_unt"] = ""                                 // 输血计量单位  必填
2230
+	inputData["spga_nurscare_days"] = ""                      // 特级护理天数  必填
2231
+	inputData["lv1_nurscare_days"] = ""                       // 一级护理天数  必填
2232
+	inputData["scd_nurscare_days"] = ""                       // 二级护理天数  必填
2233
+	inputData["lv3_nurscare_days"] = ""                       // 三级护理天数  必填
2234
+	inputData["acp_medins_name"] = ""                         // 拟接收机构名称  必填
2235
+	inputData["acp_optins_code"] = ""                         // 拟接收机构代码  必填
2236
+	inputData["bill_code"] = struct4101.BillCode              // 票据代码  必填
2237
+	inputData["bill_no"] = struct4101.BillNo                  // 票据号码  必填
2238
+	inputData["biz_sn"] = struct4101.BizSn                    // 业务流水号  必填
2239
+	inputData["days_rinp_flag_31"] = ""                       // 出院 31 天内再住院计划标志  必填
2240
+	inputData["days_rinp_pup_31"] = ""                        // 出院 31 天内再住院目的  必填
2241
+	inputData["chfpdr_name"] = ""                             // 主诊医师姓名  必填
2242
+	inputData["chfpdr_code"] = ""                             // 主诊医师代码  必填
2243
+	inputData["setl_begn_date"] = struct4101.SetlBegnDate     // 结算开始日期  必填
2244
+	inputData["setl_end_date"] = struct4101.SetlEndDate       // 结算结束日期  必填
2245
+	inputData["psn_selfpay"] = struct4101.PsnSelfPay          // 个人自付  必填
2246
+	inputData["psn_ownpay"] = struct4101.PsnOwnPay            // 个人自费  必填
2247
+	inputData["acct_pay"] = struct4101.AcctPay                // 个人账户支出  必填
2248
+	inputData["hi_paymtd"] = struct4101.HiPaymtd              // 医保支付方式  必填
2249
+	inputData["hsorg"] = struct4101.Hsorg                     // 医保机构  必填
2250
+	inputData["hsorg_opter"] = struct4101.HsorgOpter          // 医保机构经办人  必填
2251
+	inputData["medins_fill_dept"] = struct4101.MedinsFillDept // 医疗机构填报部门  必填
2252
+	inputData["medins_fill_psn"] = struct4101.MedinsFillPsn   // 医疗机构填报人  必填
2253
+
2254
+	payinfo := make([]map[string]interface{}, 0) // 基金支付信息
2255
+	payinfotemp := make(map[string]interface{})
2256
+	for _, item := range struct4101.CustomStruct {
2257
+		payinfotemp["fund_pay_type"] = item.FundPayType // 基金支付类型  必填
2258
+		payinfotemp["fund_payamt"] = item.FundPayamt    // 基金支付金额
2259
+		payinfo = append(payinfo, payinfotemp)
2260
+	}
2261
+
2262
+	opspdiseinfo := make([]map[string]interface{}, 0) // 门诊慢特病诊断信息
2263
+	opspdiseinfotemp := make(map[string]interface{})
2264
+	for _, item := range struct4101.OpspdiseinfoStruct {
2265
+		opspdiseinfotemp["diag_name"] = item.DiagName // 诊断名称  必填
2266
+		opspdiseinfotemp["diag_code"] = item.DiagCode // 诊断代码 必填
2267
+		opspdiseinfotemp["oprn_oprt_name"] = ""       // 手术操作名称 必填
2268
+		opspdiseinfotemp["oprn_oprt_code"] = ""       // 手术操作代码 必填
2269
+		opspdiseinfo = append(opspdiseinfo, opspdiseinfotemp)
2270
+	}
2271
+
2272
+	diseinfo := make([]map[string]interface{}, 0) // 住院诊断信息
2273
+	diseinfotemp := make(map[string]interface{})
2274
+	diseinfotemp["diag_type"] = ""     // 诊断类别  必填
2275
+	diseinfotemp["diag_code"] = ""     // 诊断代码 必填
2276
+	diseinfotemp["diag_name"] = ""     // 诊断名称 必填
2277
+	diseinfotemp["adm_cond_type"] = "" // 入院病情类型 必填
2278
+	diseinfo = append(diseinfo, diseinfotemp)
2279
+
2280
+	iteminfo := make([]map[string]interface{}, 0) // 住院诊断信息
2281
+	iteminfotemp := make(map[string]interface{})
2282
+	for _, item := range struct4101.IteminfoStruct {
2283
+		iteminfotemp["med_chrgitm"] = item.MedChrgitm            // 医疗收费项目  必填
2284
+		iteminfotemp["amt"] = item.Amt                           // 金额 必填
2285
+		iteminfotemp["claa_sumfee"] = item.ClaaSumfee            // 甲类费用合计 必填
2286
+		iteminfotemp["clab_amt"] = item.ClabAmt                  // 乙类金额 必填
2287
+		iteminfotemp["fulamt_ownpay_amt"] = item.FulamtOwnpayAmt // 全自费金额 必填
2288
+		iteminfotemp["oth_amt"] = item.OthAmt                    // 其他金额 必填
2289
+		iteminfo = append(iteminfo, iteminfotemp)
2290
+	}
2291
+
2292
+	oprninfo := make([]map[string]interface{}, 0) // 手术操作信息
2293
+	oprninfotemp := make(map[string]interface{})
2294
+	oprninfotemp["oprn_oprt_type"] = "" // 手术操作类别  必填
2295
+	oprninfotemp["oprn_oprt_name"] = "" // 手术操作名称 必填
2296
+	oprninfotemp["oprn_oprt_code"] = "" // 手术操作代码 必填
2297
+	oprninfotemp["oprn_oprt_date"] = "" // 手术操作日期 必填
2298
+	oprninfotemp["anst_way"] = ""       // 麻醉方式 必填
2299
+	oprninfotemp["oper_dr_name"] = ""   // 术者医师姓名 必填
2300
+	oprninfotemp["oper_dr_code"] = ""   // 术者医师代码 必填
2301
+	oprninfotemp["anst_dr_name"] = ""   // 麻醉医师姓名 必填
2302
+	oprninfotemp["anst_dr_code"] = ""   // 麻醉医师代码 必填
2303
+	oprninfo = append(oprninfo, iteminfotemp)
2304
+
2305
+	icuinfo := make([]map[string]interface{}, 0) // 重症监护信息
2306
+	icuinfotemp := make(map[string]interface{})
2307
+	icuinfotemp["scs_cutd_ward_type"] = ""   // 重症监护病房类型  必填
2308
+	icuinfotemp["scs_cutd_inpool_time"] = "" // 重症监护进入时间 必填
2309
+	icuinfotemp["scs_cutd_exit_time"] = ""   // 重症监护退出时间 必填
2310
+	icuinfotemp["scs_cutd_sum_dura"] = ""    // 重症监护合计时长 必填
2311
+	icuinfo = append(icuinfo, iteminfotemp)
2312
+
2313
+	input["setlinfo"] = inputData
2314
+	input["payinfo"] = payinfo
2315
+	input["opspdiseinfo"] = opspdiseinfo
2316
+	input["diseinfo"] = diseinfo
2317
+	input["iteminfo"] = iteminfo
2318
+	input["oprninfo"] = oprninfo
2319
+	input["icuinfo"] = icuinfo
2320
+	inputMessage["input"] = input //交易输入
2321
+
2322
+	bytesData, err := json.Marshal(inputMessage)
2323
+	fmt.Println(string(bytesData))
2324
+	if err != nil {
2325
+		fmt.Println(err.Error())
2326
+		return err.Error()
2327
+	}
2328
+	reader := bytes.NewReader(bytesData)
2329
+
2330
+	gdyb_url := beego.AppConfig.String("gdyb_url")
2331
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
2332
+	url := gdyb_url + "4101"
2333
+
2334
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/4101"
2335
+	request, err := http.NewRequest("POST", url, reader)
2336
+	if err != nil {
2337
+		fmt.Println(err.Error())
2338
+		return err.Error()
2339
+	}
2340
+
2341
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
2342
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
2343
+	request.Header.Set("x-tif-signature", signature)
2344
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
2345
+	request.Header.Set("x-tif-nonce", nonce)
2346
+
2347
+	client := http.Client{}
2348
+	resp, err := client.Do(request)
2349
+	if err != nil {
2350
+		fmt.Println(err.Error())
2351
+		return err.Error()
2352
+	}
2353
+	respBytes, err := ioutil.ReadAll(resp.Body)
2354
+	if err != nil {
2355
+		fmt.Println(err.Error())
2356
+		return err.Error()
2357
+	}
2358
+	str := string(respBytes)
2359
+	fmt.Println(str)
2360
+	return str
2361
+}
2288 2362
 
2289 2363
 // 生成签名
2290 2364
 func setSignature(timestamp int64, nonce string, secret_key string) string {

+ 5 - 0
service/his_service.go Zobrazit soubor

@@ -466,6 +466,11 @@ func GetNewVMHisPatientInfo(org_id int64, patient_id int64, record_date int64) (
466 466
 	return
467 467
 }
468 468
 
469
+func GetNewHisPatientRecord(org_id int64, id int64) (info models.VMHisPatient, err error) {
470
+	err = readDb.Model(&models.VMHisPatient{}).Where("user_org_id = ? AND status = 1 AND patient_id = ?", org_id, id).First(&info).Error
471
+	return
472
+}
473
+
469 474
 func GetHisPatientRecord(org_id int64, id int64) (info models.VMHisPatient, err error) {
470 475
 	err = readDb.Model(&models.VMHisPatient{}).Where("user_org_id = ? AND status = 1 AND id = ?", org_id, id).First(&info).Error
471 476
 	return