|
@@ -79,43 +79,43 @@ func HisManagerApiRegistRouters() {
|
79
|
79
|
}
|
80
|
80
|
|
81
|
81
|
func (c *HisApiController) Sscard() {
|
82
|
|
- r := CardInit()
|
83
|
|
- if r == 0 {
|
84
|
|
- GetBaseInfo()
|
85
|
|
- }
|
86
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
87
|
|
- "list": "11",
|
88
|
|
- })
|
|
82
|
+ //r := CardInit()
|
|
83
|
+ //if r == 0 {
|
|
84
|
+ // GetBaseInfo()
|
|
85
|
+ //}
|
|
86
|
+ //c.ServeSuccessJSON(map[string]interface{}{
|
|
87
|
+ // "list": "11",
|
|
88
|
+ //})
|
89
|
89
|
|
90
|
90
|
}
|
91
|
91
|
|
92
|
92
|
func GetBaseInfo() error {
|
93
|
|
- handle := syscall.MustLoadDLL("SSCard.dll")
|
94
|
|
- ReadCardBas := handle.MustFindProc("ReadCardBas")
|
95
|
|
-
|
96
|
|
- str := make([]byte, 256)
|
97
|
|
- str1 := make([]byte, 256)
|
98
|
|
- r, _, ferr := ReadCardBas.Call((uintptr)(unsafe.Pointer(&str[0])), IntPtr(1024), (uintptr)(unsafe.Pointer(&str1[0])), IntPtr(1024))
|
99
|
|
- if ferr != nil {
|
100
|
|
- fmt.Println("ReadCardBas 报错", ferr.Error())
|
101
|
|
- return ferr
|
102
|
|
- }
|
103
|
|
-
|
104
|
|
- fmt.Println(string(str))
|
105
|
|
-
|
106
|
|
- fmt.Println(r)
|
|
93
|
+ //handle := syscall.MustLoadDLL("SSCard.dll")
|
|
94
|
+ //ReadCardBas := handle.MustFindProc("ReadCardBas")
|
|
95
|
+ //
|
|
96
|
+ //str := make([]byte, 256)
|
|
97
|
+ //str1 := make([]byte, 256)
|
|
98
|
+ //r, _, ferr := ReadCardBas.Call((uintptr)(unsafe.Pointer(&str[0])), IntPtr(1024), (uintptr)(unsafe.Pointer(&str1[0])), IntPtr(1024))
|
|
99
|
+ //if ferr != nil {
|
|
100
|
+ // fmt.Println("ReadCardBas 报错", ferr.Error())
|
|
101
|
+ // return ferr
|
|
102
|
+ //}
|
|
103
|
+ //
|
|
104
|
+ //fmt.Println(string(str))
|
|
105
|
+ //
|
|
106
|
+ //fmt.Println(r)
|
107
|
107
|
return nil
|
108
|
108
|
}
|
109
|
109
|
|
110
|
110
|
func CardInit() int {
|
111
|
|
- DllTestDef := syscall.MustLoadDLL("SSCard.dll")
|
112
|
|
- add := DllTestDef.MustFindProc("Init")
|
113
|
|
- ret, _, err := add.Call(StrPtr("http://igb.hsa.gdgov.cn/gdyb_inf/poc/api/card/initDll"), StrPtr("440200"))
|
114
|
|
- if err != nil {
|
115
|
|
- fmt.Println("SSCard的运算结果为:", ret)
|
116
|
|
- }
|
117
|
|
- result := int(ret)
|
118
|
|
- return result
|
|
111
|
+ //DllTestDef := syscall.MustLoadDLL("SSCard.dll")
|
|
112
|
+ //add := DllTestDef.MustFindProc("Init")
|
|
113
|
+ //ret, _, err := add.Call(StrPtr("http://igb.hsa.gdgov.cn/gdyb_inf/poc/api/card/initDll"), StrPtr("440200"))
|
|
114
|
+ //if err != nil {
|
|
115
|
+ // fmt.Println("SSCard的运算结果为:", ret)
|
|
116
|
+ //}
|
|
117
|
+ //result := int(ret)
|
|
118
|
+ return 0
|
119
|
119
|
}
|
120
|
120
|
|
121
|
121
|
func IntPtr(n int) uintptr {
|
|
@@ -376,6 +376,19 @@ func (c *HisApiController) CreateHisPrescription() {
|
376
|
376
|
}
|
377
|
377
|
types := int64(items["type"].(float64))
|
378
|
378
|
|
|
379
|
+ if items["pre_time"] == nil || reflect.TypeOf(items["pre_time"]).String() != "string" {
|
|
380
|
+ utils.ErrorLog("pre_time")
|
|
381
|
+ }
|
|
382
|
+ preTime, _ := items["pre_time"].(string)
|
|
383
|
+ timeLayout := "2006-01-02"
|
|
384
|
+ loc, _ := time.LoadLocation("Local")
|
|
385
|
+ theTime2, err := time.ParseInLocation(timeLayout+" 15:04", preTime, loc)
|
|
386
|
+ if err != nil {
|
|
387
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
388
|
+ return
|
|
389
|
+ }
|
|
390
|
+ pTime := theTime2.Unix()
|
|
391
|
+
|
379
|
392
|
ctime := time.Now().Unix()
|
380
|
393
|
prescription := &models.HisPrescription{
|
381
|
394
|
ID: id,
|
|
@@ -393,12 +406,13 @@ func (c *HisApiController) CreateHisPrescription() {
|
393
|
406
|
OrderStatus: 1,
|
394
|
407
|
BatchNumber: "",
|
395
|
408
|
PrescriptionNumber: hpInfo.PrescriptionNumber,
|
|
409
|
+ PreTime: pTime,
|
396
|
410
|
}
|
397
|
411
|
service.SaveHisPrescription(prescription)
|
398
|
412
|
|
399
|
413
|
//更改患者挂号状态
|
400
|
|
- _, err := service.UpdateHisPatientIsReturn(patient_id, recordDateTime, adminInfo.CurrentOrgId)
|
401
|
|
- fmt.Println("更改失败", err)
|
|
414
|
+ _, err2 := service.UpdateHisPatientIsReturn(patient_id, recordDateTime, adminInfo.CurrentOrgId)
|
|
415
|
+ fmt.Println("更改失败", err2)
|
402
|
416
|
if items["advices"] != nil && reflect.TypeOf(items["advices"]).String() == "[]interface {}" {
|
403
|
417
|
advices := items["advices"].([]interface{})
|
404
|
418
|
//group := service.GetMaxAdviceGroupID(adminInfo.CurrentOrgId)
|
|
@@ -417,7 +431,7 @@ func (c *HisApiController) CreateHisPrescription() {
|
417
|
431
|
s.Status = 1
|
418
|
432
|
s.UserOrgId = adminInfo.CurrentOrgId
|
419
|
433
|
s.RecordDate = recordDateTime
|
420
|
|
- s.StartTime = time.Now().Unix()
|
|
434
|
+ s.StartTime = prescription.PreTime
|
421
|
435
|
s.Groupno = groupNo
|
422
|
436
|
s.CreatedTime = ctime
|
423
|
437
|
s.UpdatedTime = mtime
|
|
@@ -486,7 +500,7 @@ func (c *HisApiController) CreateHisPrescription() {
|
486
|
500
|
s.UpdatedTime = mtime
|
487
|
501
|
s.PatientId = patient_id
|
488
|
502
|
s.HisPatientId = his_patient_id
|
489
|
|
- errcode := c.setAddtionWithJSON(&s, item.(map[string]interface{}))
|
|
503
|
+ errcode := c.setAddtionWithJSON(&s, item.(map[string]interface{}), adminInfo.CurrentOrgId)
|
490
|
504
|
if errcode > 0 {
|
491
|
505
|
c.ServeFailJSONWithSGJErrorCode(errcode)
|
492
|
506
|
return
|
|
@@ -896,6 +910,21 @@ func (c *HisApiController) setAdviceWithJSON(advice *models.HisDoctorAdviceInfo,
|
896
|
910
|
if json["advice_id"] != nil && reflect.TypeOf(json["advice_id"]).String() == "float64" {
|
897
|
911
|
advice_id := int64(json["advice_id"].(float64))
|
898
|
912
|
advice.ID = advice_id
|
|
913
|
+ if advice.ID > 0 {
|
|
914
|
+ hisAdvice, err := service.GetHisDoctorAdvicesById(advice.ID)
|
|
915
|
+ if err == nil {
|
|
916
|
+ if hisAdvice.ID > 0 {
|
|
917
|
+ advice.ExecutionTime = hisAdvice.ExecutionTime
|
|
918
|
+ advice.ExecutionStaff = hisAdvice.ExecutionStaff
|
|
919
|
+ advice.ExecutionState = hisAdvice.ExecutionState
|
|
920
|
+ advice.CheckTime = hisAdvice.CheckTime
|
|
921
|
+ advice.Checker = hisAdvice.Checker
|
|
922
|
+ advice.CheckState = hisAdvice.CheckState
|
|
923
|
+ advice.StartTime = hisAdvice.StartTime
|
|
924
|
+
|
|
925
|
+ }
|
|
926
|
+ }
|
|
927
|
+ }
|
899
|
928
|
}
|
900
|
929
|
|
901
|
930
|
if json["min_unit"] != nil && reflect.TypeOf(json["min_unit"]).String() == "string" {
|
|
@@ -1004,7 +1033,7 @@ func (c *HisApiController) setProjectWithJSON(project *models.HisPrescriptionPro
|
1004
|
1033
|
return 0
|
1005
|
1034
|
}
|
1006
|
1035
|
|
1007
|
|
-func (c *HisApiController) setAddtionWithJSON(additionalCharge *models.HisAdditionalCharge, json map[string]interface{}) int {
|
|
1036
|
+func (c *HisApiController) setAddtionWithJSON(additionalCharge *models.HisAdditionalCharge, json map[string]interface{}, org_id int64) int {
|
1008
|
1037
|
if json["id"] != nil || reflect.TypeOf(json["id"]).String() == "float64" {
|
1009
|
1038
|
id := int64(json["id"].(float64))
|
1010
|
1039
|
additionalCharge.ID = id
|
|
@@ -1012,7 +1041,14 @@ func (c *HisApiController) setAddtionWithJSON(additionalCharge *models.HisAdditi
|
1012
|
1041
|
if json["item_id"] != nil || reflect.TypeOf(json["item_id"]).String() == "float64" {
|
1013
|
1042
|
item_id := int64(json["item_id"].(float64))
|
1014
|
1043
|
additionalCharge.ItemId = item_id
|
|
1044
|
+ config, _ := service.GetAdditionChargeByID(org_id, item_id)
|
|
1045
|
+ if config.ID > 0 {
|
|
1046
|
+ if len(config.Code) > 0 {
|
|
1047
|
+ additionalCharge.MedListCodg = config.Code
|
|
1048
|
+ }
|
|
1049
|
+ }
|
1015
|
1050
|
}
|
|
1051
|
+
|
1016
|
1052
|
//if json["price"] != nil || reflect.TypeOf(json["price"]).String() == "float64" {
|
1017
|
1053
|
// price := int64(json["price"].(float64))
|
1018
|
1054
|
// formatInt_price := strconv.FormatInt(price, 10)
|