陈少旭 4 周前
父节点
当前提交
9218e71344
共有 3 个文件被更改,包括 1045 次插入12 次删除
  1. 285 6
      controllers/sg/his_api_controller.go
  2. 750 0
      service/ah_dianzichufang.go
  3. 10 6
      service/his_service.go

+ 285 - 6
controllers/sg/his_api_controller.go 查看文件

@@ -34,8 +34,6 @@ import (
34 34
 	"syscall"
35 35
 	"time"
36 36
 	"unsafe"
37
-	"github.com/go-ole/go-ole"
38
-
39 37
 )
40 38
 
41 39
 type HisApiController struct {
@@ -209,7 +207,7 @@ func HisManagerApiRegistRouters() {
209 207
 	beego.Router("/api/changedrug/five", &HisApiController{}, "get:ChangeDrugFive")
210 208
 
211 209
 	beego.Router("/api/delete_xs_bg_two", &HisApiController{}, "get:DeleteXSandBGTwo")
212
-	beego.Router("/api/delete_xs_bg_two", &HisApiController{}, "get:DeleteXSandBGTwo")
210
+	beego.Router("/api/delete_xs_bg_three", &HisApiController{}, "get:DeleteXSandBGThree")
213 211
 
214 212
 	beego.Router("/api/3201", &HisApiController{}, "get:Get3201")
215 213
 
@@ -2939,6 +2937,213 @@ func (c *HisApiController) DeleteXSandBGTwo() {
2939 2937
 
2940 2938
 }
2941 2939
 
2940
+func (c *HisApiController) DeleteXSandBGThree() {
2941
+	id, _ := c.GetInt64("id")
2942
+	admin_user_id, _ := c.GetInt64("admin_user_id")
2943
+
2944
+	advicelist, _ := service.FindHisAdviceDocAdvice(id)
2945
+	var flows []*models.DrugFlow
2946
+	for _, item := range advicelist {
2947
+		flow, _ := service.GetNewUploadDrugFlowInfoByPatientTwo(item.PatientId, item.DrugId, item.RecordDate, c.GetAdminUserInfo().CurrentOrgId)
2948
+		flows = append(flows, flow...)
2949
+	}
2950
+
2951
+	//flows, _ := service.GetNewDrugFlowInfo(c.GetAdminUserInfo().CurrentOrgId, id_arr)
2952
+	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
2953
+	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
2954
+
2955
+	var err []string
2956
+	for _, item := range flows {
2957
+		if item.IsSale == 1 {
2958
+			var res FJ3507Result
2959
+
2960
+			var struct3507 models.Struct3507
2961
+			struct3507.FixmedinsBchno = item.Bchno
2962
+			struct3507.InvDataType = "4"
2963
+			struct3507.Opter = roles.UserName
2964
+			struct3507.OrgName = miConfig.OrgName
2965
+			struct3507.AccessKey = miConfig.AccessKey
2966
+			struct3507.RequestUrl = miConfig.Url
2967
+			struct3507.FixmedinsCode = miConfig.Code
2968
+			struct3507.SecretKey = miConfig.SecretKey
2969
+			struct3507.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
2970
+			struct3507.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
2971
+			struct3507.Url = miConfig.Url
2972
+			struct3507.AppId = miConfig.Cainfo
2973
+			struct3507.AppSecret = miConfig.AppSecret
2974
+			struct3507.Enckey = miConfig.EncKey
2975
+			struct3507.SignKey = miConfig.SignKey
2976
+			struct3507.SecretKey = miConfig.SecretKey
2977
+
2978
+			if miConfig.MdtrtareaAdmvs == "350500" {
2979
+				result, result1, _ := service.FJyb3507(struct3507)
2980
+				saveLog(result, result1, "3507", "3507")
2981
+				var respJSON2 map[string]interface{}
2982
+				if err := json.Unmarshal([]byte(string(result)), &respJSON2); err != nil {
2983
+					utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
2984
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2985
+					return
2986
+				}
2987
+				userJSONBytes2, _ := json.Marshal(respJSON2)
2988
+				if err := json.Unmarshal(userJSONBytes2, &res); err != nil {
2989
+					utils.ErrorLog("解析失败:%v", err)
2990
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2991
+					return
2992
+				}
2993
+			} else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
2994
+				data := make(map[string]interface{})
2995
+				data["struct_3507s"] = struct3507
2996
+				client := &http.Client{}
2997
+				bytesData, _ := json.Marshal(data)
2998
+				var req *http.Request
2999
+				if miConfig.MdtrtareaAdmvs == "320921" {
3000
+					req, _ = http.NewRequest("POST", "http://192.168.2.3:9532/"+"jsyb/3507", bytes.NewReader(bytesData))
3001
+				} else {
3002
+					req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3507", bytes.NewReader(bytesData))
3003
+				}
3004
+
3005
+				resp, _ := client.Do(req)
3006
+				defer resp.Body.Close()
3007
+				body, ioErr := ioutil.ReadAll(resp.Body)
3008
+				if ioErr != nil {
3009
+					utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
3010
+				}
3011
+				var respJSON map[string]interface{}
3012
+				if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
3013
+					utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
3014
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3015
+					return
3016
+				}
3017
+				var resSix10265 ResultSix10265 //1101结果
3018
+				respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
3019
+				result, _ := json.Marshal(respJSON)
3020
+				if err := json.Unmarshal([]byte(result), &resSix10265); err != nil {
3021
+					utils.ErrorLog("解析失败:%v", err)
3022
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3023
+					return
3024
+				}
3025
+				res.InfRefmsgid = resSix10265.InfRefmsgid
3026
+				//res.Output = resSix10265.Output
3027
+				res.ErrMsg = resSix10265.ErrMsg
3028
+				res.Cainfo = resSix10265.Cainfo
3029
+				res.WarnMsg = resSix10265.WarnMsg
3030
+				infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
3031
+				res.Infcode = infocode
3032
+			} else if miConfig.MdtrtareaAdmvs == "440100" {
3033
+				result1, result2 := service.Gzyb3507(struct3507, struct3507.SecretKey)
3034
+				saveLog(result2, result1, "3507", "3507")
3035
+				var respJSON2 map[string]interface{}
3036
+				if err := json.Unmarshal([]byte(string(result1)), &respJSON2); err != nil {
3037
+					utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
3038
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3039
+					return
3040
+				}
3041
+				userJSONBytes2, _ := json.Marshal(respJSON2)
3042
+				if err := json.Unmarshal(userJSONBytes2, &res); err != nil {
3043
+					utils.ErrorLog("解析失败:%v", err)
3044
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3045
+					return
3046
+				}
3047
+			} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "440") {
3048
+				result1, result2 := service.Gdyb3507(struct3507, struct3507.SecretKey)
3049
+				saveLog(result2, result1, "3507", "3507")
3050
+				var respJSON2 map[string]interface{}
3051
+				if err := json.Unmarshal([]byte(string(result1)), &respJSON2); err != nil {
3052
+					utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
3053
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3054
+					return
3055
+				}
3056
+				userJSONBytes2, _ := json.Marshal(respJSON2)
3057
+				if err := json.Unmarshal(userJSONBytes2, &res); err != nil {
3058
+					utils.ErrorLog("解析失败:%v", err)
3059
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3060
+					return
3061
+				}
3062
+			} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "361") {
3063
+				result1, result2 := service.Jxyb3507(struct3507)
3064
+				saveLog(result2, result1, "3507", "3507")
3065
+				var respJSON2 map[string]interface{}
3066
+				if err := json.Unmarshal([]byte(string(result1)), &respJSON2); err != nil {
3067
+					utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
3068
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3069
+					return
3070
+				}
3071
+				userJSONBytes2, _ := json.Marshal(respJSON2)
3072
+				if err := json.Unmarshal(userJSONBytes2, &res); err != nil {
3073
+					utils.ErrorLog("解析失败:%v", err)
3074
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3075
+					return
3076
+				}
3077
+			} else if miConfig.MdtrtareaAdmvs == "340699" {
3078
+				result1, result2 := service.AHyb3507(struct3507)
3079
+				saveLog(result2, result1, "3507", "3507")
3080
+				var respJSON2 map[string]interface{}
3081
+				if err := json.Unmarshal([]byte(string(result1)), &respJSON2); err != nil {
3082
+					utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
3083
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3084
+					return
3085
+				}
3086
+				userJSONBytes2, _ := json.Marshal(respJSON2)
3087
+				if err := json.Unmarshal(userJSONBytes2, &res); err != nil {
3088
+					utils.ErrorLog("解析失败:%v", err)
3089
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3090
+					return
3091
+				}
3092
+			} else if miConfig.MdtrtareaAdmvs == "150499" {
3093
+
3094
+				data := make(map[string]interface{})
3095
+				data["struct_3507s"] = struct3507
3096
+				client := &http.Client{}
3097
+				bytesData, _ := json.Marshal(data)
3098
+				var req *http.Request
3099
+
3100
+				req, _ = http.NewRequest("POST", "http://172.16.13.254:9532"+"/nmyb/3507", bytes.NewReader(bytesData))
3101
+
3102
+				resp, _ := client.Do(req)
3103
+				defer resp.Body.Close()
3104
+				body, ioErr := ioutil.ReadAll(resp.Body)
3105
+				if ioErr != nil {
3106
+					utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
3107
+				}
3108
+				var respJSON map[string]interface{}
3109
+				if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
3110
+					utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
3111
+				}
3112
+
3113
+				var resSix10265 ResultSix10265 //1101结果
3114
+				respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
3115
+				result, _ := json.Marshal(respJSON)
3116
+				if err := json.Unmarshal([]byte(result), &resSix10265); err != nil {
3117
+					utils.ErrorLog("解析失败:%v", err)
3118
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3119
+					return
3120
+				}
3121
+				res.InfRefmsgid = resSix10265.InfRefmsgid
3122
+				res.ErrMsg = resSix10265.ErrMsg
3123
+				res.Cainfo = resSix10265.Cainfo
3124
+				res.WarnMsg = resSix10265.WarnMsg
3125
+				infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
3126
+				res.Infcode = infocode
3127
+			}
3128
+
3129
+			if res.Infcode == 0 {
3130
+				service.SaveDoctoradviceStatusTwo(item.HisDoctorAdviceInfo.ID)
3131
+				item.IsSale = 0
3132
+				item.SaleDate = ""
3133
+				item.Bchno = ""
3134
+				service.SaveDF(item)
3135
+			} else {
3136
+				err = append(err, "删除"+item.HisDoctorAdviceInfo.BaseDrugLib.DrugName+"盘存失败,失败原因:"+res.ErrMsg)
3137
+			}
3138
+		}
3139
+	}
3140
+
3141
+	c.ServeSuccessJSON(map[string]interface{}{
3142
+		"msg": "删除销售数据成功",
3143
+	})
3144
+
3145
+}
3146
+
2942 3147
 // 获取当天起止时间戳
2943 3148
 func GetNowTime() (int64, int64) {
2944 3149
 	t := time.Now()
@@ -3034,6 +3239,81 @@ func (c *HisApiController) ChangeDrugfour() {
3034 3239
 
3035 3240
 }
3036 3241
 
3242
+func (c *HisApiController) ChangeDrugFive() {
3243
+	id, _ := c.GetInt64("id")
3244
+	admin_user_id, _ := c.GetInt64("admin_user_id")
3245
+	advicelist, _ := service.FindHisAdviceDocAdvice(id)
3246
+	var flows []*models.DrugFlow
3247
+	for _, item := range advicelist {
3248
+		flow, _ := service.GetNewDrugFlowInfoByPatient(item.PatientId, item.DrugId, item.RecordDate, c.GetAdminUserInfo().CurrentOrgId)
3249
+		flows = append(flows, flow...)
3250
+	}
3251
+	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
3252
+	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
3253
+	var err []string
3254
+	for _, item := range flows {
3255
+		if item.ConsumableType == 3 { //3为自动出库 7为自动退库
3256
+			prescription := service.GetHisPrescriptionByID(item.HisDoctorAdviceInfo.PrescriptionId)
3257
+			if prescription.OrderStatus == 2 {
3258
+				if item.IsSale == 0 {
3259
+					var res FJ3507Result
3260
+					var res3507for10188 FJ3507ResultFor10188
3261
+					number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3505"
3262
+					//进行商品销售接口
3263
+					result3, result4 := SaleStock(c.GetAdminUserInfo().CurrentOrgId, prescription, item, miConfig, "", roles, number)
3264
+					saveLog(result3, result4, "3505", "自动出库,未销售进行销售行为,3505")
3265
+					var respJSON3 map[string]interface{}
3266
+					if err := json.Unmarshal([]byte(string(result3)), &respJSON3); err != nil {
3267
+						utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
3268
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3269
+						return
3270
+					}
3271
+					userJSONBytes3, _ := json.Marshal(respJSON3)
3272
+					if c.GetAdminUserInfo().CurrentOrgId == 10188 || c.GetAdminUserInfo().CurrentOrgId == 10217 {
3273
+						if err := json.Unmarshal(userJSONBytes3, &res3507for10188); err != nil {
3274
+							utils.ErrorLog("解析失败:%v", err)
3275
+							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3276
+							return
3277
+						}
3278
+						//if res3507for10188.Infcode
3279
+						res.InfRefmsgid = res3507for10188.InfRefmsgid
3280
+						//res.Output = resSix10265.Output
3281
+						res.ErrMsg = res3507for10188.ErrMsg
3282
+						res.Cainfo = res3507for10188.Cainfo
3283
+						res.WarnMsg = res3507for10188.WarnMsg
3284
+						infocode, _ := strconv.ParseInt(res3507for10188.Infcode, 10, 64)
3285
+						res.Infcode = infocode
3286
+					} else {
3287
+						if err := json.Unmarshal(userJSONBytes3, &res); err != nil {
3288
+							utils.ErrorLog("解析失败:%v", err)
3289
+							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3290
+							return
3291
+						}
3292
+					}
3293
+					if res.Infcode == 0 {
3294
+						service.SaveDoctoradviceStatus(item.HisDoctorAdviceInfo.ID)
3295
+						item.IsSale = 1
3296
+						item.Bchno = number
3297
+						item.SaleDate = time.Now().Format("2006-01-02")
3298
+						service.SaveDF(item)
3299
+					} else {
3300
+						err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售失败:"+res.ErrMsg)
3301
+					}
3302
+				}
3303
+			} else { //还没结,提示用户去结算,并药品追溯上传
3304
+				err = append(err, item.HisDoctorAdviceInfo.AdviceName+"还没结算,请结算后,在药品追溯页面上传")
3305
+			}
3306
+		}
3307
+	}
3308
+	str := strings.Join(err, " ")
3309
+	saveLog(str, str, "3505", "3505自动上传日志")
3310
+	c.ServeSuccessJSON(map[string]interface{}{
3311
+		"status": "1",
3312
+		"msg":    err,
3313
+	})
3314
+
3315
+}
3316
+
3037 3317
 //func (c *HisApiController) ChangeDrugfour() {
3038 3318
 //	patient_id, _ := c.GetInt64("patient_id")
3039 3319
 //	admin_user_id, _ := c.GetInt64("admin_user_id")
@@ -5194,11 +5474,11 @@ func SaleStock(org_id int64, pre models.HisPrescription, drug *models.DrugFlow,
5194 5474
 		struct3505.TrdnFlag = "1"
5195 5475
 	}
5196 5476
 
5197
-	if drug.HisDoctorAdviceInfo.ZeroFlag == 1{
5477
+	if drug.HisDoctorAdviceInfo.ZeroFlag == 1 {
5198 5478
 		struct3505.TrdnFlag = "1"
5199 5479
 	}
5200 5480
 
5201
-	if drug.HisDoctorAdviceInfo.ZeroFlag == 2{
5481
+	if drug.HisDoctorAdviceInfo.ZeroFlag == 2 {
5202 5482
 		struct3505.TrdnFlag = "0"
5203 5483
 
5204 5484
 	}
@@ -33487,7 +33767,6 @@ func (c *HisApiController) GetPreUploadInfo() {
33487 33767
 								saveLog(result, request_log, "2206", "预结算")
33488 33768
 							}
33489 33769
 
33490
-
33491 33770
 							//userJSONBytes, _ := json.Marshal(dat)
33492 33771
 							//
33493 33772
 							//if err := json.Unmarshal(userJSONBytes, &res); err != nil {

+ 750 - 0
service/ah_dianzichufang.go 查看文件

@@ -0,0 +1,750 @@
1
+package service
2
+
3
+import (
4
+	"bytes"
5
+	"encoding/json"
6
+	"fmt"
7
+	"gdyb/models"
8
+	"io/ioutil"
9
+	"net/http"
10
+	"strconv"
11
+	"time"
12
+)
13
+
14
+func GetAHCFYLJG001(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, cFYLJG001 models.CFYLJG001, isu string) (string, string) {
15
+	//生成签名
16
+	nonce := GetRandomString(32)
17
+	timestamp := time.Now().Unix()
18
+	signature := setSignature(timestamp, nonce, secret_key)
19
+	//生成输入报文
20
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
21
+	//input := make(map[string]interface{})
22
+	inputData := make(map[string]interface{}, 0)
23
+
24
+	inputMessage["infno"] = "CFYLJG001"
25
+
26
+	inputData["mdtrt_cert_type"] = cFYLJG001.MdtrtCertType
27
+	inputData["mdtrt_cert_no"] = cFYLJG001.MdtrtCertNo
28
+	inputData["card_sn"] = cFYLJG001.CardSn
29
+	inputData["ec_token"] = cFYLJG001.EcToken
30
+	inputData["auth_no"] = cFYLJG001.AuthNo
31
+	inputData["biz_type_code"] = cFYLJG001.BizTypeCode
32
+	inputData["insu_admdvs"] = cFYLJG001.InsuAdmdvs
33
+	inputData["hosp_rxno"] = cFYLJG001.HospRxno
34
+	inputData["init_rxno"] = cFYLJG001.InitRxno
35
+	inputData["rx_type_code"] = cFYLJG001.RxTypeCode
36
+	inputData["prsc_time"] = cFYLJG001.PrscTime
37
+	inputData["rx_drug_cnt"] = cFYLJG001.RxDrugCnt
38
+	inputData["rx_used_way_codg"] = cFYLJG001.RxUsedWayCodg
39
+	inputData["rx_used_way_name"] = cFYLJG001.RxUsedWayName
40
+	inputData["rx_frqu_codg"] = cFYLJG001.RxFrquCodg
41
+	inputData["rx_frqu_name"] = cFYLJG001.RxFrquName
42
+	inputData["rx_dosunt"] = cFYLJG001.RxDosunt
43
+	inputData["rx_doscnt"] = cFYLJG001.RxDoscnt
44
+	inputData["rx_drord_dscr"] = cFYLJG001.RxDrordDscr
45
+	inputData["vali_days"] = cFYLJG001.ValiDays
46
+	inputData["vali_end_time"] = cFYLJG001.ValiEndTime
47
+	inputData["rept_flag"] = cFYLJG001.ReptFlag
48
+	inputData["max_rept_cnt"] = cFYLJG001.MaxReptCnt
49
+	inputData["reptd_cnt"] = cFYLJG001.ReptdCnt
50
+	inputData["min_inrv_days"] = cFYLJG001.MinInrvDays
51
+	inputData["rx_cotn_flag"] = cFYLJG001.RxCotnFlag
52
+	inputData["long_rx_flag"] = cFYLJG001.LongRxFlag
53
+	inputData["mdtrtareaNo"] = cFYLJG001.MdtrtareaNo
54
+
55
+	rxdrugdetail := make([]map[string]interface{}, 0)
56
+
57
+	rxdrug := make(map[string]interface{})
58
+	for _, item := range cFYLJG001.List {
59
+		rxdrug["med_list_codg"] = item.MedListCodg
60
+		rxdrug["medins_list_codg"] = item.MedinsListCodg
61
+		rxdrug["hosp_prep_flag"] = item.HospPrepFlag
62
+		rxdrug["rx_item_type_code"] = item.RxItemTypeCode
63
+		rxdrug["rx_item_type_name"] = item.RxItemTypeName
64
+		rxdrug["tcmdrug_type_name"] = item.TcmdrugTypeName
65
+		rxdrug["tcmdrug_type_code"] = item.TcmdrugTypeCode
66
+		rxdrug["tcmherb_foote"] = item.TcmherbFoote
67
+		rxdrug["medn_type_code"] = item.MednTypeCode
68
+		rxdrug["medn_type_name"] = item.MednTypeName
69
+		rxdrug["main_medc_flag"] = item.MainMedcFlag
70
+		rxdrug["urgt_flag"] = item.UrgtFlag
71
+		rxdrug["bas_medn_flag"] = item.BasMednFlag
72
+		rxdrug["imp_drug_flag"] = item.ImpDrugFlag
73
+		rxdrug["drug_prodname"] = item.DrugProdname
74
+		rxdrug["genname_codg"] = item.GennameCodg
75
+		rxdrug["drug_genname"] = item.DrugGenname
76
+		rxdrug["drug_dosform"] = item.DrugDosform
77
+		rxdrug["drug_spec"] = item.DrugSpec
78
+		rxdrug["prdr_name"] = item.PrdrName
79
+		rxdrug["medc_way_codg"] = item.MedcWayCodg
80
+		rxdrug["medc_way_dscr"] = item.MedcWayDscr
81
+		rxdrug["medc_begntime"] = item.MedcBegntime
82
+		rxdrug["medc_endtime"] = item.MedcEndtime
83
+		rxdrug["medc_days"] = item.MedcDays
84
+		rxdrug["drug_pric"] = item.DrugPric
85
+		rxdrug["drug_sumamt"] = item.DrugSumamt
86
+		rxdrug["drug_cnt"] = item.DrugCnt
87
+		rxdrug["drug_dosunt"] = item.DrugDosunt
88
+		rxdrug["sin_doscnt"] = item.SinDoscnt
89
+		rxdrug["sin_dosunt"] = item.SinDosunt
90
+		rxdrug["used_frqu_codg"] = item.UsedFrquCodg
91
+		rxdrug["used_frqu_name"] = item.UsedFrquName
92
+		rxdrug["drug_totlcnt"] = item.DrugTotlcnt
93
+
94
+		rxdrug["drug_totlcnt_emp"] = item.DrugTotlcntEmp
95
+		rxdrug["hosp_appr_flag"] = item.HospApprFlag
96
+		//rxdrug["extras"] = ""
97
+		rxdrugdetail = append(rxdrugdetail, rxdrug)
98
+	}
99
+	inputData["rxdrugdetail"] = rxdrugdetail
100
+
101
+	mdtrtinfo := make(map[string]interface{})
102
+	mdtrtinfo["fixmedins_code"] = cFYLJG001.Mdtrtinfo.FixmedinsCode
103
+	mdtrtinfo["fixmedins_name"] = cFYLJG001.Mdtrtinfo.FixmedinsName
104
+	mdtrtinfo["mdtrt_id"] = cFYLJG001.Mdtrtinfo.MdtrtID
105
+	mdtrtinfo["med_type"] = cFYLJG001.Mdtrtinfo.MedType
106
+	mdtrtinfo["ipt_otp_no"] = cFYLJG001.Mdtrtinfo.IptOtpNo
107
+	mdtrtinfo["otp_ipt_flag"] = cFYLJG001.Mdtrtinfo.OtpIptFlag
108
+	mdtrtinfo["psn_no"] = cFYLJG001.Mdtrtinfo.PsnNo
109
+	mdtrtinfo["patn_name"] = cFYLJG001.Mdtrtinfo.PatnName
110
+	mdtrtinfo["psn_cert_type"] = cFYLJG001.Mdtrtinfo.PsnCertType
111
+	mdtrtinfo["certno"] = cFYLJG001.Mdtrtinfo.Certno
112
+	mdtrtinfo["patn_age"] = cFYLJG001.Mdtrtinfo.PatnAge
113
+	mdtrtinfo["patn_hgt"] = cFYLJG001.Mdtrtinfo.PatnHgt
114
+	mdtrtinfo["patn_wt"] = cFYLJG001.Mdtrtinfo.PatnWt
115
+	mdtrtinfo["gend"] = cFYLJG001.Mdtrtinfo.Gend
116
+	mdtrtinfo["birctrlType"] = cFYLJG001.Mdtrtinfo.BirctrlType
117
+	mdtrtinfo["birctrlMatnDate"] = cFYLJG001.Mdtrtinfo.BirctrlMatnDate
118
+	mdtrtinfo["matnType"] = cFYLJG001.Mdtrtinfo.MatnType
119
+	mdtrtinfo["geso_val"] = cFYLJG001.Mdtrtinfo.GesoVal
120
+	mdtrtinfo["nwb_flag"] = cFYLJG001.Mdtrtinfo.NwbFlag
121
+	mdtrtinfo["nwb_age"] = cFYLJG001.Mdtrtinfo.NwbAge
122
+	mdtrtinfo["suck_prd_flag"] = cFYLJG001.Mdtrtinfo.SuckPrdFlag
123
+	mdtrtinfo["algs_his"] = cFYLJG001.Mdtrtinfo.AlgsHis
124
+	mdtrtinfo["prsc_dept_name"] = cFYLJG001.Mdtrtinfo.PrscDeptName
125
+	mdtrtinfo["prsc_dept_code"] = cFYLJG001.Mdtrtinfo.PrscDeptCode
126
+	mdtrtinfo["dr_code"] = cFYLJG001.Mdtrtinfo.DrCode
127
+	mdtrtinfo["prsc_dr_name"] = cFYLJG001.Mdtrtinfo.PrscDrName
128
+	mdtrtinfo["prsc_dr_cert_type"] = cFYLJG001.Mdtrtinfo.PrscDrCertType
129
+	mdtrtinfo["prsc_dr_certno"] = cFYLJG001.Mdtrtinfo.PrscDrCertno
130
+	mdtrtinfo["dr_profttl_codg"] = cFYLJG001.Mdtrtinfo.DrProfttlCodg
131
+	mdtrtinfo["dr_profttl_name"] = cFYLJG001.Mdtrtinfo.DrProfttlName
132
+	mdtrtinfo["dr_dept_code"] = cFYLJG001.Mdtrtinfo.DrDeptCode
133
+	mdtrtinfo["dr_dept_name"] = cFYLJG001.Mdtrtinfo.DrDeptName
134
+	mdtrtinfo["caty"] = cFYLJG001.Mdtrtinfo.Caty
135
+	mdtrtinfo["mdtrt_time"] = cFYLJG001.Mdtrtinfo.MdtrtTime
136
+	mdtrtinfo["dise_codg"] = cFYLJG001.Mdtrtinfo.DiseCodg
137
+	mdtrtinfo["dise_name"] = cFYLJG001.Mdtrtinfo.DiseName
138
+	mdtrtinfo["sp_dise_flag"] = cFYLJG001.Mdtrtinfo.SpDiseFlag
139
+	mdtrtinfo["maindiag_code"] = cFYLJG001.Mdtrtinfo.MaindiagCode
140
+	mdtrtinfo["maindiag_name"] = cFYLJG001.Mdtrtinfo.MaindiagName
141
+	mdtrtinfo["dise_cond_dscr"] = cFYLJG001.Mdtrtinfo.DiseCondDscr
142
+	mdtrtinfo["hi_feesetl_flag"] = cFYLJG001.Mdtrtinfo.HiFeesetlFlag
143
+	mdtrtinfo["hi_feesetl_name"] = cFYLJG001.Mdtrtinfo.HiFeesetlName
144
+	mdtrtinfo["rgst_fee"] = cFYLJG001.Mdtrtinfo.RgstFee
145
+	mdtrtinfo["medfee_sumamt"] = cFYLJG001.Mdtrtinfo.MedfeeSumamt
146
+	mdtrtinfo["fstdiag_flag"] = cFYLJG001.Mdtrtinfo.FstdiagFlag
147
+	type MyData struct {
148
+		Insutype string `json:"insutype"`
149
+	}
150
+	data := MyData{
151
+		Insutype: isu,
152
+	}
153
+
154
+	mdtrtinfo["extras"] = data
155
+	inputData["mdtrtinfo"] = mdtrtinfo
156
+
157
+	diseinfos := make([]map[string]interface{}, 0)
158
+
159
+	for _, item := range cFYLJG001.Diseinfo {
160
+		diseinfo := make(map[string]interface{})
161
+		diseinfo["diag_type"] = item.DiagType
162
+		diseinfo["maindiag_flag"] = item.MaindiagFlag
163
+		diseinfo["diag_srt_no"] = item.DiagSrtNo
164
+		diseinfo["diag_code"] = item.DiagCode
165
+		diseinfo["diag_name"] = item.DiagName
166
+		diseinfo["diag_dept"] = item.DiagDept
167
+		diseinfo["diag_dr_no"] = item.DiagDrNo
168
+		diseinfo["diag_dr_name"] = item.DiagDrName
169
+		diseinfo["diag_time"] = item.DiagTime
170
+		diseinfo["tcm_dise_code"] = item.TcmDiseCode
171
+		diseinfo["tcm_dise_name"] = item.TcmDiseName
172
+		diseinfo["tcmsymp_code"] = item.TcmsympCode
173
+		diseinfo["tcmsymp"] = item.Tcmsymp
174
+		diseinfos = append(diseinfos, diseinfo)
175
+	}
176
+	inputData["diseinfo"] = diseinfos
177
+
178
+	inputMessage["input"] = inputData
179
+
180
+	var inputLog string
181
+	bytesData, err := json.Marshal(inputMessage)
182
+	inputLog = string(bytesData)
183
+	fmt.Println(string(bytesData))
184
+	if err != nil {
185
+		fmt.Println(err.Error())
186
+		return err.Error(), ""
187
+	}
188
+	reader := bytes.NewReader(bytesData)
189
+	gdyb_url := beego.AppConfig.String("gdyb_url")
190
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
191
+
192
+	var url string
193
+	if fixmedins_code == "H15049901371" {
194
+		url = gdyb_url
195
+	} else {
196
+		url = gdyb_url + "CFYLJG001"
197
+	}
198
+
199
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
200
+	request, err := http.NewRequest("POST", url, reader)
201
+	if err != nil {
202
+		fmt.Println(err.Error())
203
+		return err.Error(), ""
204
+	}
205
+
206
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
207
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
208
+	request.Header.Set("x-tif-signature", signature)
209
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
210
+	request.Header.Set("x-tif-nonce", nonce)
211
+
212
+	client := http.Client{}
213
+	resp, err := client.Do(request)
214
+	if err != nil {
215
+		fmt.Println(err.Error())
216
+		return err.Error(), ""
217
+	}
218
+	respBytes, err := ioutil.ReadAll(resp.Body)
219
+	if err != nil {
220
+		fmt.Println(err.Error())
221
+		return err.Error(), ""
222
+	}
223
+	fmt.Println(string(respBytes))
224
+	str := string(respBytes)
225
+	return str, inputLog
226
+
227
+}
228
+
229
+func GetAHCFYLJG002(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, original_value string, original_rx_file string, extras string) (string, string) {
230
+	//生成签名
231
+	nonce := GetRandomString(32)
232
+	timestamp := time.Now().Unix()
233
+	signature := setSignature(timestamp, nonce, secret_key)
234
+	//生成输入报文
235
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
236
+	inputData := make(map[string]interface{})
237
+	inputDatas := make(map[string]interface{})
238
+
239
+	inputMessage["infno"] = "CFYLJG002"
240
+	inputData["fixmedins_code"] = fixmedins_code
241
+	inputData["original_value"] = original_value
242
+	inputData["original_rx_file"] = original_rx_file
243
+	inputData["extras"] = extras
244
+	inputDatas["rx_sign_info"] = inputData
245
+	inputMessage["input"] = inputDatas
246
+
247
+	var inputLog string
248
+	bytesData, err := json.Marshal(inputMessage)
249
+	inputLog = string(bytesData)
250
+	fmt.Println(string(bytesData))
251
+	if err != nil {
252
+		fmt.Println(err.Error())
253
+		return err.Error(), ""
254
+	}
255
+	reader := bytes.NewReader(bytesData)
256
+	gdyb_url := beego.AppConfig.String("gdyb_url")
257
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
258
+
259
+	var url string
260
+	if fixmedins_code == "H15049901371" {
261
+		url = gdyb_url
262
+	} else {
263
+		url = gdyb_url + "CFYLJG002"
264
+	}
265
+
266
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
267
+	request, err := http.NewRequest("POST", url, reader)
268
+	if err != nil {
269
+		fmt.Println(err.Error())
270
+		return err.Error(), ""
271
+	}
272
+
273
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
274
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
275
+	request.Header.Set("x-tif-signature", signature)
276
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
277
+	request.Header.Set("x-tif-nonce", nonce)
278
+
279
+	client := http.Client{}
280
+	resp, err := client.Do(request)
281
+	if err != nil {
282
+		fmt.Println(err.Error())
283
+		return err.Error(), ""
284
+	}
285
+	respBytes, err := ioutil.ReadAll(resp.Body)
286
+	if err != nil {
287
+		fmt.Println(err.Error())
288
+		return err.Error(), ""
289
+	}
290
+	fmt.Println(string(respBytes))
291
+	str := string(respBytes)
292
+	return str, inputLog
293
+
294
+}
295
+
296
+func GetAHCFYLJG003(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, cFYLJG003 models.CFYLJG003) (string, string) {
297
+	//生成签名
298
+	nonce := GetRandomString(32)
299
+	timestamp := time.Now().Unix()
300
+	signature := setSignature(timestamp, nonce, secret_key)
301
+	//生成输入报文
302
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
303
+	//input := make(map[string]interface{})
304
+	inputData := make(map[string]interface{})
305
+	inputData2 := make(map[string]interface{})
306
+
307
+	inputMessage["infno"] = "CFYLJG003"
308
+
309
+	inputData["rx_trace_code"] = cFYLJG003.RxTraceCode
310
+	inputData["hi_rxno"] = cFYLJG003.HiRxno
311
+	inputData["mdtrt_id"] = cFYLJG003.MdtrtID
312
+	inputData["patn_name"] = cFYLJG003.PatnName
313
+	inputData["psn_cert_type"] = cFYLJG003.PsnCertType
314
+	inputData["certno"] = cFYLJG003.Certno
315
+	inputData["fixmedins_name"] = cFYLJG003.FixmedinsName
316
+	inputData["fixmedins_code"] = cFYLJG003.FixmedinsCode
317
+	inputData["dr_code"] = cFYLJG003.DrCode
318
+	inputData["prsc_dr_name"] = cFYLJG003.PrscDrName
319
+	inputData["phar_dept_name"] = cFYLJG003.PharDeptName
320
+	inputData["phar_dept_code"] = cFYLJG003.PharDeptCode
321
+	inputData["phar_profttl_codg"] = cFYLJG003.PharProfttlCodg
322
+	inputData["phar_profttl_name"] = cFYLJG003.PharProfttlName
323
+	inputData["phar_code"] = cFYLJG003.PharCode
324
+	inputData["rx_frqu_name"] = cFYLJG003.RxFrquName
325
+	inputData["phar_cert_type"] = cFYLJG003.PsnCertType
326
+	inputData["phar_certno"] = cFYLJG003.PharCertno
327
+	inputData["phar_name"] = cFYLJG003.PharName
328
+	inputData["phar_prac_cert_no"] = cFYLJG003.PharPracCertNo
329
+	inputData["phar_chk_time"] = cFYLJG003.PharChkTime
330
+	inputData["rx_file"] = cFYLJG003.RxFile
331
+	inputData["sign_digest"] = cFYLJG003.SignDigest
332
+	inputData2["rx_upload_info"] = inputData
333
+	inputMessage["input"] = inputData2
334
+	var inputLog string
335
+	bytesData, err := json.Marshal(inputMessage)
336
+	inputLog = string(bytesData)
337
+	fmt.Println(string(bytesData))
338
+	if err != nil {
339
+		fmt.Println(err.Error())
340
+		return err.Error(), ""
341
+	}
342
+	reader := bytes.NewReader(bytesData)
343
+	gdyb_url := beego.AppConfig.String("gdyb_url")
344
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
345
+
346
+	var url string
347
+	if fixmedins_code == "H15049901371" {
348
+		url = gdyb_url
349
+	} else {
350
+		url = gdyb_url + "CFYLJG003"
351
+	}
352
+
353
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
354
+	request, err := http.NewRequest("POST", url, reader)
355
+	if err != nil {
356
+		fmt.Println(err.Error())
357
+		return err.Error(), ""
358
+	}
359
+
360
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
361
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
362
+	request.Header.Set("x-tif-signature", signature)
363
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
364
+	request.Header.Set("x-tif-nonce", nonce)
365
+
366
+	client := http.Client{}
367
+	resp, err := client.Do(request)
368
+	if err != nil {
369
+		fmt.Println(err.Error())
370
+		return err.Error(), ""
371
+	}
372
+	respBytes, err := ioutil.ReadAll(resp.Body)
373
+	if err != nil {
374
+		fmt.Println(err.Error())
375
+		return err.Error(), ""
376
+	}
377
+	fmt.Println(string(respBytes))
378
+	str := string(respBytes)
379
+	return str, inputLog
380
+
381
+}
382
+
383
+func GetAHCFYLJG004(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, cFYLJG004 models.CFYLJG004) (string, string) {
384
+	//生成签名
385
+	nonce := GetRandomString(32)
386
+	timestamp := time.Now().Unix()
387
+	signature := setSignature(timestamp, nonce, secret_key)
388
+	//生成输入报文
389
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
390
+	inputData := make(map[string]interface{})
391
+	inputData1 := make(map[string]interface{})
392
+
393
+	//inputDatas := make([]map[string]interface{}, 0)
394
+	inputMessage["infno"] = "CFYLJG004"
395
+	inputData["hi_rxno"] = cFYLJG004.HiRxno
396
+	inputData["undo_dr_code"] = cFYLJG004.UndoDrCode
397
+	inputData["undo_dr_name"] = cFYLJG004.UndoDrName
398
+	inputData["undo_dr_cert_type"] = cFYLJG004.UndoDrCertType
399
+	inputData["undo_dr_certno"] = cFYLJG004.UndoDrCertno
400
+	inputData["undo_rea"] = cFYLJG004.UndoRea
401
+	inputData["undo_time"] = cFYLJG004.UndoTime
402
+	inputData["fixmedins_code"] = cFYLJG004.FixmedinsCode
403
+	inputData1["rx_cancel_info"] = inputData
404
+	inputMessage["input"] = inputData1
405
+	var inputLog string
406
+	bytesData, err := json.Marshal(inputMessage)
407
+	inputLog = string(bytesData)
408
+	fmt.Println(string(bytesData))
409
+	if err != nil {
410
+		fmt.Println(err.Error())
411
+		return err.Error(), ""
412
+	}
413
+	reader := bytes.NewReader(bytesData)
414
+	gdyb_url := beego.AppConfig.String("gdyb_url")
415
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
416
+
417
+	var url string
418
+	if fixmedins_code == "H15049901371" {
419
+		url = gdyb_url
420
+	} else {
421
+		url = gdyb_url + "CFYLJG004"
422
+	}
423
+
424
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
425
+	request, err := http.NewRequest("POST", url, reader)
426
+	if err != nil {
427
+		fmt.Println(err.Error())
428
+		return err.Error(), ""
429
+	}
430
+
431
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
432
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
433
+	request.Header.Set("x-tif-signature", signature)
434
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
435
+	request.Header.Set("x-tif-nonce", nonce)
436
+
437
+	client := http.Client{}
438
+	resp, err := client.Do(request)
439
+	if err != nil {
440
+		fmt.Println(err.Error())
441
+		return err.Error(), ""
442
+	}
443
+	respBytes, err := ioutil.ReadAll(resp.Body)
444
+	if err != nil {
445
+		fmt.Println(err.Error())
446
+		return err.Error(), ""
447
+	}
448
+	fmt.Println(string(respBytes))
449
+	str := string(respBytes)
450
+	return str, inputLog
451
+
452
+}
453
+
454
+func GetAHCFYLJG005(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, cFYLJG005 models.CFYLJG005) (string, string) {
455
+	//生成签名
456
+	nonce := GetRandomString(32)
457
+	timestamp := time.Now().Unix()
458
+	signature := setSignature(timestamp, nonce, secret_key)
459
+	//生成输入报文
460
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
461
+
462
+	inputData := make(map[string]interface{})
463
+
464
+	inputData2 := make(map[string]interface{})
465
+	//inputDatas := make([]map[string]interface{}, 0)
466
+
467
+	inputMessage["infno"] = "CFYLJG005"
468
+
469
+	inputData["fixmedins_code"] = fixmedins_code
470
+
471
+	inputData["hi_rxno"] = cFYLJG005.HiRxno
472
+	inputData["mdtrt_id"] = cFYLJG005.MdtrtID
473
+	inputData["ec_token"] = cFYLJG005.EcToken
474
+	inputData["psn_name"] = cFYLJG005.PsnName
475
+	inputData["psn_cert_type"] = cFYLJG005.PsnCertType
476
+	inputData["certno"] = cFYLJG005.Certno
477
+	inputData2["rx_detl_query"] = inputData
478
+	inputMessage["input"] = inputData2
479
+	var inputLog string
480
+	bytesData, err := json.Marshal(inputMessage)
481
+	inputLog = string(bytesData)
482
+	fmt.Println(string(bytesData))
483
+	if err != nil {
484
+		fmt.Println(err.Error())
485
+		return err.Error(), ""
486
+	}
487
+	reader := bytes.NewReader(bytesData)
488
+	gdyb_url := beego.AppConfig.String("gdyb_url")
489
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
490
+
491
+	var url string
492
+	if fixmedins_code == "H15049901371" {
493
+		url = gdyb_url
494
+	} else {
495
+		url = gdyb_url + "CFYLJG005"
496
+	}
497
+
498
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
499
+	request, err := http.NewRequest("POST", url, reader)
500
+	if err != nil {
501
+		fmt.Println(err.Error())
502
+		return err.Error(), ""
503
+	}
504
+
505
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
506
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
507
+	request.Header.Set("x-tif-signature", signature)
508
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
509
+	request.Header.Set("x-tif-nonce", nonce)
510
+
511
+	client := http.Client{}
512
+	resp, err := client.Do(request)
513
+	if err != nil {
514
+		fmt.Println(err.Error())
515
+		return err.Error(), ""
516
+	}
517
+	respBytes, err := ioutil.ReadAll(resp.Body)
518
+	if err != nil {
519
+		fmt.Println(err.Error())
520
+		return err.Error(), ""
521
+	}
522
+	fmt.Println(string(respBytes))
523
+	str := string(respBytes)
524
+	return str, inputLog
525
+
526
+}
527
+func GetAHCFYLJG006(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, cFYLJG006 models.CFYLJG006) (string, string) {
528
+	//生成签名
529
+	nonce := GetRandomString(32)
530
+	timestamp := time.Now().Unix()
531
+	signature := setSignature(timestamp, nonce, secret_key)
532
+	//生成输入报文
533
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
534
+	inputData := make(map[string]interface{})
535
+	//inputDatas := make([]map[string]interface{}, 0)
536
+	inputData2 := make(map[string]interface{})
537
+
538
+	inputMessage["infno"] = "CFYLJG006"
539
+
540
+	inputData["fixmedins_code"] = fixmedins_code
541
+	inputData["hi_rxno"] = cFYLJG006.HiRxno
542
+	inputData["mdtrt_id"] = cFYLJG006.MdtrtID
543
+	inputData["psn_cert_type"] = cFYLJG006.PsnCertType
544
+	inputData["certno"] = cFYLJG006.Certno
545
+	inputData["psn_name"] = cFYLJG006.PsnName
546
+	inputData2["rx_chk_info"] = inputData
547
+	inputMessage["input"] = inputData2
548
+	var inputLog string
549
+	bytesData, err := json.Marshal(inputMessage)
550
+	inputLog = string(bytesData)
551
+	fmt.Println(string(bytesData))
552
+	if err != nil {
553
+		fmt.Println(err.Error())
554
+		return err.Error(), ""
555
+	}
556
+	reader := bytes.NewReader(bytesData)
557
+	gdyb_url := beego.AppConfig.String("gdyb_url")
558
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
559
+
560
+	var url string
561
+	if fixmedins_code == "H15049901371" {
562
+		url = gdyb_url
563
+	} else {
564
+		url = gdyb_url + "CFYLJG006"
565
+	}
566
+
567
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
568
+	request, err := http.NewRequest("POST", url, reader)
569
+	if err != nil {
570
+		fmt.Println(err.Error())
571
+		return err.Error(), ""
572
+	}
573
+
574
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
575
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
576
+	request.Header.Set("x-tif-signature", signature)
577
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
578
+	request.Header.Set("x-tif-nonce", nonce)
579
+
580
+	client := http.Client{}
581
+	resp, err := client.Do(request)
582
+	if err != nil {
583
+		fmt.Println(err.Error())
584
+		return err.Error(), ""
585
+	}
586
+	respBytes, err := ioutil.ReadAll(resp.Body)
587
+	if err != nil {
588
+		fmt.Println(err.Error())
589
+		return err.Error(), ""
590
+	}
591
+	fmt.Println(string(respBytes))
592
+	str := string(respBytes)
593
+	return str, inputLog
594
+
595
+}
596
+func GetAHCFYLJG007(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, cFYLJG007 models.CFYLJG007) (string, string) {
597
+	//生成签名
598
+	nonce := GetRandomString(32)
599
+	timestamp := time.Now().Unix()
600
+	signature := setSignature(timestamp, nonce, secret_key)
601
+	//生成输入报文
602
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
603
+	inputData := make(map[string]interface{})
604
+	inputData2 := make(map[string]interface{})
605
+
606
+	//inputDatas := make([]map[string]interface{}, 0)
607
+
608
+	inputMessage["infno"] = "CFYLJG007"
609
+
610
+	inputData["fixmedins_code"] = fixmedins_code
611
+	inputData["hi_rxno"] = cFYLJG007.HiRxno
612
+	inputData["mdtrt_id"] = cFYLJG007.MdtrtID
613
+	inputData["psn_no"] = cFYLJG007.PsnNo
614
+	inputData["psn_cert_type"] = cFYLJG007.PsnCertType
615
+	inputData["certno"] = cFYLJG007.Certno
616
+	inputData["psn_name"] = cFYLJG007.PsnName
617
+
618
+	inputData2["rx_setl_query"] = inputData
619
+
620
+	inputMessage["input"] = inputData2
621
+	var inputLog string
622
+	bytesData, err := json.Marshal(inputMessage)
623
+	inputLog = string(bytesData)
624
+	fmt.Println(string(bytesData))
625
+	if err != nil {
626
+		fmt.Println(err.Error())
627
+		return err.Error(), ""
628
+	}
629
+	reader := bytes.NewReader(bytesData)
630
+	gdyb_url := beego.AppConfig.String("gdyb_url")
631
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
632
+
633
+	var url string
634
+	if fixmedins_code == "H15049901371" {
635
+		url = gdyb_url
636
+	} else {
637
+		url = gdyb_url + "CFYLJG007"
638
+	}
639
+
640
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
641
+	request, err := http.NewRequest("POST", url, reader)
642
+	if err != nil {
643
+		fmt.Println(err.Error())
644
+		return err.Error(), ""
645
+	}
646
+
647
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
648
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
649
+	request.Header.Set("x-tif-signature", signature)
650
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
651
+	request.Header.Set("x-tif-nonce", nonce)
652
+
653
+	client := http.Client{}
654
+	resp, err := client.Do(request)
655
+	if err != nil {
656
+		fmt.Println(err.Error())
657
+		return err.Error(), ""
658
+	}
659
+	respBytes, err := ioutil.ReadAll(resp.Body)
660
+	if err != nil {
661
+		fmt.Println(err.Error())
662
+		return err.Error(), ""
663
+	}
664
+	fmt.Println(string(respBytes))
665
+	str := string(respBytes)
666
+	return str, inputLog
667
+
668
+}
669
+func GetAHCFYLJG008(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, cFYLJG008 models.CFYLJG008) (string, string) {
670
+	//生成签名
671
+	nonce := GetRandomString(32)
672
+	timestamp := time.Now().Unix()
673
+	signature := setSignature(timestamp, nonce, secret_key)
674
+	//生成输入报文
675
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
676
+	inputData := make(map[string]interface{})
677
+	//inputData2 := make(map[string]interface{})
678
+
679
+	//inputDatas := make([]map[string]interface{}, 0)
680
+
681
+	inputMessage["infno"] = "CFYLJG008"
682
+
683
+	inputData["pageNum"] = cFYLJG008.PageNum
684
+	inputData["pageSize"] = cFYLJG008.PageSize
685
+	inputData["orderType"] = cFYLJG008.OrderType
686
+	inputData["poolareaNo"] = cFYLJG008.PoolareaNo
687
+	inputData["fixmedinsName"] = cFYLJG008.FixmedinsName
688
+	inputData["lng"] = cFYLJG008.Lng
689
+	inputData["lat"] = cFYLJG008.Lat
690
+	inputData["medinsProdInvChgDDTOList"] = cFYLJG008.MedList
691
+
692
+	inputMessage["input"] = inputData
693
+	var inputLog string
694
+	bytesData, err := json.Marshal(inputMessage)
695
+	inputLog = string(bytesData)
696
+	fmt.Println(string(bytesData))
697
+	if err != nil {
698
+		fmt.Println(err.Error())
699
+		return err.Error(), ""
700
+	}
701
+	reader := bytes.NewReader(bytesData)
702
+	gdyb_url := beego.AppConfig.String("gdyb_url")
703
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
704
+
705
+	var url string
706
+	if fixmedins_code == "H15049901371" {
707
+		url = gdyb_url
708
+	} else {
709
+		url = gdyb_url + "CFYLJG007"
710
+	}
711
+
712
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
713
+	request, err := http.NewRequest("POST", url, reader)
714
+	if err != nil {
715
+		fmt.Println(err.Error())
716
+		return err.Error(), ""
717
+	}
718
+
719
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
720
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
721
+	request.Header.Set("x-tif-signature", signature)
722
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
723
+	request.Header.Set("x-tif-nonce", nonce)
724
+
725
+	client := http.Client{}
726
+	resp, err := client.Do(request)
727
+	if err != nil {
728
+		fmt.Println(err.Error())
729
+		return err.Error(), ""
730
+	}
731
+	respBytes, err := ioutil.ReadAll(resp.Body)
732
+	if err != nil {
733
+		fmt.Println(err.Error())
734
+		return err.Error(), ""
735
+	}
736
+	fmt.Println(string(respBytes))
737
+	str := string(respBytes)
738
+	return str, inputLog
739
+
740
+}
741
+
742
+func Getflow(id int64) (flow models.HisPrescriptionFlow, err error) {
743
+	err = readDb.Model(&models.HisPrescriptionFlow{}).Where("id = ?", id).First(&flow).Error
744
+	return
745
+}
746
+
747
+func Getflowtwo(m_id string) (flow models.HisPrescriptionFlow, err error) {
748
+	err = readDb.Model(&models.HisPrescriptionFlow{}).Where("m_id = ?", m_id).First(&flow).Error
749
+	return
750
+}

+ 10 - 6
service/his_service.go 查看文件

@@ -1907,8 +1907,7 @@ type HisDoctorAdviceInfo struct {
1907 1907
 	IsMedicine           int64 `gorm:"column:is_medicine" json:"is_medicine" form:"is_medicine"`
1908 1908
 	ExecutionFrequencyId int64 `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
1909 1909
 	IsSelfDrug           int64 `gorm:"column:is_self_drug" json:"is_self_drug" form:"is_self_drug"`
1910
-	IsUpload           int64 `gorm:"column:is_upload" json:"is_upload" form:"is_upload"`
1911
-
1910
+	IsUpload             int64 `gorm:"column:is_upload" json:"is_upload" form:"is_upload"`
1912 1911
 }
1913 1912
 
1914 1913
 type Drug struct {
@@ -2171,13 +2170,18 @@ func FindUploadHisAdviceDocAdvice(orgid int64, patient_id int64, stime int64, et
2171 2170
 	return advice, err
2172 2171
 }
2173 2172
 
2174
-func SaveDoctoradviceStatus(id int64){
2175
-	 writeDb.Model(&models.HisDoctorAdviceInfo{}).Where("id = ?", id).Updates(map[string]interface{}{"is_upload": 1})
2173
+func SaveDoctoradviceStatus(id int64) {
2174
+	writeDb.Model(&models.HisDoctorAdviceInfo{}).Where("id = ?", id).Updates(map[string]interface{}{"is_upload": 1})
2176 2175
 
2177 2176
 }
2178 2177
 
2179
-
2180
-func SaveDoctoradviceStatusTwo(id int64){
2178
+func SaveDoctoradviceStatusTwo(id int64) {
2181 2179
 	writeDb.Model(&models.HisDoctorAdviceInfo{}).Where("id = ?", id).Updates(map[string]interface{}{"is_upload": 0})
2182 2180
 
2183 2181
 }
2182
+
2183
+func FindHisAdviceDocAdvice(id int64) (advice []*models.HisDoctorAdviceInfo, err error) {
2184
+	db := XTReadDB().Model(&advice).Where("status= 1 and id = ?", id)
2185
+	err = db.Find(&advice).Error
2186
+	return advice, err
2187
+}