|
@@ -38,7 +38,7 @@ func HisManagerApiRegistRouters() {
|
38
|
38
|
beego.Router("/api/checkaccount/get", &HisApiController{}, "get:GetCheckAccount")
|
39
|
39
|
beego.Router("/api/checkdetailaccount/get", &HisApiController{}, "get:GetCheckDetailAccount")
|
40
|
40
|
beego.Router("/api/refund/post", &HisApiController{}, "get:Refund")
|
41
|
|
- //beego.Router("/api/sscard", &HisApiController{}, "get:Sscard")
|
|
41
|
+ beego.Router("/api/sscard", &HisApiController{}, "get:Sscard")
|
42
|
42
|
beego.Router("/api/refundnumber/post", &HisApiController{}, "get:RefundNumber")
|
43
|
43
|
beego.Router("/api/refunddetail/post", &HisApiController{}, "get:RefundDetail")
|
44
|
44
|
beego.Router("/api/treatment/check", &HisApiController{}, "get:CheckTreatment")
|
|
@@ -243,256 +243,215 @@ func (c *HisApiController) GetHisPatientInfo() {
|
243
|
243
|
}
|
244
|
244
|
}
|
245
|
245
|
|
246
|
|
-//func (c *HisApiController) Sscard() {
|
247
|
|
-// id_card_type, _ := c.GetInt64("id_card_type")
|
248
|
|
-// adminUser := c.GetAdminUserInfo()
|
249
|
|
-// miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
|
250
|
|
-//
|
251
|
|
-// r := CardInit()
|
252
|
|
-// fmt.Println(r)
|
253
|
|
-// //if r == 0 {
|
254
|
|
-// switch id_card_type {
|
255
|
|
-// case 1:
|
256
|
|
-// basStr, err := GetBasBaseInfo()
|
257
|
|
-//
|
258
|
|
-// if err != nil {
|
259
|
|
-// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
|
260
|
|
-// return
|
261
|
|
-//
|
262
|
|
-// } else {
|
263
|
|
-// fmt.Println(basStr)
|
264
|
|
-//
|
265
|
|
-// bas := strings.Split(basStr, "|")
|
266
|
|
-//
|
267
|
|
-// basNumber := bas[1]
|
268
|
|
-//
|
269
|
|
-// //basNumber := bas[2]
|
270
|
|
-// card_sn := bas[3]
|
271
|
|
-//
|
272
|
|
-// appRole, _ := service.GetAppRole(adminUser.CurrentOrgId)
|
273
|
|
-//
|
274
|
|
-// api := "http://127.0.0.1:9532/" + "gdyb/one?cert_no=" + basNumber + "&org_name=" + miConfig.OrgName + "&doctor=" + appRole.UserName + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(int64(id_card_type), 10) + "&card_sn=" + card_sn
|
275
|
|
-// resp, requestErr := http.Get(api)
|
276
|
|
-// if requestErr != nil {
|
277
|
|
-// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
278
|
|
-// return
|
279
|
|
-// }
|
280
|
|
-// defer resp.Body.Close()
|
281
|
|
-// body, ioErr := ioutil.ReadAll(resp.Body)
|
282
|
|
-// if ioErr != nil {
|
283
|
|
-// utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
|
284
|
|
-// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
285
|
|
-// return
|
286
|
|
-// }
|
287
|
|
-// var respJSON map[string]interface{}
|
288
|
|
-//
|
289
|
|
-// if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
|
290
|
|
-// utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
291
|
|
-// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
292
|
|
-// return
|
293
|
|
-// }
|
294
|
|
-//
|
295
|
|
-// userJSON := respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
296
|
|
-// userJSONBytes, _ := json.Marshal(userJSON)
|
297
|
|
-// var res ResultTwo
|
298
|
|
-// if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
299
|
|
-// utils.ErrorLog("解析失败:%v", err)
|
300
|
|
-// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
301
|
|
-// return
|
302
|
|
-// }
|
303
|
|
-// Iinfos, _ := json.Marshal(res.Output.Iinfo)
|
304
|
|
-// Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
|
305
|
|
-// infoStr := string(Iinfos)
|
306
|
|
-// idetinfoStr := string(Idetinfos)
|
307
|
|
-//
|
308
|
|
-// if res.Infcode == 0 {
|
309
|
|
-// his := models.VMHisPatient{
|
310
|
|
-// Status: 1,
|
311
|
|
-// Ctime: time.Now().Unix(),
|
312
|
|
-// Mtime: time.Now().Unix(),
|
313
|
|
-// PsnNo: res.Output.Baseinfo.PsnNo,
|
314
|
|
-// PsnCertType: res.Output.Baseinfo.PsnCertType,
|
315
|
|
-// Certno: res.Output.Baseinfo.Certno,
|
316
|
|
-// PsnName: res.Output.Baseinfo.PsnName,
|
317
|
|
-// Gend: res.Output.Baseinfo.Gend,
|
318
|
|
-// Naty: res.Output.Baseinfo.Naty,
|
319
|
|
-// Brdy: res.Output.Baseinfo.Brdy,
|
320
|
|
-// Age: res.Output.Baseinfo.Age,
|
321
|
|
-// Iinfo: infoStr,
|
322
|
|
-// Idetinfo: idetinfoStr,
|
323
|
|
-// UserOrgId: adminUser.CurrentOrgId,
|
324
|
|
-// IsReturn: 1,
|
325
|
|
-// IdCardType: id_card_type,
|
326
|
|
-// }
|
327
|
|
-//
|
328
|
|
-// patient, err := service.GetPatientByNumber(basNumber, adminUser.CurrentOrgId)
|
329
|
|
-// if err == gorm.ErrRecordNotFound {
|
330
|
|
-// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
|
331
|
|
-// return
|
332
|
|
-//
|
333
|
|
-// } else if err != nil {
|
334
|
|
-// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
335
|
|
-// return
|
336
|
|
-//
|
337
|
|
-// } else {
|
338
|
|
-// c.ServeSuccessJSON(map[string]interface{}{
|
339
|
|
-// "patient": patient,
|
340
|
|
-// "his": his,
|
341
|
|
-// "number": basNumber,
|
342
|
|
-// })
|
343
|
|
-// }
|
344
|
|
-// } else {
|
345
|
|
-// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
|
346
|
|
-// return
|
347
|
|
-// }
|
348
|
|
-//
|
349
|
|
-// }
|
350
|
|
-//
|
351
|
|
-// break
|
352
|
|
-// case 2:
|
353
|
|
-// ////SFZStr, err := GetSFZBaseInfo()
|
354
|
|
-// //if err != nil {
|
355
|
|
-// // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
|
356
|
|
-// // return
|
357
|
|
-// //
|
358
|
|
-// //} else {
|
359
|
|
-// //
|
360
|
|
-// // id_card_str := strings.Split(SFZStr, "^")
|
361
|
|
-// // id_card_number := id_card_str[0]
|
362
|
|
-// //appRole, _ := service.GetAppRole(adminUser.CurrentOrgId)
|
363
|
|
-// //
|
364
|
|
-// //api := "http://127.0.0.1:9532/" + "gdyb/one?cert_no=" + id_card_number + "&org_name=" + miConfig.OrgName + "&doctor=" + appRole.UserName + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(int64(id_card_type), 10)
|
365
|
|
-// //resp, requestErr := http.Get(api)
|
366
|
|
-// //if requestErr != nil {
|
367
|
|
-// // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
368
|
|
-// // return
|
369
|
|
-// //}
|
370
|
|
-// //defer resp.Body.Close()
|
371
|
|
-// //body, ioErr := ioutil.ReadAll(resp.Body)
|
372
|
|
-// //if ioErr != nil {
|
373
|
|
-// // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
|
374
|
|
-// // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
375
|
|
-// // return
|
376
|
|
-// //}
|
377
|
|
-// //var respJSON map[string]interface{}
|
378
|
|
-// //
|
379
|
|
-// //if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
|
380
|
|
-// // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
381
|
|
-// // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
382
|
|
-// // return
|
383
|
|
-// //}
|
384
|
|
-// //
|
385
|
|
-// //userJSON := respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
386
|
|
-// //userJSONBytes, _ := json.Marshal(userJSON)
|
387
|
|
-// //var res ResultTwo
|
388
|
|
-// //if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
389
|
|
-// // utils.ErrorLog("解析失败:%v", err)
|
390
|
|
-// // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
391
|
|
-// // return
|
392
|
|
-// //}
|
393
|
|
-// //Iinfos, _ := json.Marshal(res.Output.Iinfo)
|
394
|
|
-// //Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
|
395
|
|
-// //infoStr := string(Iinfos)
|
396
|
|
-// //idetinfoStr := string(Idetinfos)
|
397
|
|
-// //
|
398
|
|
-// //if res.Infcode == 0 {
|
399
|
|
-// // his := models.VMHisPatient{
|
400
|
|
-// // Status: 1,
|
401
|
|
-// // Ctime: time.Now().Unix(),
|
402
|
|
-// // Mtime: time.Now().Unix(),
|
403
|
|
-// // PsnNo: res.Output.Baseinfo.PsnNo,
|
404
|
|
-// // PsnCertType: res.Output.Baseinfo.PsnCertType,
|
405
|
|
-// // Certno: res.Output.Baseinfo.Certno,
|
406
|
|
-// // PsnName: res.Output.Baseinfo.PsnName,
|
407
|
|
-// // Gend: res.Output.Baseinfo.Gend,
|
408
|
|
-// // Naty: res.Output.Baseinfo.Naty,
|
409
|
|
-// // Brdy: res.Output.Baseinfo.Brdy,
|
410
|
|
-// // Age: res.Output.Baseinfo.Age,
|
411
|
|
-// // Iinfo: infoStr,
|
412
|
|
-// // Idetinfo: idetinfoStr,
|
413
|
|
-// // UserOrgId: adminUser.CurrentOrgId,
|
414
|
|
-// // IsReturn: 1,
|
415
|
|
-// // IdCardType: id_card_type,
|
416
|
|
-// // }
|
417
|
|
-//
|
418
|
|
-// // patient, err := service.GetPatientByNumber(id_card_number, adminUser.CurrentOrgId)
|
419
|
|
-// // if err == gorm.ErrRecordNotFound {
|
420
|
|
-// // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
|
421
|
|
-// // return
|
422
|
|
-// //
|
423
|
|
-// // } else if err != nil {
|
424
|
|
-// // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
425
|
|
-// // return
|
426
|
|
-// //
|
427
|
|
-// // } else {
|
428
|
|
-// // c.ServeSuccessJSON(map[string]interface{}{
|
429
|
|
-// // "patient": patient,
|
430
|
|
-// // "number": id_card_number,
|
431
|
|
-// // })
|
432
|
|
-// // }
|
433
|
|
-// //}
|
434
|
|
-// break
|
435
|
|
-// case 3:
|
436
|
|
-//
|
437
|
|
-// break
|
438
|
|
-//
|
439
|
|
-// }
|
440
|
|
-//}
|
|
246
|
+func (c *HisApiController) Sscard() {
|
|
247
|
+ //id_card_type, _ := c.GetInt64("id_card_type")
|
|
248
|
+ //adminUser := c.GetAdminUserInfo()
|
|
249
|
+ //miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
|
|
250
|
+ id_card_type := 1
|
|
251
|
+ r := CardInit()
|
|
252
|
+ fmt.Println(r)
|
|
253
|
+ //if r == 0 {
|
|
254
|
+ switch id_card_type {
|
|
255
|
+ case 1:
|
|
256
|
+ GetBasBaseInfo()
|
|
257
|
+
|
|
258
|
+ //if err != nil {
|
|
259
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
|
|
260
|
+ // return
|
|
261
|
+ //
|
|
262
|
+ //} else {
|
|
263
|
+ // fmt.Println(basStr)
|
|
264
|
+ //
|
|
265
|
+ // bas := strings.Split(basStr, "|")
|
|
266
|
+ //
|
|
267
|
+ // basNumber := bas[1]
|
|
268
|
+ //
|
|
269
|
+ // //basNumber := bas[2]
|
|
270
|
+ // card_sn := bas[3]
|
|
271
|
+ //
|
|
272
|
+ // appRole, _ := service.GetAppRole(adminUser.CurrentOrgId)
|
|
273
|
+ //
|
|
274
|
+ // api := "http://127.0.0.1:9532/" + "gdyb/one?cert_no=" + basNumber + "&org_name=" + miConfig.OrgName + "&doctor=" + appRole.UserName + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(int64(id_card_type), 10) + "&card_sn=" + card_sn
|
|
275
|
+ // resp, requestErr := http.Get(api)
|
|
276
|
+ // if requestErr != nil {
|
|
277
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
278
|
+ // return
|
|
279
|
+ // }
|
|
280
|
+ // defer resp.Body.Close()
|
|
281
|
+ // body, ioErr := ioutil.ReadAll(resp.Body)
|
|
282
|
+ // if ioErr != nil {
|
|
283
|
+ // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
|
|
284
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
285
|
+ // return
|
|
286
|
+ // }
|
|
287
|
+ // var respJSON map[string]interface{}
|
|
288
|
+ //
|
|
289
|
+ // if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
|
|
290
|
+ // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
|
291
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
292
|
+ // return
|
|
293
|
+ // }
|
|
294
|
+ //
|
|
295
|
+ // userJSON := respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
|
296
|
+ // userJSONBytes, _ := json.Marshal(userJSON)
|
|
297
|
+ // var res ResultTwo
|
|
298
|
+ // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
|
299
|
+ // utils.ErrorLog("解析失败:%v", err)
|
|
300
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
301
|
+ // return
|
|
302
|
+ // }
|
|
303
|
+ // Iinfos, _ := json.Marshal(res.Output.Iinfo)
|
|
304
|
+ // Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
|
|
305
|
+ // infoStr := string(Iinfos)
|
|
306
|
+ // idetinfoStr := string(Idetinfos)
|
|
307
|
+ //
|
|
308
|
+ // if res.Infcode == 0 {
|
|
309
|
+ // his := models.VMHisPatient{
|
|
310
|
+ // Status: 1,
|
|
311
|
+ // Ctime: time.Now().Unix(),
|
|
312
|
+ // Mtime: time.Now().Unix(),
|
|
313
|
+ // PsnNo: res.Output.Baseinfo.PsnNo,
|
|
314
|
+ // PsnCertType: res.Output.Baseinfo.PsnCertType,
|
|
315
|
+ // Certno: res.Output.Baseinfo.Certno,
|
|
316
|
+ // PsnName: res.Output.Baseinfo.PsnName,
|
|
317
|
+ // Gend: res.Output.Baseinfo.Gend,
|
|
318
|
+ // Naty: res.Output.Baseinfo.Naty,
|
|
319
|
+ // Brdy: res.Output.Baseinfo.Brdy,
|
|
320
|
+ // Age: res.Output.Baseinfo.Age,
|
|
321
|
+ // Iinfo: infoStr,
|
|
322
|
+ // Idetinfo: idetinfoStr,
|
|
323
|
+ // UserOrgId: adminUser.CurrentOrgId,
|
|
324
|
+ // IsReturn: 1,
|
|
325
|
+ // IdCardType: id_card_type,
|
|
326
|
+ // }
|
|
327
|
+ //
|
|
328
|
+ // patient, err := service.GetPatientByNumber(basNumber, adminUser.CurrentOrgId)
|
|
329
|
+ // if err == gorm.ErrRecordNotFound {
|
|
330
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
|
|
331
|
+ // return
|
|
332
|
+ //
|
|
333
|
+ // } else if err != nil {
|
|
334
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
335
|
+ // return
|
|
336
|
+ //
|
|
337
|
+ // } else {
|
|
338
|
+ // c.ServeSuccessJSON(map[string]interface{}{
|
|
339
|
+ // "patient": patient,
|
|
340
|
+ // "his": his,
|
|
341
|
+ // "number": basNumber,
|
|
342
|
+ // })
|
|
343
|
+ // }
|
|
344
|
+ // } else {
|
|
345
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
|
|
346
|
+ // return
|
|
347
|
+ // }
|
|
348
|
+ //
|
|
349
|
+ //}
|
441
|
350
|
|
442
|
|
-//func GetBasBaseInfo() (jsonStr string, err error) {
|
443
|
|
-//
|
444
|
|
-// handle, err := syscall.LoadLibrary("SSCard.dll")
|
445
|
|
-// if err != nil {
|
446
|
|
-// fmt.Printf("Error: %s\n", err)
|
447
|
|
-// return "", err
|
448
|
|
-// }
|
449
|
|
-// defer syscall.FreeLibrary(handle)
|
450
|
|
-// str := make([]byte, 256)
|
451
|
|
-// str1 := make([]byte, 256)
|
452
|
|
-// add, err := syscall.GetProcAddress(handle, "ReadCardBas")
|
453
|
|
-// if err != nil {
|
454
|
|
-// fmt.Printf("Error: %s\n", err)
|
455
|
|
-// return "", err
|
456
|
|
-// }
|
457
|
|
-// ret, _, _ := syscall.Syscall(add, (uintptr)(unsafe.Pointer(&str[0])), IntPtr(1024), (uintptr)(unsafe.Pointer(&str1[0])), IntPtr(1024))
|
458
|
|
-// if err != nil {
|
459
|
|
-// fmt.Printf("Error: %s\n", err)
|
460
|
|
-// }
|
461
|
|
-// fmt.Println("> Add(4,5)的结果为:", ret)
|
462
|
|
-// //return nil
|
463
|
|
-//
|
464
|
|
-// //
|
465
|
|
-// //handle := syscall.NewLazyDLL("SSCard.dll")
|
466
|
|
-// //ReadCardBas := handle.NewProc("ReadCardBas")
|
467
|
|
-// //
|
468
|
|
-// //var str2 [1024]C.char
|
469
|
|
-// //var str3 [1024]C.char
|
470
|
|
-// //
|
471
|
|
-// //
|
472
|
|
-// //
|
473
|
|
-// ////sssssswwwww
|
474
|
|
-// ////a := 256
|
475
|
|
-// //
|
476
|
|
-// //r, _, _ := ReadCardBas.Call(&str2, 1024, &str3, 1024)
|
477
|
|
-// //fmt.Println(r)
|
478
|
|
-// ////p := (*byte)(unsafe.Pointer(r))
|
479
|
|
-// // define a slice to fill with the p string
|
480
|
|
-// //data := make([]byte, 0)
|
481
|
|
-//
|
482
|
|
-// // loop until find '\0'
|
483
|
|
-// //if *p != 0 {
|
484
|
|
-// //
|
485
|
|
-// // //data = append(data, *p) // append 1 byte
|
486
|
|
-// // //r += unsafe.Sizeof(byte(0)) // move r to next byte
|
487
|
|
-// // //p = (*byte)(unsafe.Pointer(r)) // get the byte value
|
488
|
|
-// //} else {
|
489
|
|
-// // return "", nil
|
490
|
|
-// //
|
491
|
|
-// //}
|
492
|
|
-//
|
493
|
|
-// return "", nil
|
494
|
|
-//
|
495
|
|
-//}
|
|
351
|
+ break
|
|
352
|
+ case 2:
|
|
353
|
+ ////SFZStr, err := GetSFZBaseInfo()
|
|
354
|
+ //if err != nil {
|
|
355
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
|
|
356
|
+ // return
|
|
357
|
+ //
|
|
358
|
+ //} else {
|
|
359
|
+ //
|
|
360
|
+ // id_card_str := strings.Split(SFZStr, "^")
|
|
361
|
+ // id_card_number := id_card_str[0]
|
|
362
|
+ //appRole, _ := service.GetAppRole(adminUser.CurrentOrgId)
|
|
363
|
+ //
|
|
364
|
+ //api := "http://127.0.0.1:9532/" + "gdyb/one?cert_no=" + id_card_number + "&org_name=" + miConfig.OrgName + "&doctor=" + appRole.UserName + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(int64(id_card_type), 10)
|
|
365
|
+ //resp, requestErr := http.Get(api)
|
|
366
|
+ //if requestErr != nil {
|
|
367
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
368
|
+ // return
|
|
369
|
+ //}
|
|
370
|
+ //defer resp.Body.Close()
|
|
371
|
+ //body, ioErr := ioutil.ReadAll(resp.Body)
|
|
372
|
+ //if ioErr != nil {
|
|
373
|
+ // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
|
|
374
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
375
|
+ // return
|
|
376
|
+ //}
|
|
377
|
+ //var respJSON map[string]interface{}
|
|
378
|
+ //
|
|
379
|
+ //if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
|
|
380
|
+ // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
|
381
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
382
|
+ // return
|
|
383
|
+ //}
|
|
384
|
+ //
|
|
385
|
+ //userJSON := respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
|
386
|
+ //userJSONBytes, _ := json.Marshal(userJSON)
|
|
387
|
+ //var res ResultTwo
|
|
388
|
+ //if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
|
389
|
+ // utils.ErrorLog("解析失败:%v", err)
|
|
390
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
391
|
+ // return
|
|
392
|
+ //}
|
|
393
|
+ //Iinfos, _ := json.Marshal(res.Output.Iinfo)
|
|
394
|
+ //Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
|
|
395
|
+ //infoStr := string(Iinfos)
|
|
396
|
+ //idetinfoStr := string(Idetinfos)
|
|
397
|
+ //
|
|
398
|
+ //if res.Infcode == 0 {
|
|
399
|
+ // his := models.VMHisPatient{
|
|
400
|
+ // Status: 1,
|
|
401
|
+ // Ctime: time.Now().Unix(),
|
|
402
|
+ // Mtime: time.Now().Unix(),
|
|
403
|
+ // PsnNo: res.Output.Baseinfo.PsnNo,
|
|
404
|
+ // PsnCertType: res.Output.Baseinfo.PsnCertType,
|
|
405
|
+ // Certno: res.Output.Baseinfo.Certno,
|
|
406
|
+ // PsnName: res.Output.Baseinfo.PsnName,
|
|
407
|
+ // Gend: res.Output.Baseinfo.Gend,
|
|
408
|
+ // Naty: res.Output.Baseinfo.Naty,
|
|
409
|
+ // Brdy: res.Output.Baseinfo.Brdy,
|
|
410
|
+ // Age: res.Output.Baseinfo.Age,
|
|
411
|
+ // Iinfo: infoStr,
|
|
412
|
+ // Idetinfo: idetinfoStr,
|
|
413
|
+ // UserOrgId: adminUser.CurrentOrgId,
|
|
414
|
+ // IsReturn: 1,
|
|
415
|
+ // IdCardType: id_card_type,
|
|
416
|
+ // }
|
|
417
|
+
|
|
418
|
+ // patient, err := service.GetPatientByNumber(id_card_number, adminUser.CurrentOrgId)
|
|
419
|
+ // if err == gorm.ErrRecordNotFound {
|
|
420
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
|
|
421
|
+ // return
|
|
422
|
+ //
|
|
423
|
+ // } else if err != nil {
|
|
424
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
425
|
+ // return
|
|
426
|
+ //
|
|
427
|
+ // } else {
|
|
428
|
+ // c.ServeSuccessJSON(map[string]interface{}{
|
|
429
|
+ // "patient": patient,
|
|
430
|
+ // "number": id_card_number,
|
|
431
|
+ // })
|
|
432
|
+ // }
|
|
433
|
+ //}
|
|
434
|
+ break
|
|
435
|
+ case 3:
|
|
436
|
+
|
|
437
|
+ break
|
|
438
|
+
|
|
439
|
+ }
|
|
440
|
+}
|
|
441
|
+
|
|
442
|
+func GetBasBaseInfo() (jsonStr string, err error) {
|
|
443
|
+
|
|
444
|
+ handle := syscall.MustLoadDLL("SSCard.dll")
|
|
445
|
+ add := handle.MustFindProc("ReadCardBas")
|
|
446
|
+ str := make([]byte, 256)
|
|
447
|
+ str1 := make([]byte, 256)
|
|
448
|
+ ret, _, _ := add.Call((uintptr)(unsafe.Pointer(&str[0])), IntPtr(1024), (uintptr)(unsafe.Pointer(&str1[0])), IntPtr(1024))
|
|
449
|
+ fmt.Println(string(str))
|
|
450
|
+ fmt.Println(string(str1))
|
|
451
|
+ fmt.Println("> Add(4,5)的结果为:", ret)
|
|
452
|
+ return "", nil
|
|
453
|
+
|
|
454
|
+}
|
496
|
455
|
|
497
|
456
|
//func GetSFZBaseInfo() (jsonStr string, err error) {
|
498
|
457
|
// //handle := syscall.MustLoadDLL("SSCard.dll")
|
|
@@ -518,16 +477,16 @@ func (c *HisApiController) GetHisPatientInfo() {
|
518
|
477
|
// return string(str), nil
|
519
|
478
|
//}
|
520
|
479
|
|
521
|
|
-//func CardInit() int {
|
522
|
|
-// DllTestDef := syscall.MustLoadDLL("SSCard.dll")
|
523
|
|
-// add := DllTestDef.MustFindProc("Init")
|
524
|
|
-// ret, _, err := add.Call(StrPtr("http://igb.hsa.gdgov.cn/gdyb_inf/poc/api/card/initDll"), StrPtr("440200"))
|
525
|
|
-// if err != nil {
|
526
|
|
-// fmt.Println("SSCard的运算结果为:", ret)
|
527
|
|
-// }
|
528
|
|
-// result := int(ret)
|
529
|
|
-// return result
|
530
|
|
-//}
|
|
480
|
+func CardInit() int {
|
|
481
|
+ DllTestDef := syscall.MustLoadDLL("SSCard.dll")
|
|
482
|
+ add := DllTestDef.MustFindProc("Init")
|
|
483
|
+ ret, _, err := add.Call(StrPtr("http://igb.hsa.gdgov.cn/gdyb_inf/poc/api/card/initDll"), StrPtr("440200"))
|
|
484
|
+ if err != nil {
|
|
485
|
+ fmt.Println("SSCard的运算结果为:", ret)
|
|
486
|
+ }
|
|
487
|
+ result := int(ret)
|
|
488
|
+ return result
|
|
489
|
+}
|
531
|
490
|
|
532
|
491
|
//func CardInit() int {
|
533
|
492
|
// ret, _, err := add.Call(StrPtr("http://igb.hsa.gdgov.cn/gdyb_inf/poc/api/card/initDll"), StrPtr("440200"))
|