test_user преди 4 месеца
родител
ревизия
6fcacaa1dd
променени са 4 файла, в които са добавени 36 реда и са изтрити 32 реда
  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 Целия файл

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

+ 7 - 7
main.go Целия файл

@@ -26,13 +26,13 @@ import (
26 26
 func init() {
27 27
 	//service.ConnectNMMSDB()
28 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 Целия файл

@@ -263,6 +263,9 @@ type NewDrugWarehouseInfo struct {
263 263
 
264 264
 	IsPc int64 `gorm:"column:is_pc" json:"is_pc" form:"is_pc"`
265 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 271
 func (NewDrugWarehouseInfo) TableName() string {

+ 5 - 15
service/fj_service.go Целия файл

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