|
@@ -32,6 +32,7 @@ type HisApiController struct {
|
32
|
32
|
func HisManagerApiRegistRouters() {
|
33
|
33
|
|
34
|
34
|
beego.Router("/api/register/get", &HisApiController{}, "get:GetRegisterInfo")
|
|
35
|
+ beego.Router("/api/diag/upload", &HisApiController{}, "get:GetUploadDiag")
|
35
|
36
|
beego.Router("/api/upload/get", &HisApiController{}, "get:GetUploadInfo")
|
36
|
37
|
beego.Router("/api/settle/query", &HisApiController{}, "get:GetSettleAccounts")
|
37
|
38
|
beego.Router("/api/checkaccount/get", &HisApiController{}, "get:GetCheckAccount")
|
|
@@ -52,17 +53,88 @@ func HisManagerApiRegistRouters() {
|
52
|
53
|
}
|
53
|
54
|
|
54
|
55
|
func (c *HisApiController) Sscard() {
|
|
56
|
+ id_card_type, _ := c.GetInt64("id_card_type")
|
|
57
|
+ adminUser := c.GetAdminUserInfo()
|
55
|
58
|
r := CardInit()
|
56
|
59
|
if r == 0 {
|
57
|
|
- GetBaseInfo()
|
|
60
|
+ switch id_card_type {
|
|
61
|
+ case 1:
|
|
62
|
+ basStr, err := GetBasBaseInfo()
|
|
63
|
+
|
|
64
|
+ if err != nil {
|
|
65
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
|
|
66
|
+ return
|
|
67
|
+
|
|
68
|
+ } else {
|
|
69
|
+ bas := strings.Split(basStr, "|")
|
|
70
|
+ basNumber := bas[1]
|
|
71
|
+ patient, err := service.GetPatientByNumber(basNumber, adminUser.CurrentOrgId)
|
|
72
|
+ if err == gorm.ErrRecordNotFound {
|
|
73
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
|
|
74
|
+ return
|
|
75
|
+
|
|
76
|
+ } else if err != nil {
|
|
77
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
78
|
+ return
|
|
79
|
+
|
|
80
|
+ } else {
|
|
81
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
82
|
+ "patient": patient,
|
|
83
|
+ "number": basNumber,
|
|
84
|
+ })
|
|
85
|
+ }
|
|
86
|
+
|
|
87
|
+ }
|
|
88
|
+
|
|
89
|
+ break
|
|
90
|
+ case 2:
|
|
91
|
+ SFZStr, err := GetSFZBaseInfo()
|
|
92
|
+ if err != nil {
|
|
93
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
|
|
94
|
+ return
|
|
95
|
+
|
|
96
|
+ } else {
|
|
97
|
+
|
|
98
|
+ id_card_str := strings.Split(SFZStr, "^")
|
|
99
|
+ id_card_number := id_card_str[0]
|
|
100
|
+ patient, err := service.GetPatientByIDCard(id_card_number, adminUser.CurrentOrgId)
|
|
101
|
+ if err == gorm.ErrRecordNotFound {
|
|
102
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
|
|
103
|
+ return
|
|
104
|
+
|
|
105
|
+ } else if err != nil {
|
|
106
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
107
|
+ return
|
|
108
|
+
|
|
109
|
+ } else {
|
|
110
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
111
|
+ "patient": patient,
|
|
112
|
+ })
|
|
113
|
+ }
|
|
114
|
+
|
|
115
|
+ }
|
|
116
|
+ break
|
|
117
|
+ case 3:
|
|
118
|
+ //QRStr, err :=GetQRBaseInfo()
|
|
119
|
+ //if err != nil{
|
|
120
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
|
|
121
|
+ // return
|
|
122
|
+ //
|
|
123
|
+ //}else{
|
|
124
|
+ //
|
|
125
|
+ //
|
|
126
|
+ //
|
|
127
|
+ //}
|
|
128
|
+ break
|
|
129
|
+
|
|
130
|
+ }
|
58
|
131
|
}
|
59
|
132
|
c.ServeSuccessJSON(map[string]interface{}{
|
60
|
133
|
"list": "11",
|
61
|
134
|
})
|
62
|
135
|
|
63
|
136
|
}
|
64
|
|
-
|
65
|
|
-func GetBaseInfo() error {
|
|
137
|
+func GetBasBaseInfo() (jsonStr string, err error) {
|
66
|
138
|
handle := syscall.MustLoadDLL("SSCard.dll")
|
67
|
139
|
ReadCardBas := handle.MustFindProc("ReadCardBas")
|
68
|
140
|
|
|
@@ -72,7 +144,33 @@ func GetBaseInfo() error {
|
72
|
144
|
|
73
|
145
|
fmt.Println(string(str))
|
74
|
146
|
fmt.Println(r)
|
75
|
|
- return nil
|
|
147
|
+ return string(str), nil
|
|
148
|
+}
|
|
149
|
+
|
|
150
|
+func GetSFZBaseInfo() (jsonStr string, err error) {
|
|
151
|
+ handle := syscall.MustLoadDLL("SSCard.dll")
|
|
152
|
+ ReadCardBas := handle.MustFindProc("ReadSFZ")
|
|
153
|
+
|
|
154
|
+ str := make([]byte, 256)
|
|
155
|
+ str1 := make([]byte, 256)
|
|
156
|
+ r, _, _ := ReadCardBas.Call((uintptr)(unsafe.Pointer(&str[0])), IntPtr(1024), (uintptr)(unsafe.Pointer(&str1[0])), IntPtr(1024))
|
|
157
|
+
|
|
158
|
+ fmt.Println(string(str))
|
|
159
|
+ fmt.Println(r)
|
|
160
|
+ return string(str), nil
|
|
161
|
+}
|
|
162
|
+
|
|
163
|
+func GetQRBaseInfo() (jsonStr string, err error) {
|
|
164
|
+ handle := syscall.MustLoadDLL("SSCard.dll")
|
|
165
|
+ ReadCardBas := handle.MustFindProc("GetQRBase")
|
|
166
|
+
|
|
167
|
+ str := make([]byte, 256)
|
|
168
|
+ str1 := make([]byte, 256)
|
|
169
|
+ r, _, _ := ReadCardBas.Call((uintptr)(unsafe.Pointer(&str[0])), IntPtr(1024), (uintptr)(unsafe.Pointer(&str1[0])), IntPtr(1024))
|
|
170
|
+
|
|
171
|
+ fmt.Println(string(str))
|
|
172
|
+ fmt.Println(r)
|
|
173
|
+ return string(str), nil
|
76
|
174
|
}
|
77
|
175
|
|
78
|
176
|
func CardInit() int {
|
|
@@ -366,20 +464,23 @@ type Custom struct {
|
366
|
464
|
func (c *HisApiController) GetRegisterInfo() {
|
367
|
465
|
id, _ := c.GetInt64("id")
|
368
|
466
|
record_time := c.GetString("record_time")
|
|
467
|
+ settlementValue, _ := c.GetInt64("settlement_value")
|
|
468
|
+ medical_insurance_card := c.GetString("medical_insurance_card")
|
369
|
469
|
name := c.GetString("name")
|
370
|
|
- gender, _ := c.GetInt64("gender")
|
371
|
|
- age, _ := c.GetInt64("age")
|
|
470
|
+ id_card_type, _ := c.GetInt64("id_card_type")
|
|
471
|
+ certificates, _ := c.GetInt64("certificates")
|
|
472
|
+ medical_care, _ := c.GetInt64("medical_care")
|
372
|
473
|
birthday := c.GetString("birthday")
|
|
474
|
+ age, _ := c.GetInt64("age")
|
|
475
|
+ id_card := c.GetString("idCard")
|
|
476
|
+ register_type, _ := c.GetInt64("register")
|
|
477
|
+ doctor, _ := c.GetInt64("doctor")
|
|
478
|
+ department, _ := c.GetInt64("department")
|
|
479
|
+ gender, _ := c.GetInt64("sex")
|
373
|
480
|
phone := c.GetString("phone")
|
374
|
|
- medical_care, _ := c.GetInt64("medical_care")
|
375
|
|
- id_card := c.GetString("id_card")
|
376
|
|
- register_type, _ := c.GetInt64("register_type")
|
377
|
481
|
registration_fee, _ := c.GetFloat("registration_fee")
|
378
|
482
|
medical_expenses, _ := c.GetFloat("medical_expenses")
|
379
|
|
- certificates, _ := c.GetInt64("certificates")
|
380
|
|
- settlementValue, _ := c.GetInt64("settlement_value")
|
381
|
483
|
social_type, _ := c.GetInt64("social_type")
|
382
|
|
- medical_insurance_card := c.GetString("medical_insurance_card")
|
383
|
484
|
admin_user_id, _ := c.GetInt64("admin_user_id")
|
384
|
485
|
|
385
|
486
|
timeLayout := "2006-01-02"
|
|
@@ -411,6 +512,7 @@ func (c *HisApiController) GetRegisterInfo() {
|
411
|
512
|
return
|
412
|
513
|
}
|
413
|
514
|
config, _ := service.GetMedicalInsuranceConfig(adminInfo.CurrentOrgId)
|
|
515
|
+
|
414
|
516
|
if config.IsOpen == 1 {
|
415
|
517
|
api := "http://127.0.0.1:9532/" + "gdyb/one?cert_no=" + patient.IdCardNo + "&org_name=" + miConfig.OrgName + "&doctor=" + patientPrescription.Doctor + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
|
416
|
518
|
resp, requestErr := http.Get(api)
|
|
@@ -478,6 +580,9 @@ func (c *HisApiController) GetRegisterInfo() {
|
478
|
580
|
UserOrgId: adminInfo.CurrentOrgId,
|
479
|
581
|
AdminUserId: admin_user_id,
|
480
|
582
|
IsReturn: 1,
|
|
583
|
+ IdCardType: id_card_type,
|
|
584
|
+ Doctor: doctor,
|
|
585
|
+ Departments: department,
|
481
|
586
|
}
|
482
|
587
|
|
483
|
588
|
timestamp := time.Now().Unix()
|
|
@@ -488,14 +593,21 @@ func (c *HisApiController) GetRegisterInfo() {
|
488
|
593
|
count, _ := service.FindHisRegisterRecord(theTime.Unix(), patient.ID, adminInfo.CurrentOrgId)
|
489
|
594
|
department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
|
490
|
595
|
doctor_id := strconv.FormatInt(patientPrescription.DoctorId, 10)
|
491
|
|
-
|
492
|
|
- fmt.Println(miConfig.SecretKey)
|
|
596
|
+ diagnosisConfig, _ := service.FindDiagnoseById(patientPrescription.Diagnosis)
|
|
597
|
+ sickConfig, _ := service.FindSickById(patientPrescription.SickType)
|
|
598
|
+
|
|
599
|
+ IdCardNo := ""
|
|
600
|
+ if id_card_type == 1 {
|
|
601
|
+ IdCardNo = medical_insurance_card
|
|
602
|
+ } else if id_card_type == 2 {
|
|
603
|
+ IdCardNo = patient.IdCardNo
|
|
604
|
+ }
|
493
|
605
|
|
494
|
606
|
if count <= 0 {
|
495
|
|
- api := "http://127.0.0.1:9532/" + "gdyb/two?cert_no=" + patient.IdCardNo + "&insutype=" +
|
|
607
|
+ api := "http://127.0.0.1:9532/" + "gdyb/two?cert_no=" + IdCardNo + "&insutype=" +
|
496
|
608
|
res.Output.Iinfo[0].Insutype + "&psn_no=" + res.Output.Baseinfo.PsnNo +
|
497
|
609
|
"&org_name=" + miConfig.OrgName + "&doctor=" + patientPrescription.Doctor + "&ipt_otp_no=" + ipt_otp_no +
|
498
|
|
- "&dept=" + department.Name + "&fixmedins_code=" + miConfig.Code + "&dept_code=" + department.Number + "&doctor_id=" + doctor_id + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
|
|
610
|
+ "&dept=" + department.Name + "&fixmedins_code=" + miConfig.Code + "&dept_code=" + department.Number + "&doctor_id=" + doctor_id + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(int64(id_card_type), 10)
|
499
|
611
|
resp, requestErr := http.Get(api)
|
500
|
612
|
if requestErr != nil {
|
501
|
613
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
@@ -536,7 +648,6 @@ func (c *HisApiController) GetRegisterInfo() {
|
536
|
648
|
Stage: 2,
|
537
|
649
|
}
|
538
|
650
|
service.CreateErrMsgLog(errlog)
|
539
|
|
-
|
540
|
651
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterTwoException)
|
541
|
652
|
return
|
542
|
653
|
}
|
|
@@ -549,68 +660,65 @@ func (c *HisApiController) GetRegisterInfo() {
|
549
|
660
|
his.UserOrgId = adminInfo.CurrentOrgId
|
550
|
661
|
his.Ctime = time.Now().Unix()
|
551
|
662
|
his.Mtime = time.Now().Unix()
|
552
|
|
- diagnosisConfig, _ := service.FindDiagnoseById(patientPrescription.Diagnosis)
|
553
|
|
-
|
554
|
|
- sickConfig, _ := service.FindSickById(patientPrescription.SickType)
|
555
|
|
-
|
556
|
|
- fmt.Println("1112222222")
|
557
|
|
- fmt.Println(sickConfig.ClassName)
|
558
|
|
- fmt.Println(sickConfig.CountryCode)
|
559
|
|
- fmt.Println("223333333")
|
560
|
|
-
|
561
|
|
- api2 := "http://127.0.0.1:9532/" + "gdyb/four?psn_no=" + his.PsnNo +
|
562
|
|
- "&mdtrt_id=" + his.Number + "&doctor=" + patientPrescription.Doctor + "&department=" + department.Name +
|
563
|
|
- "&diag=" + diagnosisConfig.ClassName + "&org_name=" + miConfig.OrgName + "&med_type=" + strconv.FormatInt(patientPrescription.RegisterType, 10) + "&doctor_id=" + strconv.FormatInt(patientPrescription.DoctorId, 10) + "&fixmedins_code=" + miConfig.Code + "&diag_code=" + diagnosisConfig.CountryCode +
|
564
|
|
- "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&sick_code=" + sickConfig.CountryCode + "&sick_name=" + sickConfig.ClassName
|
565
|
|
- resp2, requestErr2 := http.Get(api2)
|
566
|
|
- if requestErr2 != nil {
|
567
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
568
|
|
- return
|
569
|
|
- }
|
570
|
|
- body2, ioErr2 := ioutil.ReadAll(resp2.Body)
|
571
|
|
- if ioErr2 != nil {
|
572
|
|
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr2)
|
573
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
574
|
|
- return
|
575
|
|
- }
|
576
|
|
- var respJSON2 map[string]interface{}
|
577
|
|
- if err := json.Unmarshal([]byte(string(body2)), &respJSON2); err != nil {
|
578
|
|
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
579
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
580
|
|
- return
|
581
|
|
- }
|
582
|
|
- respJSON2 = respJSON2["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
583
|
|
- userJSONBytes2, _ := json.Marshal(respJSON2)
|
|
663
|
+ his.Status = 1
|
|
664
|
+ err := service.CreateHisPatientTwo(&his)
|
|
665
|
+ if err == nil {
|
|
666
|
+ api2 := "http://127.0.0.1:9532/" + "gdyb/four?psn_no=" + his.PsnNo +
|
|
667
|
+ "&mdtrt_id=" + his.Number + "&doctor=" + patientPrescription.Doctor + "&department=" + department.Name +
|
|
668
|
+ "&diag=" + diagnosisConfig.ClassName + "&org_name=" + miConfig.OrgName + "&med_type=" + strconv.FormatInt(patientPrescription.RegisterType, 10) + "&doctor_id=" + strconv.FormatInt(patientPrescription.DoctorId, 10) + "&fixmedins_code=" + miConfig.Code + "&diag_code=" + diagnosisConfig.CountryCode +
|
|
669
|
+ "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&sick_code=" + sickConfig.CountryCode + "&sick_name=" + sickConfig.ClassName
|
|
670
|
+ resp2, requestErr2 := http.Get(api2)
|
|
671
|
+ if requestErr2 != nil {
|
|
672
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
673
|
+ return
|
|
674
|
+ }
|
|
675
|
+ body2, ioErr2 := ioutil.ReadAll(resp2.Body)
|
|
676
|
+ if ioErr2 != nil {
|
|
677
|
+ utils.ErrorLog("接口返回数据读取失败: %v", ioErr2)
|
|
678
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
679
|
+ return
|
|
680
|
+ }
|
|
681
|
+ var respJSON2 map[string]interface{}
|
|
682
|
+ if err := json.Unmarshal([]byte(string(body2)), &respJSON2); err != nil {
|
|
683
|
+ utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
|
684
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
685
|
+ return
|
|
686
|
+ }
|
|
687
|
+ respJSON2 = respJSON2["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
|
688
|
+ userJSONBytes2, _ := json.Marshal(respJSON2)
|
584
|
689
|
|
585
|
|
- var res2 ResultSix
|
586
|
|
- if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
|
587
|
|
- utils.ErrorLog("解析失败:%v", err)
|
588
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
589
|
|
- return
|
590
|
|
- }
|
591
|
|
- if res2.Infcode == -1 {
|
592
|
|
- adminUser := c.GetAdminUserInfo()
|
593
|
|
- errlog := &models.HisOrderError{
|
594
|
|
- UserOrgId: adminUser.CurrentOrgId,
|
595
|
|
- Ctime: time.Now().Unix(),
|
596
|
|
- Mtime: time.Now().Unix(),
|
597
|
|
- ErrMsg: res2.ErrMsg,
|
598
|
|
- Status: 1,
|
599
|
|
- PatientId: id,
|
600
|
|
- RecordTime: recordDateTime,
|
601
|
|
- Stage: 3,
|
|
690
|
+ var res2 ResultSix
|
|
691
|
+ if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
|
|
692
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
693
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
694
|
+ return
|
602
|
695
|
}
|
603
|
|
- service.CreateErrMsgLog(errlog)
|
|
696
|
+ if res2.Infcode == -1 {
|
|
697
|
+ adminUser := c.GetAdminUserInfo()
|
|
698
|
+ errlog := &models.HisOrderError{
|
|
699
|
+ UserOrgId: adminUser.CurrentOrgId,
|
|
700
|
+ Ctime: time.Now().Unix(),
|
|
701
|
+ Mtime: time.Now().Unix(),
|
|
702
|
+ ErrMsg: res2.ErrMsg,
|
|
703
|
+ Status: 1,
|
|
704
|
+ PatientId: id,
|
|
705
|
+ RecordTime: recordDateTime,
|
|
706
|
+ Stage: 3,
|
|
707
|
+ }
|
|
708
|
+ service.CreateErrMsgLog(errlog)
|
|
709
|
+
|
|
710
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterThreeException)
|
|
711
|
+ return
|
|
712
|
+ }
|
|
713
|
+
|
|
714
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
715
|
+ "his_info": his,
|
|
716
|
+ })
|
604
|
717
|
|
605
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterThreeException)
|
|
718
|
+ } else {
|
|
719
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
606
|
720
|
return
|
607
|
721
|
}
|
608
|
|
- his.Status = 1
|
609
|
|
- service.CreateHisPatientTwo(&his)
|
610
|
|
-
|
611
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
612
|
|
- "his_info": his,
|
613
|
|
- })
|
614
|
722
|
|
615
|
723
|
} else {
|
616
|
724
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterRepeatException)
|
|
@@ -728,76 +836,6 @@ func (c *HisApiController) GetUploadInfo() {
|
728
|
836
|
prescriptions, _ = service.GetMonthHisPrescription(adminUser.CurrentOrgId, id, recordStartTime, recordEndTime)
|
729
|
837
|
data["pre"] = prescriptions
|
730
|
838
|
|
731
|
|
- //var advices []*models.HisDoctorAdviceInfo
|
732
|
|
- //var projects []*models.HisPrescriptionProject
|
733
|
|
- //var additions []*models.HisAdditionalCharge
|
734
|
|
- //var customs []*models.Custom
|
735
|
|
- //for _, item := range monthPrescriptions {
|
736
|
|
- // advices = append(advices, item.HisDoctorAdviceInfo...)
|
737
|
|
- // projects = append(projects, item.HisPrescriptionProject...)
|
738
|
|
- // additions = append(additions, item.HisAdditionalCharge...)
|
739
|
|
- //}
|
740
|
|
- //
|
741
|
|
- //var adviceCodes []string
|
742
|
|
- //var projectCodes []string
|
743
|
|
- //var additionCodes []string
|
744
|
|
- //
|
745
|
|
- //
|
746
|
|
- //
|
747
|
|
- //
|
748
|
|
- //for _, item := range advices {
|
749
|
|
- // adviceCodes = append(adviceCodes, item.MedListCodg)
|
750
|
|
- //}
|
751
|
|
- //for _, item := range projects {
|
752
|
|
- // projectCodes = append(projectCodes, item.MedListCodg)
|
753
|
|
- //}
|
754
|
|
- //for _, item := range additions {
|
755
|
|
- // additionCodes = append(additionCodes, item.XtHisAddtionConfig.Code)
|
756
|
|
- //}
|
757
|
|
- //adviceCodes = RemoveRepeatedCode(adviceCodes)
|
758
|
|
- //projectCodes = RemoveRepeatedCode(projectCodes)
|
759
|
|
- //additionCodes = RemoveRepeatedCode(additionCodes)
|
760
|
|
- //
|
761
|
|
- //for _, item := range adviceCodes{
|
762
|
|
- // var custom models.Custom
|
763
|
|
- // for _,subItem := range advices{
|
764
|
|
- // if item == subItem.MedListCodg{
|
765
|
|
- // custom.Price =fmt.Sprintf("%.2f", subItem.Price)
|
766
|
|
- // custom.MedListCodg = subItem.MedListCodg
|
767
|
|
- // custom.Cut = fmt.Sprintf("%.2f", subItem.PrescribingNumber)
|
768
|
|
- // custom.DetItemFeeSumamt = fmt.Sprintf("%.2f", subItem.Price*subItem.PrescribingNumber)
|
769
|
|
- // custom.FeedetlSn = subItem.FeedetlSn
|
770
|
|
- // customs = append(customs,&custom)
|
771
|
|
- // }
|
772
|
|
- // }
|
773
|
|
- //}
|
774
|
|
- //for _, item := range additionCodes{
|
775
|
|
- // var custom models.Custom
|
776
|
|
- // for _,subItem := range additions{
|
777
|
|
- // if item == subItem.XtHisAddtionConfig.Code{
|
778
|
|
- // custom.Price =fmt.Sprintf("%.2f", subItem.Price)
|
779
|
|
- // custom.MedListCodg = subItem.XtHisAddtionConfig.Code
|
780
|
|
- // custom.Cut = fmt.Sprintf("%.2f", subItem.Count)
|
781
|
|
- // custom.DetItemFeeSumamt = fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count))
|
782
|
|
- // custom.FeedetlSn = subItem.FeedetlSn
|
783
|
|
- // customs = append(customs,&custom)
|
784
|
|
- // }
|
785
|
|
- // }
|
786
|
|
- //}
|
787
|
|
- //for _, item := range projectCodes{
|
788
|
|
- // var custom models.Custom
|
789
|
|
- // for _,subItem := range projects{
|
790
|
|
- // if item == subItem.MedListCodg{
|
791
|
|
- // custom.Price =fmt.Sprintf("%.2f", subItem.Price)
|
792
|
|
- // custom.MedListCodg = subItem.MedListCodg
|
793
|
|
- // custom.Cut = fmt.Sprintf("%.2f", subItem.Count)
|
794
|
|
- // custom.DetItemFeeSumamt = fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count))
|
795
|
|
- // custom.FeedetlSn = subItem.FeedetlSn
|
796
|
|
- // customs = append(customs,&custom)
|
797
|
|
- // }
|
798
|
|
- // }
|
799
|
|
- //}
|
800
|
|
-
|
801
|
839
|
}
|
802
|
840
|
his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, id, recordDateTime)
|
803
|
841
|
timestamp := time.Now().Unix()
|
|
@@ -974,11 +1012,21 @@ func (c *HisApiController) GetUploadInfo() {
|
974
|
1012
|
chrg_bchno := chrg_bchno
|
975
|
1013
|
cert_no := his.Certno
|
976
|
1014
|
insutype := rf[0].Insutype
|
|
1015
|
+
|
|
1016
|
+ if his.IdCardType == 1 {
|
|
1017
|
+ cert_no = his.MedicalInsuranceNumber
|
|
1018
|
+
|
|
1019
|
+ } else if his.IdCardType == 2 {
|
|
1020
|
+
|
|
1021
|
+ cert_no = his.Certno
|
|
1022
|
+
|
|
1023
|
+ }
|
|
1024
|
+
|
977
|
1025
|
api := "http://127.0.0.1:9532/" + "gdyb/eight?cert_no=" + cert_no + "&insutype=" +
|
978
|
1026
|
insutype + "&psn_no=" + psn_no + "&chrg_bchno=" + chrg_bchno + "&mdtrt_id=" + mdtrt_id +
|
979
|
|
- "&total=" + allTotal + "&org_name=" + miConfig.OrgName + "&doctor=" + patientPrescription.Doctor + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&med_type=" + strconv.FormatInt(patientPrescription.RegisterType, 10)
|
|
1027
|
+ "&total=" + allTotal + "&org_name=" + miConfig.OrgName + "&doctor=" + patientPrescription.Doctor + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" +
|
|
1028
|
+ miConfig.SecretKey + "&med_type=" + strconv.FormatInt(patientPrescription.RegisterType, 10) + "&id_card_type=" + strconv.FormatInt(int64(his.IdCardType), 10)
|
980
|
1029
|
resp, requestErr := http.Get(api)
|
981
|
|
-
|
982
|
1030
|
if requestErr != nil {
|
983
|
1031
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
984
|
1032
|
return
|
|
@@ -2196,6 +2244,76 @@ func (c *HisApiController) PutRecord() {
|
2196
|
2244
|
|
2197
|
2245
|
}
|
2198
|
2246
|
|
|
2247
|
+func (c *HisApiController) GetUploadDiag() {
|
|
2248
|
+ id, _ := c.GetInt64("id")
|
|
2249
|
+ record_time := c.GetString("record_time")
|
|
2250
|
+ timeLayout := "2006-01-02"
|
|
2251
|
+ loc, _ := time.LoadLocation("Local")
|
|
2252
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
|
|
2253
|
+ if err != nil {
|
|
2254
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
2255
|
+ return
|
|
2256
|
+ }
|
|
2257
|
+ recordDateTime := theTime.Unix()
|
|
2258
|
+ adminInfo := c.GetAdminUserInfo()
|
|
2259
|
+ patientPrescription, _ := service.FindPatientPrescriptionInfo(adminInfo.CurrentOrgId, id, recordDateTime)
|
|
2260
|
+
|
|
2261
|
+ miConfig, _ := service.FindMedicalInsuranceInfo(adminInfo.CurrentOrgId)
|
|
2262
|
+ diagnosisConfig, _ := service.FindDiagnoseById(patientPrescription.Diagnosis)
|
|
2263
|
+ his, _ := service.GetVMHisPatientInfo(adminInfo.CurrentOrgId, id, recordDateTime)
|
|
2264
|
+ sickConfig, _ := service.FindSickById(patientPrescription.SickType)
|
|
2265
|
+ department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
|
|
2266
|
+
|
|
2267
|
+ api2 := "http://127.0.0.1:9532/" + "gdyb/four?psn_no=" + his.PsnNo +
|
|
2268
|
+ "&mdtrt_id=" + his.Number + "&doctor=" + patientPrescription.Doctor + "&department=" + department.Name +
|
|
2269
|
+ "&diag=" + diagnosisConfig.ClassName + "&org_name=" + miConfig.OrgName + "&med_type=" + strconv.FormatInt(patientPrescription.RegisterType, 10) + "&doctor_id=" + strconv.FormatInt(patientPrescription.DoctorId, 10) + "&fixmedins_code=" + miConfig.Code + "&diag_code=" + diagnosisConfig.CountryCode +
|
|
2270
|
+ "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&sick_code=" + sickConfig.CountryCode + "&sick_name=" + sickConfig.ClassName
|
|
2271
|
+ resp2, requestErr2 := http.Get(api2)
|
|
2272
|
+ if requestErr2 != nil {
|
|
2273
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
2274
|
+ return
|
|
2275
|
+ }
|
|
2276
|
+ body2, ioErr2 := ioutil.ReadAll(resp2.Body)
|
|
2277
|
+ if ioErr2 != nil {
|
|
2278
|
+ utils.ErrorLog("接口返回数据读取失败: %v", ioErr2)
|
|
2279
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
2280
|
+ return
|
|
2281
|
+ }
|
|
2282
|
+ var respJSON2 map[string]interface{}
|
|
2283
|
+ if err := json.Unmarshal([]byte(string(body2)), &respJSON2); err != nil {
|
|
2284
|
+ utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
|
2285
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
2286
|
+ return
|
|
2287
|
+ }
|
|
2288
|
+ respJSON2 = respJSON2["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
|
2289
|
+ userJSONBytes2, _ := json.Marshal(respJSON2)
|
|
2290
|
+
|
|
2291
|
+ var res2 ResultSix
|
|
2292
|
+ if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
|
|
2293
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
2294
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
2295
|
+ return
|
|
2296
|
+ }
|
|
2297
|
+ if res2.Infcode == -1 {
|
|
2298
|
+ adminUser := c.GetAdminUserInfo()
|
|
2299
|
+ errlog := &models.HisOrderError{
|
|
2300
|
+ UserOrgId: adminUser.CurrentOrgId,
|
|
2301
|
+ Ctime: time.Now().Unix(),
|
|
2302
|
+ Mtime: time.Now().Unix(),
|
|
2303
|
+ ErrMsg: res2.ErrMsg,
|
|
2304
|
+ Status: 1,
|
|
2305
|
+ PatientId: id,
|
|
2306
|
+ RecordTime: recordDateTime,
|
|
2307
|
+ Stage: 3,
|
|
2308
|
+ }
|
|
2309
|
+ service.CreateErrMsgLog(errlog)
|
|
2310
|
+
|
|
2311
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterThreeException)
|
|
2312
|
+ return
|
|
2313
|
+ }
|
|
2314
|
+
|
|
2315
|
+}
|
|
2316
|
+
|
2199
|
2317
|
func PathExists(path string) (bool, error) {
|
2200
|
2318
|
_, err := os.Stat(path)
|
2201
|
2319
|
if err == nil {
|