test_user 4 months ago
parent
commit
6fcacaa1dd
4 changed files with 36 additions and 32 deletions
  1. 21 10
      controllers/sg/his_api_controller.go
  2. 7 7
      main.go
  3. 3 0
      models/new_stock_models.go
  4. 5 15
      service/fj_service.go

+ 21 - 10
controllers/sg/his_api_controller.go View File

38
 	"syscall"
38
 	"syscall"
39
 	"time"
39
 	"time"
40
 	"unsafe"
40
 	"unsafe"
41
-
41
+	"github.com/go-ole/go-ole"
42
 	"github.com/go-ole/go-ole/oleutil"
42
 	"github.com/go-ole/go-ole/oleutil"
43
 )
43
 )
44
 
44
 
192
 
192
 
193
 }
193
 }
194
 func (c *HisApiController) FJ3501AND3502() {
194
 func (c *HisApiController) FJ3501AND3502() {
195
-	ids := c.getString("ids")
195
+	ids := c.GetString("ids")
196
 	admin_user_id, _ := c.GetInt64("admin_user_id")
196
 	admin_user_id, _ := c.GetInt64("admin_user_id")
197
 	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
197
 	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
198
 
198
 
202
 	//库盘
202
 	//库盘
203
 	for _, drug := range drugs {
203
 	for _, drug := range drugs {
204
 		if drug.IsPc == 0 && drug.IsBg == 0 {
204
 		if drug.IsPc == 0 && drug.IsBg == 0 {
205
+			number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(drug.ID, 10) + "-" + "3501"
205
 			var struct3501 models.Struct3501
206
 			var struct3501 models.Struct3501
206
 			struct3501.OrgName = miConfig.OrgName
207
 			struct3501.OrgName = miConfig.OrgName
207
 			struct3501.AccessKey = miConfig.AccessKey
208
 			struct3501.AccessKey = miConfig.AccessKey
217
 			struct3501.FixmedinsHilistId = miConfig.Code
218
 			struct3501.FixmedinsHilistId = miConfig.Code
218
 			struct3501.FixmedinsHilistName = miConfig.OrgName
219
 			struct3501.FixmedinsHilistName = miConfig.OrgName
219
 			struct3501.RxFlag = "0"
220
 			struct3501.RxFlag = "0"
220
-			struct3501.Invdate = time.Unix(drug.Ctime, 0).Format("2006-01-02 15:04:05")
221
+			struct3501.Invdate = time.Unix(drug.Ctime, 0).Format("2006-01-02")
222
+			struct3501.ManuDate = time.Unix(drug.ProductDate, 0).Format("2006-01-02")
223
+
221
 			struct3501.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
224
 			struct3501.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
222
 			struct3501.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
225
 			struct3501.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
223
 			struct3501.InvCnt = strconv.FormatInt(drug.StockMaxNumber, 10)
226
 			struct3501.InvCnt = strconv.FormatInt(drug.StockMaxNumber, 10)
224
-			struct3501.ExpyEnd = time.Unix(drug.ExpiryDate, 0).Format("2006-01-02 15:04:05")
225
-			struct3501.FixmedinsBchno = strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(drug.ID, 10) + "-" + "3501"
227
+			struct3501.ExpyEnd = time.Unix(drug.ExpiryDate, 0).Format("2006-01-02")
228
+			struct3501.FixmedinsBchno = number
226
 			memo := make(map[string]interface{})
229
 			memo := make(map[string]interface{})
227
 			memo["pric"] = drug.Price
230
 			memo["pric"] = drug.Price
228
 			bytesData, _ := json.Marshal(memo)
231
 			bytesData, _ := json.Marshal(memo)
229
 			struct3501.Memo = string(bytesData)
232
 			struct3501.Memo = string(bytesData)
230
 			result1, result2, result3 := service.FJyb3501(struct3501)
233
 			result1, result2, result3 := service.FJyb3501(struct3501)
234
+			saveLog(result1, result2, "3501", "3501")
235
+			//saveLog(result, requestLog, "2201", "挂号")
236
+
231
 			fmt.Println(result1)
237
 			fmt.Println(result1)
232
 			fmt.Println(result2)
238
 			fmt.Println(result2)
233
 			fmt.Println(result3)
239
 			fmt.Println(result3)
240
 			struct3502.RxFlag = "0"
246
 			struct3502.RxFlag = "0"
241
 			struct3502.InvChgTime = time.Now().Format("2006-01-02")
247
 			struct3502.InvChgTime = time.Now().Format("2006-01-02")
242
 			struct3502.OrgName = miConfig.OrgName
248
 			struct3502.OrgName = miConfig.OrgName
249
+			struct3501.Opter = roles.UserName
243
 			struct3502.AccessKey = miConfig.AccessKey
250
 			struct3502.AccessKey = miConfig.AccessKey
244
 			struct3502.RequestUrl = miConfig.Url
251
 			struct3502.RequestUrl = miConfig.Url
245
 			struct3502.SecretKey = miConfig.SecretKey
252
 			struct3502.SecretKey = miConfig.SecretKey
255
 
262
 
256
 			struct3502.Memo = ""
263
 			struct3502.Memo = ""
257
 			struct3502.InvChgType = "108"
264
 			struct3502.InvChgType = "108"
258
-			struct3501.FixmedinsBchno = strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(drug.ID, 10) + "-" + "3502"
265
+			struct3502.FixmedinsBchno = number
259
 			struct3502.Cnt = strconv.FormatInt(drug.WarehousingCount, 10)
266
 			struct3502.Cnt = strconv.FormatInt(drug.WarehousingCount, 10)
260
 			struct3502.Pric = fmt.Sprintf("%.2f", drug.BaseDrugLib.RetailPrice)
267
 			struct3502.Pric = fmt.Sprintf("%.2f", drug.BaseDrugLib.RetailPrice)
261
 			result11, result22, result33 := service.FJyb3502(struct3502)
268
 			result11, result22, result33 := service.FJyb3502(struct3502)
262
 			fmt.Println(result11)
269
 			fmt.Println(result11)
263
 			fmt.Println(result22)
270
 			fmt.Println(result22)
264
 			fmt.Println(result33)
271
 			fmt.Println(result33)
272
+			saveLog(result11, result22, "3502", "3502")
273
+
265
 
274
 
266
 		}
275
 		}
267
 		//变更
276
 		//变更
271
 			struct3502.FixmedinsHilistId = miConfig.Code
280
 			struct3502.FixmedinsHilistId = miConfig.Code
272
 			struct3502.FixmedinsHilistName = miConfig.OrgName
281
 			struct3502.FixmedinsHilistName = miConfig.OrgName
273
 			struct3502.FixmedinsCode = miConfig.Code
282
 			struct3502.FixmedinsCode = miConfig.Code
283
+			struct3502.Opter = roles.UserName
274
 			struct3502.RxFlag = "0"
284
 			struct3502.RxFlag = "0"
275
 			struct3502.InvChgTime = time.Unix(drug.Ctime, 0).Format("2006-01-02 15:04:05")
285
 			struct3502.InvChgTime = time.Unix(drug.Ctime, 0).Format("2006-01-02 15:04:05")
276
 			struct3502.OrgName = miConfig.OrgName
286
 			struct3502.OrgName = miConfig.OrgName
288
 			struct3502.SignKey = miConfig.SignKey
298
 			struct3502.SignKey = miConfig.SignKey
289
 			struct3502.SecretKey = miConfig.SecretKey
299
 			struct3502.SecretKey = miConfig.SecretKey
290
 
300
 
291
-			struct3502.FixmedinsBchno = ""
301
+			struct3502.FixmedinsBchno = drug.Bchno
292
 			struct3502.Cnt = strconv.FormatInt(drug.WarehousingCount, 10)
302
 			struct3502.Cnt = strconv.FormatInt(drug.WarehousingCount, 10)
293
 			struct3502.Pric = fmt.Sprintf("%.2f", drug.BaseDrugLib.RetailPrice)
303
 			struct3502.Pric = fmt.Sprintf("%.2f", drug.BaseDrugLib.RetailPrice)
294
 			result1, result2, result3 := service.FJyb3502(struct3502)
304
 			result1, result2, result3 := service.FJyb3502(struct3502)
305
+			saveLog(result1, result2, "3502", "3502")
295
 			fmt.Println(result1)
306
 			fmt.Println(result1)
296
 			fmt.Println(result2)
307
 			fmt.Println(result2)
297
 			fmt.Println(result3)
308
 			fmt.Println(result3)
299
 	}
310
 	}
300
 }
311
 }
301
 func (c *HisApiController) DeletePCandBG() {
312
 func (c *HisApiController) DeletePCandBG() {
302
-	ids := c.getString("ids")
313
+	ids := c.GetString("ids")
303
 	id_arr := strings.Split(ids, ",")
314
 	id_arr := strings.Split(ids, ",")
304
 	admin_user_id, _ := c.GetInt64("admin_user_id")
315
 	admin_user_id, _ := c.GetInt64("admin_user_id")
305
 	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
316
 	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
371
 }
382
 }
372
 
383
 
373
 func (c *HisApiController) DeleteXSandBG() {
384
 func (c *HisApiController) DeleteXSandBG() {
374
-	ids := c.getString("ids")
385
+	ids := c.GetString("ids")
375
 	id_arr := strings.Split(ids, ",")
386
 	id_arr := strings.Split(ids, ",")
376
 	admin_user_id, _ := c.GetInt64("admin_user_id")
387
 	admin_user_id, _ := c.GetInt64("admin_user_id")
377
 	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
388
 	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
440
 }
451
 }
441
 
452
 
442
 func (c *HisApiController) ChangeDrug() {
453
 func (c *HisApiController) ChangeDrug() {
443
-	ids := c.getString("ids")
454
+	ids := c.GetString("ids")
444
 	id_arr := strings.Split(ids, ",")
455
 	id_arr := strings.Split(ids, ",")
445
 	flows, _ := service.GetNewDrugFlowInfo(id_arr)
456
 	flows, _ := service.GetNewDrugFlowInfo(id_arr)
446
 	admin_user_id, _ := c.GetInt64("admin_user_id")
457
 	admin_user_id, _ := c.GetInt64("admin_user_id")

+ 7 - 7
main.go View File

26
 func init() {
26
 func init() {
27
 	//service.ConnectNMMSDB()
27
 	//service.ConnectNMMSDB()
28
 	service.ConnectDB()
28
 	service.ConnectDB()
29
-	//org_id, _ := beego.AppConfig.Int64("org_id")
30
-	//miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
31
-	//////CreateLog(miConfig)
32
-	//////UploadLog(miConfig)31
33
-	//if org_id == 10191 {
34
-	//	service.GetFjAuthorizationInfo(miConfig.Code)
35
-	//}
29
+	org_id, _ := beego.AppConfig.Int64("org_id")
30
+	miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
31
+	////CreateLog(miConfig)
32
+	////UploadLog(miConfig)31
33
+	if org_id == 10191 {
34
+		service.GetFjAuthorizationInfo(miConfig.Code)
35
+	}
36
 
36
 
37
 
37
 
38
 
38
 

+ 3 - 0
models/new_stock_models.go View File

263
 
263
 
264
 	IsPc int64 `gorm:"column:is_pc" json:"is_pc" form:"is_pc"`
264
 	IsPc int64 `gorm:"column:is_pc" json:"is_pc" form:"is_pc"`
265
 	IsBg int64 `gorm:"column:is_bg" json:"is_bg" form:"is_bg"`
265
 	IsBg int64 `gorm:"column:is_bg" json:"is_bg" form:"is_bg"`
266
+	Bchno string `gorm:"column:bchno" json:"bchno" form:"bchno"`
267
+
268
+
266
 }
269
 }
267
 
270
 
268
 func (NewDrugWarehouseInfo) TableName() string {
271
 func (NewDrugWarehouseInfo) TableName() string {

+ 5 - 15
service/fj_service.go View File

1006
 }
1006
 }
1007
 
1007
 
1008
 // 医药机构费用结算对总账 func Gdyb3201( org_name string, doctor string, secret_key string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string) string {
1008
 // 医药机构费用结算对总账 func Gdyb3201( org_name string, doctor string, secret_key string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string) string {
1009
-func FJyb3201(baseParams models.BaseParams, businessParams models.BusinessParams, med string, fund string) (string, string, string) {
1009
+func FJyb3201(baseParams models.BaseParams, businessParams models.BusinessParams, med string, fund string,acct string) (string, string, string) {
1010
 
1010
 
1011
 	fmt.Println(baseParams)
1011
 	fmt.Println(baseParams)
1012
 	fmt.Println(businessParams)
1012
 	fmt.Println(businessParams)
1040
 	inputData["stmt_enddate"] = businessParams.StmtEnddate            //对帐结束时间
1040
 	inputData["stmt_enddate"] = businessParams.StmtEnddate            //对帐结束时间
1041
 	inputData["medfee_sumamt"] = med                                  //医疗费总额
1041
 	inputData["medfee_sumamt"] = med                                  //医疗费总额
1042
 	inputData["fund_pay_sumamt"] = fund                               //基金支付总额
1042
 	inputData["fund_pay_sumamt"] = fund                               //基金支付总额
1043
-	inputData["acct_pay"] = businessParams.AcctPay                    //个人账户支付金额
1043
+	inputData["acct_pay"] = acct                    //个人账户支付金额
1044
 	inputData["fixmedins_setl_cnt"] = businessParams.FixmedinsSetlCnt //定点医药机构结算笔数
1044
 	inputData["fixmedins_setl_cnt"] = businessParams.FixmedinsSetlCnt //定点医药机构结算笔数
1045
 	inputData["refd_setl_flag"] = "0"                                 // 就诊 ID(来自2201接口返回)
1045
 	inputData["refd_setl_flag"] = "0"                                 // 就诊 ID(来自2201接口返回)
1046
 
1046
 
3037
 	inputData["manu_date"] = struct3501.ManuDate                    // 人员编号 (来自1101接口返回)
3037
 	inputData["manu_date"] = struct3501.ManuDate                    // 人员编号 (来自1101接口返回)
3038
 	inputData["expy_end"] = struct3501.ExpyEnd                      // 人员编号 (来自1101接口返回)
3038
 	inputData["expy_end"] = struct3501.ExpyEnd                      // 人员编号 (来自1101接口返回)
3039
 	inputData["memo"] = struct3501.Memo                             // 人员编号 (来自1101接口返回)
3039
 	inputData["memo"] = struct3501.Memo                             // 人员编号 (来自1101接口返回)
3040
-	druginputData["drug_trac_codg"] = "123"
3040
+	druginputData["drug_trac_codg"] = "12345678912345678901"
3041
 	//druginputData2["drugtracinfo"] = druginputData
3041
 	//druginputData2["drugtracinfo"] = druginputData
3042
 	inputData["drug_trac_info"] = druginputData
3042
 	inputData["drug_trac_info"] = druginputData
3043
 	input["invinfo"] = inputData
3043
 	input["invinfo"] = inputData
3054
 
3054
 
3055
 	enc := mahonia.NewEncoder("gbk")
3055
 	enc := mahonia.NewEncoder("gbk")
3056
 	output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
3056
 	output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
3057
-
3058
 	return output, requestLog, err_msg
3057
 	return output, requestLog, err_msg
3059
 }
3058
 }
3060
 
3059
 
3070
 	input := make(map[string]interface{})
3069
 	input := make(map[string]interface{})
3071
 	inputData := make(map[string]interface{})
3070
 	inputData := make(map[string]interface{})
3072
 	druginputData := make(map[string]interface{})
3071
 	druginputData := make(map[string]interface{})
3073
-	druginputData2 := make(map[string]interface{})
3074
-
3075
 	inputMessage["infno"] = "3502"                      // 交易编码
3072
 	inputMessage["infno"] = "3502"                      // 交易编码
3076
 	inputData["med_list_codg"] = struct3502.MedListCodg // 定点医药机构目录编号
3073
 	inputData["med_list_codg"] = struct3502.MedListCodg // 定点医药机构目录编号
3077
 	inputData["inv_chg_type"] = struct3502.InvChgType   // 定点医药机构目录编号
3074
 	inputData["inv_chg_type"] = struct3502.InvChgType   // 定点医药机构目录编号
3078
-
3079
 	inputData["fixmedins_hilist_id"] = struct3502.FixmedinsCode // 定点医药机构目录编号
3075
 	inputData["fixmedins_hilist_id"] = struct3502.FixmedinsCode // 定点医药机构目录编号
3080
 	inputData["fixmedins_hilist_name"] = struct3502.OrgName     // 定点医药机构目录名称
3076
 	inputData["fixmedins_hilist_name"] = struct3502.OrgName     // 定点医药机构目录名称
3081
 	inputData["fixmedins_bchno"] = struct3502.FixmedinsBchno    // 人员编号 (来自1101接口返回)
3077
 	inputData["fixmedins_bchno"] = struct3502.FixmedinsBchno    // 人员编号 (来自1101接口返回)
3082
 	inputData["pric"] = struct3502.Pric                         // 人员编号 (来自1101接口返回)
3078
 	inputData["pric"] = struct3502.Pric                         // 人员编号 (来自1101接口返回)
3083
 	inputData["cnt"] = struct3502.Cnt                           // 人员编号 (来自1101接口返回)
3079
 	inputData["cnt"] = struct3502.Cnt                           // 人员编号 (来自1101接口返回)
3084
 	inputData["rx_flag"] = struct3502.RxFlag                    //
3080
 	inputData["rx_flag"] = struct3502.RxFlag                    //
3085
-
3086
 	inputData["inv_chg_time"] = struct3502.InvChgTime // 人员编号 (来自1101接口返回)
3081
 	inputData["inv_chg_time"] = struct3502.InvChgTime // 人员编号 (来自1101接口返回)
3087
 	inputData["inv_chg_opter_name"] = ""              // 人员编号 (来自1101接口返回)
3082
 	inputData["inv_chg_opter_name"] = ""              // 人员编号 (来自1101接口返回)
3088
 	inputData["memo"] = struct3502.Memo               // 人员编号 (来自1101接口返回)
3083
 	inputData["memo"] = struct3502.Memo               // 人员编号 (来自1101接口返回)
3089
 	inputData["trdn_flag"] = ""                       // 人员编号 (来自1101接口返回)
3084
 	inputData["trdn_flag"] = ""                       // 人员编号 (来自1101接口返回)
3090
-
3091
-	druginputData["drug_trac_codg"] = ""
3092
-	druginputData2["drugtracinfo"] = druginputData
3093
-	inputData["drug_trac_info"] = druginputData2
3094
-
3085
+	druginputData["drug_trac_codg"] = "12345678912345678901"
3086
+	inputData["drug_trac_info"] = druginputData
3095
 	input["invinfo"] = inputData
3087
 	input["invinfo"] = inputData
3096
 	inputMessage["input"] = input //交易输入
3088
 	inputMessage["input"] = input //交易输入
3097
-
3098
 	bytesData, err := json.Marshal(inputMessage)
3089
 	bytesData, err := json.Marshal(inputMessage)
3099
 	var requestLog string
3090
 	var requestLog string
3100
 	//bytesData, err := json.Marshal(inputMessage)
3091
 	//bytesData, err := json.Marshal(inputMessage)
3104
 		fmt.Println(err.Error())
3095
 		fmt.Println(err.Error())
3105
 		return err.Error(), "", ""
3096
 		return err.Error(), "", ""
3106
 	}
3097
 	}
3107
-
3108
 	enc := mahonia.NewEncoder("gbk")
3098
 	enc := mahonia.NewEncoder("gbk")
3109
 	output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
3099
 	output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
3110
 	return output, requestLog, err_msg
3100
 	return output, requestLog, err_msg