Pārlūkot izejas kodu

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

test_user 4 nedēļas atpakaļ
vecāks
revīzija
807164ce81
3 mainītis faili ar 842 papildinājumiem un 14 dzēšanām
  1. 82 8
      controllers/sg/his_api_controller.go
  2. 750 0
      service/ah_dianzichufang.go
  3. 10 6
      service/his_service.go

+ 82 - 8
controllers/sg/his_api_controller.go Parādīt failu

@@ -205,11 +205,11 @@ func HisManagerApiRegistRouters() {
205 205
 	beego.Router("/api/35081", &HisApiController{}, "get:Get35081")
206 206
 	beego.Router("/api/35082", &HisApiController{}, "get:Get35082")
207 207
 
208
-	//beego.Router("/api/changedrug/four", &HisApiController{}, "get:ChangeDrugfour")
209
-	//beego.Router("/api/changedrug/five", &HisApiController{}, "get:ChangeDrugFive")
208
+	beego.Router("/api/changedrug/four", &HisApiController{}, "get:ChangeDrugfour")
209
+	beego.Router("/api/changedrug/five", &HisApiController{}, "get:ChangeDrugFive")
210 210
 
211
-	//beego.Router("/api/delete_xs_bg_two", &HisApiController{}, "get:DeleteXSandBGTwo")
212
-	//beego.Router("/api/delete_xs_bg_two", &HisApiController{}, "get:DeleteXSandBGTwo")
211
+	beego.Router("/api/delete_xs_bg_two", &HisApiController{}, "get:DeleteXSandBGTwo")
212
+	beego.Router("/api/delete_xs_bg_three", &HisApiController{}, "get:DeleteXSandBGThree")
213 213
 
214 214
 	beego.Router("/api/3201", &HisApiController{}, "get:Get3201")
215 215
 
@@ -3034,6 +3034,81 @@ func (c *HisApiController) ChangeDrugfour() {
3034 3034
 
3035 3035
 }
3036 3036
 
3037
+func (c *HisApiController) ChangeDrugFive() {
3038
+	id, _ := c.GetInt64("id")
3039
+	admin_user_id, _ := c.GetInt64("admin_user_id")
3040
+	advicelist, _ := service.FindHisAdviceDocAdvice(id)
3041
+	var flows []*models.DrugFlow
3042
+	for _, item := range advicelist {
3043
+		flow, _ := service.GetNewDrugFlowInfoByPatient(item.PatientId, item.DrugId, item.RecordDate, c.GetAdminUserInfo().CurrentOrgId)
3044
+		flows = append(flows, flow...)
3045
+	}
3046
+	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
3047
+	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
3048
+	var err []string
3049
+	for _, item := range flows {
3050
+		if item.ConsumableType == 3 { //3为自动出库 7为自动退库
3051
+			prescription := service.GetHisPrescriptionByID(item.HisDoctorAdviceInfo.PrescriptionId)
3052
+			if prescription.OrderStatus == 2 {
3053
+				if item.IsSale == 0 {
3054
+					var res FJ3507Result
3055
+					var res3507for10188 FJ3507ResultFor10188
3056
+					number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3505"
3057
+					//进行商品销售接口
3058
+					result3, result4 := SaleStock(c.GetAdminUserInfo().CurrentOrgId, prescription, item, miConfig, "", roles, number)
3059
+					saveLog(result3, result4, "3505", "自动出库,未销售进行销售行为,3505")
3060
+					var respJSON3 map[string]interface{}
3061
+					if err := json.Unmarshal([]byte(string(result3)), &respJSON3); err != nil {
3062
+						utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
3063
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3064
+						return
3065
+					}
3066
+					userJSONBytes3, _ := json.Marshal(respJSON3)
3067
+					if c.GetAdminUserInfo().CurrentOrgId == 10188 || c.GetAdminUserInfo().CurrentOrgId == 10217 {
3068
+						if err := json.Unmarshal(userJSONBytes3, &res3507for10188); err != nil {
3069
+							utils.ErrorLog("解析失败:%v", err)
3070
+							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3071
+							return
3072
+						}
3073
+						//if res3507for10188.Infcode
3074
+						res.InfRefmsgid = res3507for10188.InfRefmsgid
3075
+						//res.Output = resSix10265.Output
3076
+						res.ErrMsg = res3507for10188.ErrMsg
3077
+						res.Cainfo = res3507for10188.Cainfo
3078
+						res.WarnMsg = res3507for10188.WarnMsg
3079
+						infocode, _ := strconv.ParseInt(res3507for10188.Infcode, 10, 64)
3080
+						res.Infcode = infocode
3081
+					} else {
3082
+						if err := json.Unmarshal(userJSONBytes3, &res); err != nil {
3083
+							utils.ErrorLog("解析失败:%v", err)
3084
+							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3085
+							return
3086
+						}
3087
+					}
3088
+					if res.Infcode == 0 {
3089
+						service.SaveDoctoradviceStatus(item.HisDoctorAdviceInfo.ID)
3090
+						item.IsSale = 1
3091
+						item.Bchno = number
3092
+						item.SaleDate = time.Now().Format("2006-01-02")
3093
+						service.SaveDF(item)
3094
+					} else {
3095
+						err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售失败:"+res.ErrMsg)
3096
+					}
3097
+				}
3098
+			} else { //还没结,提示用户去结算,并药品追溯上传
3099
+				err = append(err, item.HisDoctorAdviceInfo.AdviceName+"还没结算,请结算后,在药品追溯页面上传")
3100
+			}
3101
+		}
3102
+	}
3103
+	str := strings.Join(err, " ")
3104
+	saveLog(str, str, "3505", "3505自动上传日志")
3105
+	c.ServeSuccessJSON(map[string]interface{}{
3106
+		"status": "1",
3107
+		"msg":    err,
3108
+	})
3109
+
3110
+}
3111
+
3037 3112
 //func (c *HisApiController) ChangeDrugfour() {
3038 3113
 //	patient_id, _ := c.GetInt64("patient_id")
3039 3114
 //	admin_user_id, _ := c.GetInt64("admin_user_id")
@@ -5194,11 +5269,11 @@ func SaleStock(org_id int64, pre models.HisPrescription, drug *models.DrugFlow,
5194 5269
 		struct3505.TrdnFlag = "1"
5195 5270
 	}
5196 5271
 
5197
-	if drug.HisDoctorAdviceInfo.ZeroFlag == 1{
5272
+	if drug.HisDoctorAdviceInfo.ZeroFlag == 1 {
5198 5273
 		struct3505.TrdnFlag = "1"
5199 5274
 	}
5200 5275
 
5201
-	if drug.HisDoctorAdviceInfo.ZeroFlag == 2{
5276
+	if drug.HisDoctorAdviceInfo.ZeroFlag == 2 {
5202 5277
 		struct3505.TrdnFlag = "0"
5203 5278
 
5204 5279
 	}
@@ -18410,7 +18485,7 @@ func (c *HisApiController) TestGetHnBasBaseInit() {
18410 18485
 	//ret, _, err := Iinit.Call(StrPtr("https://10.93.32.89:20001/hsa-hgs-adapt/api/card/initDll"), StrPtr("430100|10.93.32.89:20001"))
18411 18486
 	//ret, _, err := Iinit.Call(StrPtr("https://scr.hun.hsip.gov.cn/hsa-hgs-adapt/api/card/initDll"), StrPtr("430100|scr.hun.hsip.gov.cn"))
18412 18487
 	// 调用 Init 函数
18413
-	ret, _, err := Iinit.Call(uintptr(unsafe.Pointer(StrPtr("https://test_scr.hun.hsip.gov.cn/hsa-hgs-adapt/api/card/initDll"))), uintptr(unsafe.Pointer(StrPtr("430800|test_scr.hun.hsip.gov.cn"))))
18488
+	ret, _, err := Iinit.Call(uintptr(unsafe.Pointer(StrPtr("https://scr.hun.hsip.gov.cn/hsa-hgs-adapt/api/card/initDll"))), uintptr(unsafe.Pointer(StrPtr("430800|scr.hun.hsip.gov.cn"))))
18414 18489
 
18415 18490
 	//if ret != 0 {
18416 18491
 	fmt.Println("SSCard的报错原因:", err)
@@ -33487,7 +33562,6 @@ func (c *HisApiController) GetPreUploadInfo() {
33487 33562
 								saveLog(result, request_log, "2206", "预结算")
33488 33563
 							}
33489 33564
 
33490
-
33491 33565
 							//userJSONBytes, _ := json.Marshal(dat)
33492 33566
 							//
33493 33567
 							//if err := json.Unmarshal(userJSONBytes, &res); err != nil {

+ 750 - 0
service/ah_dianzichufang.go Parādīt failu

@@ -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 Parādīt failu

@@ -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
+}