Browse Source

拉取代码

XMLWAN 3 years ago
parent
commit
21aabc25f7
2 changed files with 208 additions and 208 deletions
  1. 2 2
      conf/app.conf
  2. 206 206
      controllers/sg/his_api_controller.go

+ 2 - 2
conf/app.conf View File

@@ -1,5 +1,5 @@
1 1
 appname = 血透
2
-httpport = 9532
2
+httpport = 9531
3 3
 runmode = prod
4 4
 
5 5
 #
@@ -44,7 +44,7 @@ appsecret="61ee2e6268497d5aa9de0b0187c39aea"
44 44
 
45 45
 
46 46
 [prod]
47
-org_id = 9504
47
+org_id = 9990
48 48
 mobile_token_expiration_second = 86400
49 49
 httpdomain = https://api.xt.kuyicloud.com
50 50
 sso_domain = https://sso.kuyicloud.com

+ 206 - 206
controllers/sg/his_api_controller.go View File

@@ -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")
@@ -245,201 +245,201 @@ func (c *HisApiController) GetHisPatientInfo() {
245 245
 	}
246 246
 }
247 247
 
248
-//func (c *HisApiController) Sscard() {
249
-//	//id_card_type, _ := c.GetInt64("id_card_type")
250
-//	//adminUser := c.GetAdminUserInfo()
251
-//	//miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
252
-//	id_card_type := 1
253
-//	r := CardInit()
254
-//	fmt.Println(r)
255
-//	//if r == 0 {
256
-//	switch id_card_type {
257
-//	case 1:
258
-//		defer GetBasBaseInfo()
259
-//
260
-//		//if err != nil {
261
-//		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
262
-//		//	return
263
-//		//
264
-//		//} else {
265
-//		//	fmt.Println(basStr)
266
-//		//
267
-//		//	bas := strings.Split(basStr, "|")
268
-//		//
269
-//		//	basNumber := bas[1]
270
-//		//
271
-//		//	//basNumber := bas[2]
272
-//		//	card_sn := bas[3]
273
-//		//
274
-//		//	appRole, _ := service.GetAppRole(adminUser.CurrentOrgId)
275
-//		//
276
-//		//	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
277
-//		//	resp, requestErr := http.Get(api)
278
-//		//	if requestErr != nil {
279
-//		//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
280
-//		//		return
281
-//		//	}
282
-//		//	defer resp.Body.Close()
283
-//		//	body, ioErr := ioutil.ReadAll(resp.Body)
284
-//		//	if ioErr != nil {
285
-//		//		utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
286
-//		//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
287
-//		//		return
288
-//		//	}
289
-//		//	var respJSON map[string]interface{}
290
-//		//
291
-//		//	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
292
-//		//		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
293
-//		//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
294
-//		//		return
295
-//		//	}
296
-//		//
297
-//		//	userJSON := respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
298
-//		//	userJSONBytes, _ := json.Marshal(userJSON)
299
-//		//	var res ResultTwo
300
-//		//	if err := json.Unmarshal(userJSONBytes, &res); err != nil {
301
-//		//		utils.ErrorLog("解析失败:%v", err)
302
-//		//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
303
-//		//		return
304
-//		//	}
305
-//		//	Iinfos, _ := json.Marshal(res.Output.Iinfo)
306
-//		//	Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
307
-//		//	infoStr := string(Iinfos)
308
-//		//	idetinfoStr := string(Idetinfos)
309
-//		//
310
-//		//	if res.Infcode == 0 {
311
-//		//		his := models.VMHisPatient{
312
-//		//			Status:      1,
313
-//		//			Ctime:       time.Now().Unix(),
314
-//		//			Mtime:       time.Now().Unix(),
315
-//		//			PsnNo:       res.Output.Baseinfo.PsnNo,
316
-//		//			PsnCertType: res.Output.Baseinfo.PsnCertType,
317
-//		//			Certno:      res.Output.Baseinfo.Certno,
318
-//		//			PsnName:     res.Output.Baseinfo.PsnName,
319
-//		//			Gend:        res.Output.Baseinfo.Gend,
320
-//		//			Naty:        res.Output.Baseinfo.Naty,
321
-//		//			Brdy:        res.Output.Baseinfo.Brdy,
322
-//		//			Age:         res.Output.Baseinfo.Age,
323
-//		//			Iinfo:       infoStr,
324
-//		//			Idetinfo:    idetinfoStr,
325
-//		//			UserOrgId:   adminUser.CurrentOrgId,
326
-//		//			IsReturn:    1,
327
-//		//			IdCardType:  id_card_type,
328
-//		//		}
329
-//		//
330
-//		//		patient, err := service.GetPatientByNumber(basNumber, adminUser.CurrentOrgId)
331
-//		//		if err == gorm.ErrRecordNotFound {
332
-//		//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
333
-//		//			return
334
-//		//
335
-//		//		} else if err != nil {
336
-//		//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
337
-//		//			return
338
-//		//
339
-//		//		} else {
340
-//		//			c.ServeSuccessJSON(map[string]interface{}{
341
-//		//				"patient": patient,
342
-//		//				"his":     his,
343
-//		//				"number":  basNumber,
344
-//		//			})
345
-//		//		}
346
-//		//	} else {
347
-//		//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
348
-//		//		return
349
-//		//	}
350
-//		//
351
-//		//}
352
-//
353
-//		break
354
-//	case 2:
355
-//		////SFZStr, err := GetSFZBaseInfo()
356
-//		//if err != nil {
357
-//		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
358
-//		//	return
359
-//		//
360
-//		//} else {
361
-//		//
362
-//		//	id_card_str := strings.Split(SFZStr, "^")
363
-//		//	id_card_number := id_card_str[0]
364
-//		//appRole, _ := service.GetAppRole(adminUser.CurrentOrgId)
365
-//		//
366
-//		//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)
367
-//		//resp, requestErr := http.Get(api)
368
-//		//if requestErr != nil {
369
-//		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
370
-//		//	return
371
-//		//}
372
-//		//defer resp.Body.Close()
373
-//		//body, ioErr := ioutil.ReadAll(resp.Body)
374
-//		//if ioErr != nil {
375
-//		//	utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
376
-//		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
377
-//		//	return
378
-//		//}
379
-//		//var respJSON map[string]interface{}
380
-//		//
381
-//		//if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
382
-//		//	utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
383
-//		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
384
-//		//	return
385
-//		//}
386
-//		//
387
-//		//userJSON := respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
388
-//		//userJSONBytes, _ := json.Marshal(userJSON)
389
-//		//var res ResultTwo
390
-//		//if err := json.Unmarshal(userJSONBytes, &res); err != nil {
391
-//		//	utils.ErrorLog("解析失败:%v", err)
392
-//		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
393
-//		//	return
394
-//		//}
395
-//		//Iinfos, _ := json.Marshal(res.Output.Iinfo)
396
-//		//Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
397
-//		//infoStr := string(Iinfos)
398
-//		//idetinfoStr := string(Idetinfos)
399
-//		//
400
-//		//if res.Infcode == 0 {
401
-//		//	his := models.VMHisPatient{
402
-//		//		Status:      1,
403
-//		//		Ctime:       time.Now().Unix(),
404
-//		//		Mtime:       time.Now().Unix(),
405
-//		//		PsnNo:       res.Output.Baseinfo.PsnNo,
406
-//		//		PsnCertType: res.Output.Baseinfo.PsnCertType,
407
-//		//		Certno:      res.Output.Baseinfo.Certno,
408
-//		//		PsnName:     res.Output.Baseinfo.PsnName,
409
-//		//		Gend:        res.Output.Baseinfo.Gend,
410
-//		//		Naty:        res.Output.Baseinfo.Naty,
411
-//		//		Brdy:        res.Output.Baseinfo.Brdy,
412
-//		//		Age:         res.Output.Baseinfo.Age,
413
-//		//		Iinfo:       infoStr,
414
-//		//		Idetinfo:    idetinfoStr,
415
-//		//		UserOrgId:   adminUser.CurrentOrgId,
416
-//		//		IsReturn:    1,
417
-//		//		IdCardType:  id_card_type,
418
-//		//	}
419
-//
420
-//		//	patient, err := service.GetPatientByNumber(id_card_number, adminUser.CurrentOrgId)
421
-//		//	if err == gorm.ErrRecordNotFound {
422
-//		//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
423
-//		//		return
424
-//		//
425
-//		//	} else if err != nil {
426
-//		//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
427
-//		//		return
428
-//		//
429
-//		//	} else {
430
-//		//		c.ServeSuccessJSON(map[string]interface{}{
431
-//		//			"patient": patient,
432
-//		//			"number":  id_card_number,
433
-//		//		})
434
-//		//	}
435
-//		//}
436
-//		break
437
-//	case 3:
438
-//
439
-//		break
440
-//
441
-//	}
442
-//}
248
+func (c *HisApiController) Sscard() {
249
+	//id_card_type, _ := c.GetInt64("id_card_type")
250
+	//adminUser := c.GetAdminUserInfo()
251
+	//miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
252
+	id_card_type := 1
253
+	r := CardInit()
254
+	fmt.Println(r)
255
+	//if r == 0 {
256
+	switch id_card_type {
257
+	case 1:
258
+		defer GetBasBaseInfo()
259
+
260
+		//if err != nil {
261
+		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
262
+		//	return
263
+		//
264
+		//} else {
265
+		//	fmt.Println(basStr)
266
+		//
267
+		//	bas := strings.Split(basStr, "|")
268
+		//
269
+		//	basNumber := bas[1]
270
+		//
271
+		//	//basNumber := bas[2]
272
+		//	card_sn := bas[3]
273
+		//
274
+		//	appRole, _ := service.GetAppRole(adminUser.CurrentOrgId)
275
+		//
276
+		//	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
277
+		//	resp, requestErr := http.Get(api)
278
+		//	if requestErr != nil {
279
+		//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
280
+		//		return
281
+		//	}
282
+		//	defer resp.Body.Close()
283
+		//	body, ioErr := ioutil.ReadAll(resp.Body)
284
+		//	if ioErr != nil {
285
+		//		utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
286
+		//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
287
+		//		return
288
+		//	}
289
+		//	var respJSON map[string]interface{}
290
+		//
291
+		//	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
292
+		//		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
293
+		//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
294
+		//		return
295
+		//	}
296
+		//
297
+		//	userJSON := respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
298
+		//	userJSONBytes, _ := json.Marshal(userJSON)
299
+		//	var res ResultTwo
300
+		//	if err := json.Unmarshal(userJSONBytes, &res); err != nil {
301
+		//		utils.ErrorLog("解析失败:%v", err)
302
+		//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
303
+		//		return
304
+		//	}
305
+		//	Iinfos, _ := json.Marshal(res.Output.Iinfo)
306
+		//	Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
307
+		//	infoStr := string(Iinfos)
308
+		//	idetinfoStr := string(Idetinfos)
309
+		//
310
+		//	if res.Infcode == 0 {
311
+		//		his := models.VMHisPatient{
312
+		//			Status:      1,
313
+		//			Ctime:       time.Now().Unix(),
314
+		//			Mtime:       time.Now().Unix(),
315
+		//			PsnNo:       res.Output.Baseinfo.PsnNo,
316
+		//			PsnCertType: res.Output.Baseinfo.PsnCertType,
317
+		//			Certno:      res.Output.Baseinfo.Certno,
318
+		//			PsnName:     res.Output.Baseinfo.PsnName,
319
+		//			Gend:        res.Output.Baseinfo.Gend,
320
+		//			Naty:        res.Output.Baseinfo.Naty,
321
+		//			Brdy:        res.Output.Baseinfo.Brdy,
322
+		//			Age:         res.Output.Baseinfo.Age,
323
+		//			Iinfo:       infoStr,
324
+		//			Idetinfo:    idetinfoStr,
325
+		//			UserOrgId:   adminUser.CurrentOrgId,
326
+		//			IsReturn:    1,
327
+		//			IdCardType:  id_card_type,
328
+		//		}
329
+		//
330
+		//		patient, err := service.GetPatientByNumber(basNumber, adminUser.CurrentOrgId)
331
+		//		if err == gorm.ErrRecordNotFound {
332
+		//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
333
+		//			return
334
+		//
335
+		//		} else if err != nil {
336
+		//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
337
+		//			return
338
+		//
339
+		//		} else {
340
+		//			c.ServeSuccessJSON(map[string]interface{}{
341
+		//				"patient": patient,
342
+		//				"his":     his,
343
+		//				"number":  basNumber,
344
+		//			})
345
+		//		}
346
+		//	} else {
347
+		//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
348
+		//		return
349
+		//	}
350
+		//
351
+		//}
352
+
353
+		break
354
+	case 2:
355
+		////SFZStr, err := GetSFZBaseInfo()
356
+		//if err != nil {
357
+		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
358
+		//	return
359
+		//
360
+		//} else {
361
+		//
362
+		//	id_card_str := strings.Split(SFZStr, "^")
363
+		//	id_card_number := id_card_str[0]
364
+		//appRole, _ := service.GetAppRole(adminUser.CurrentOrgId)
365
+		//
366
+		//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)
367
+		//resp, requestErr := http.Get(api)
368
+		//if requestErr != nil {
369
+		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
370
+		//	return
371
+		//}
372
+		//defer resp.Body.Close()
373
+		//body, ioErr := ioutil.ReadAll(resp.Body)
374
+		//if ioErr != nil {
375
+		//	utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
376
+		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
377
+		//	return
378
+		//}
379
+		//var respJSON map[string]interface{}
380
+		//
381
+		//if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
382
+		//	utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
383
+		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
384
+		//	return
385
+		//}
386
+		//
387
+		//userJSON := respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
388
+		//userJSONBytes, _ := json.Marshal(userJSON)
389
+		//var res ResultTwo
390
+		//if err := json.Unmarshal(userJSONBytes, &res); err != nil {
391
+		//	utils.ErrorLog("解析失败:%v", err)
392
+		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
393
+		//	return
394
+		//}
395
+		//Iinfos, _ := json.Marshal(res.Output.Iinfo)
396
+		//Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
397
+		//infoStr := string(Iinfos)
398
+		//idetinfoStr := string(Idetinfos)
399
+		//
400
+		//if res.Infcode == 0 {
401
+		//	his := models.VMHisPatient{
402
+		//		Status:      1,
403
+		//		Ctime:       time.Now().Unix(),
404
+		//		Mtime:       time.Now().Unix(),
405
+		//		PsnNo:       res.Output.Baseinfo.PsnNo,
406
+		//		PsnCertType: res.Output.Baseinfo.PsnCertType,
407
+		//		Certno:      res.Output.Baseinfo.Certno,
408
+		//		PsnName:     res.Output.Baseinfo.PsnName,
409
+		//		Gend:        res.Output.Baseinfo.Gend,
410
+		//		Naty:        res.Output.Baseinfo.Naty,
411
+		//		Brdy:        res.Output.Baseinfo.Brdy,
412
+		//		Age:         res.Output.Baseinfo.Age,
413
+		//		Iinfo:       infoStr,
414
+		//		Idetinfo:    idetinfoStr,
415
+		//		UserOrgId:   adminUser.CurrentOrgId,
416
+		//		IsReturn:    1,
417
+		//		IdCardType:  id_card_type,
418
+		//	}
419
+
420
+		//	patient, err := service.GetPatientByNumber(id_card_number, adminUser.CurrentOrgId)
421
+		//	if err == gorm.ErrRecordNotFound {
422
+		//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
423
+		//		return
424
+		//
425
+		//	} else if err != nil {
426
+		//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
427
+		//		return
428
+		//
429
+		//	} else {
430
+		//		c.ServeSuccessJSON(map[string]interface{}{
431
+		//			"patient": patient,
432
+		//			"number":  id_card_number,
433
+		//		})
434
+		//	}
435
+		//}
436
+		break
437
+	case 3:
438
+
439
+		break
440
+
441
+	}
442
+}
443 443
 
444 444
 //func GetBasBaseInfo() (jsonStr string, err error) {
445 445
 //
@@ -483,16 +483,16 @@ func (c *HisApiController) GetHisPatientInfo() {
483 483
 //	return string(str), nil
484 484
 //}
485 485
 
486
-//func CardInit() int {
487
-//	DllTestDef := syscall.MustLoadDLL("SSCard.dll")
488
-//	add := DllTestDef.MustFindProc("Init")
489
-//	ret, _, err := add.Call(StrPtr("http://igb.hsa.gdgov.cn/gdyb_inf/poc/api/card/initDll"), StrPtr("440200"))
490
-//	if err != nil {
491
-//		fmt.Println("SSCard的运算结果为:", ret)
492
-//	}
493
-//	result := int(ret)
494
-//	return result
495
-//}
486
+func CardInit() int {
487
+	DllTestDef := syscall.MustLoadDLL("SSCard.dll")
488
+	add := DllTestDef.MustFindProc("Init")
489
+	ret, _, err := add.Call(StrPtr("http://igb.hsa.gdgov.cn/gdyb_inf/poc/api/card/initDll"), StrPtr("440200"))
490
+	if err != nil {
491
+		fmt.Println("SSCard的运算结果为:", ret)
492
+	}
493
+	result := int(ret)
494
+	return result
495
+}
496 496
 
497 497
 //func CardInit() int {
498 498
 //	ret, _, err := add.Call(StrPtr("http://igb.hsa.gdgov.cn/gdyb_inf/poc/api/card/initDll"), StrPtr("440200"))