|
@@ -277,6 +277,11 @@ func SZHisManagerApiRegistRouters() {
|
277
|
277
|
|
278
|
278
|
|
279
|
279
|
beego.Router("/sz/api/refund/get", &SZHisApiController{}, "get:Refund")
|
|
280
|
+
|
|
281
|
+ beego.Router("/sz/api/readcard", &SZHisApiController{}, "get:ReadCard")
|
|
282
|
+
|
|
283
|
+ beego.Router("sz/api/refundnumber/get", &SZHisApiController{}, "get:RefundNumber")
|
|
284
|
+
|
280
|
285
|
beego.Router("/sz/api/monthrefund/get", &SZHisApiController{}, "get:MonthRefund")
|
281
|
286
|
|
282
|
287
|
beego.Router("/sz/api/settle/query", &SZHisApiController{}, "get:GetSettleAccounts")
|
|
@@ -323,6 +328,40 @@ type Custom struct {
|
323
|
328
|
ItemId int64
|
324
|
329
|
}
|
325
|
330
|
|
|
331
|
+func (c *SZHisApiController) ReadCard() {
|
|
332
|
+ id_card_type, _ := c.GetInt64("id_card_type")
|
|
333
|
+ adminInfo := c.GetAdminUserInfo()
|
|
334
|
+ if id_card_type != 1 {
|
|
335
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorNoReadCardException)
|
|
336
|
+ return
|
|
337
|
+ }
|
|
338
|
+ month := time.Unix(1557042972, 0).Format("1")
|
|
339
|
+ year := time.Now().Format("2006")
|
|
340
|
+ month = time.Now().Format("01")
|
|
341
|
+ day := time.Now().Format("02")
|
|
342
|
+
|
|
343
|
+ miConfig, _ := service.FindMedicalInsuranceInfo(adminInfo.CurrentOrgId)
|
|
344
|
+ number := miConfig.Code + year + month + day +
|
|
345
|
+ fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000))
|
|
346
|
+ id_card_number, health_card_no, _, ret4 := ReadBasCard("MZ002" + "|" + number + "|" + miConfig.Code + "|")
|
|
347
|
+ if ret4 == 0 {
|
|
348
|
+ patient, _ := service.GetPatientByNumber(id_card_number, adminInfo.CurrentOrgId)
|
|
349
|
+ if patient.ID == 0 {
|
|
350
|
+ patient.HealthCareNo = health_card_no
|
|
351
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
|
|
352
|
+ return
|
|
353
|
+ } else {
|
|
354
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
355
|
+ "patient": patient,
|
|
356
|
+ })
|
|
357
|
+ }
|
|
358
|
+ } else {
|
|
359
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
|
|
360
|
+ return
|
|
361
|
+ }
|
|
362
|
+
|
|
363
|
+}
|
|
364
|
+
|
326
|
365
|
|
327
|
366
|
|
328
|
367
|
|
|
@@ -717,6 +756,480 @@ type Custom struct {
|
717
|
756
|
|
718
|
757
|
|
719
|
758
|
|
|
759
|
+func (c *SZHisApiController) GetRegisterInfo() {
|
|
760
|
+ adminInfo := c.GetAdminUserInfo()
|
|
761
|
+ admin_user_id, _ := c.GetInt64("admin_user_id")
|
|
762
|
+ patient_id, _ := c.GetInt64("id")
|
|
763
|
+ record_time := c.GetString("record_time")
|
|
764
|
+ settlementValue, _ := c.GetInt64("settlement_value")
|
|
765
|
+ medical_insurance_card := c.GetString("medical_insurance_card")
|
|
766
|
+ name := c.GetString("name")
|
|
767
|
+ id_card_type, _ := c.GetInt64("id_card_type")
|
|
768
|
+ certificates, _ := c.GetInt64("certificates")
|
|
769
|
+ medical_care, _ := c.GetInt64("medical_care")
|
|
770
|
+ birthday := c.GetString("birthday")
|
|
771
|
+ id_card := c.GetString("id_card")
|
|
772
|
+ register_type, _ := c.GetInt64("register")
|
|
773
|
+ doctor, _ := c.GetInt64("doctor")
|
|
774
|
+ department, _ := c.GetInt64("department")
|
|
775
|
+ gender, _ := c.GetInt64("sex")
|
|
776
|
+ registration_fee, _ := c.GetFloat("registration_fee")
|
|
777
|
+ medical_expenses, _ := c.GetFloat("medical_expenses")
|
|
778
|
+ social_type, _ := c.GetInt64("social_type")
|
|
779
|
+
|
|
780
|
+ is_yidi, _ := c.GetInt64("is_yidi")
|
|
781
|
+
|
|
782
|
+ timeLayout := "2006-01-02"
|
|
783
|
+ loc, _ := time.LoadLocation("Local")
|
|
784
|
+ birthdays, _ := time.ParseInLocation(timeLayout+" 15:04:05", birthday+" 00:00:00", loc)
|
|
785
|
+ birthUnix := birthdays.Unix()
|
|
786
|
+
|
|
787
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
|
|
788
|
+ if err != nil {
|
|
789
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
790
|
+ return
|
|
791
|
+ }
|
|
792
|
+
|
|
793
|
+ var patient service.Patients
|
|
794
|
+ if patient_id == 0 {
|
|
795
|
+ patient, _ = service.GetPatientByIDCard(id_card, adminInfo.CurrentOrgId)
|
|
796
|
+ } else {
|
|
797
|
+ patient, _ = service.GetPatientByIDTwo(adminInfo.CurrentOrgId, patient_id)
|
|
798
|
+ }
|
|
799
|
+
|
|
800
|
+ miConfig, _ := service.FindMedicalInsuranceInfo(adminInfo.CurrentOrgId)
|
|
801
|
+ if patient.ID == 0 {
|
|
802
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
|
|
803
|
+ return
|
|
804
|
+ }
|
|
805
|
+ if len(patient.IdCardNo) == 0 {
|
|
806
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeIDCartNo)
|
|
807
|
+ return
|
|
808
|
+ }
|
|
809
|
+
|
|
810
|
+ adminRole, _ := service.GetAdminUserInfoByID(adminInfo.CurrentOrgId, admin_user_id)
|
|
811
|
+ his, _ := service.GetHisPatientInfo(adminInfo.CurrentOrgId, patient_id, theTime.Unix())
|
|
812
|
+
|
|
813
|
+ var custom_code string
|
|
814
|
+ var custom_project_name string
|
|
815
|
+ var allPrice float64
|
|
816
|
+
|
|
817
|
+ switch register_type {
|
|
818
|
+ case 1:
|
|
819
|
+ custom_code = "110100002"
|
|
820
|
+ custom_project_name = "普通门诊"
|
|
821
|
+ allPrice = 10
|
|
822
|
+ break
|
|
823
|
+ case 3:
|
|
824
|
+ custom_code = "110200002-2"
|
|
825
|
+ custom_project_name = "主任医师"
|
|
826
|
+ allPrice = 10
|
|
827
|
+
|
|
828
|
+ break
|
|
829
|
+ case 2:
|
|
830
|
+ custom_code = "110200002-3"
|
|
831
|
+ custom_project_name = "副主任医师"
|
|
832
|
+ allPrice = 10
|
|
833
|
+
|
|
834
|
+ break
|
|
835
|
+ case 4:
|
|
836
|
+ custom_code = "0"
|
|
837
|
+ custom_project_name = "免受诊金"
|
|
838
|
+ allPrice = 0
|
|
839
|
+ break
|
|
840
|
+ case 5:
|
|
841
|
+ custom_code = "110200002-1"
|
|
842
|
+ custom_project_name = "专家"
|
|
843
|
+ allPrice = 10
|
|
844
|
+
|
|
845
|
+ break
|
|
846
|
+ }
|
|
847
|
+
|
|
848
|
+ if his.ID == 0 {
|
|
849
|
+
|
|
850
|
+ var doctor_name string
|
|
851
|
+ var doctor_code string
|
|
852
|
+ if adminRole.ID == 0 {
|
|
853
|
+
|
|
854
|
+ doctor_name = "管理员"
|
|
855
|
+ doctor_code = "01"
|
|
856
|
+
|
|
857
|
+ } else {
|
|
858
|
+ doctor_name = adminRole.UserName
|
|
859
|
+ doctor_code = strconv.FormatInt(admin_user_id, 10)
|
|
860
|
+
|
|
861
|
+ }
|
|
862
|
+ month := time.Unix(1557042972, 0).Format("1")
|
|
863
|
+ year := time.Now().Format("2006")
|
|
864
|
+ month = time.Now().Format("01")
|
|
865
|
+ day := time.Now().Format("02")
|
|
866
|
+
|
|
867
|
+
|
|
868
|
+
|
|
869
|
+ number := miConfig.Code + year + month + day +
|
|
870
|
+ fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000))
|
|
871
|
+ mz_number := miConfig.Code + year + month + day +
|
|
872
|
+ fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000))
|
|
873
|
+
|
|
874
|
+
|
|
875
|
+ yiliao_number, id_card_number, verifyCode, version_code, _, ret4 := ReadBasCardGetNumber("MZ002" + "|" + number + "|" + miConfig.Code + "|")
|
|
876
|
+ fmt.Println(yiliao_number)
|
|
877
|
+ fmt.Println(id_card_number)
|
|
878
|
+ fmt.Println(verifyCode)
|
|
879
|
+ fmt.Println(version_code)
|
|
880
|
+ fmt.Println(ret4)
|
|
881
|
+
|
|
882
|
+ dept_code := "0306"
|
|
883
|
+ is_yidi = 1
|
|
884
|
+ tempPatient, _ := service.GetPatientByNumber(id_card_number, adminInfo.CurrentOrgId)
|
|
885
|
+
|
|
886
|
+ fmt.Println(tempPatient.ID)
|
|
887
|
+ fmt.Println(patient_id)
|
|
888
|
+
|
|
889
|
+ if tempPatient.ID == patient_id {
|
|
890
|
+ if ret4 == 0 {
|
|
891
|
+ if is_yidi == 1 {
|
|
892
|
+
|
|
893
|
+
|
|
894
|
+ resp_result := service.SzybMZ002(doctor_name, doctor_code, miConfig.Code, dept_code, yiliao_number, verifyCode, number, mz_number, version_code, custom_code, custom_project_name, allPrice, medical_care)
|
|
895
|
+ var dat map[string]interface{}
|
|
896
|
+ if err := json.Unmarshal([]byte(resp_result), &dat); err == nil {
|
|
897
|
+ fmt.Println(dat)
|
|
898
|
+ } else {
|
|
899
|
+ fmt.Println(err)
|
|
900
|
+ }
|
|
901
|
+ userJSONBytes, _ := json.Marshal(dat)
|
|
902
|
+ var res ResultOne
|
|
903
|
+ if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
|
904
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
905
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
906
|
+ return
|
|
907
|
+ }
|
|
908
|
+ if res.Transreturncode == "00000000" {
|
|
909
|
+ his := models.VMHisPatient{
|
|
910
|
+ Name: name,
|
|
911
|
+ Gender: gender,
|
|
912
|
+ Birthday: birthUnix,
|
|
913
|
+ MedicalTreatmentType: medical_care,
|
|
914
|
+ IdType: certificates,
|
|
915
|
+ IdCardNo: id_card,
|
|
916
|
+ BalanceAccountsType: settlementValue,
|
|
917
|
+ SocialType: social_type,
|
|
918
|
+ MedicalInsuranceNumber: medical_insurance_card,
|
|
919
|
+ RegisterType: register_type,
|
|
920
|
+ RegisterCost: registration_fee,
|
|
921
|
+ TreatmentCost: medical_expenses,
|
|
922
|
+ Status: 1,
|
|
923
|
+ Ctime: time.Now().Unix(),
|
|
924
|
+ Mtime: time.Now().Unix(),
|
|
925
|
+ Iinfo: resp_result,
|
|
926
|
+ PatientId: patient.ID,
|
|
927
|
+ RecordDate: theTime.Unix(),
|
|
928
|
+ UserOrgId: adminInfo.CurrentOrgId,
|
|
929
|
+ AdminUserId: admin_user_id,
|
|
930
|
+ IsReturn: 1,
|
|
931
|
+ IdCardType: id_card_type,
|
|
932
|
+ Doctor: doctor,
|
|
933
|
+ Departments: department,
|
|
934
|
+ YiliaoNumber: yiliao_number,
|
|
935
|
+ MzNumber: number,
|
|
936
|
+ Number: mz_number,
|
|
937
|
+ }
|
|
938
|
+ service.CreateHisPatientTwo(&his)
|
|
939
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
940
|
+ "msg": "挂号成功",
|
|
941
|
+ })
|
|
942
|
+ } else {
|
|
943
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
944
|
+ "failed_code": -10,
|
|
945
|
+ "msg": res.Transreturnmessage,
|
|
946
|
+ })
|
|
947
|
+ return
|
|
948
|
+ }
|
|
949
|
+
|
|
950
|
+ } else {
|
|
951
|
+
|
|
952
|
+
|
|
953
|
+
|
|
954
|
+
|
|
955
|
+
|
|
956
|
+
|
|
957
|
+
|
|
958
|
+ resp_result := service.SzybMZ002(doctor_name, doctor_code, miConfig.Code, "0305", yiliao_number, verifyCode, number, mz_number, version_code, custom_code, custom_project_name, allPrice, medical_care)
|
|
959
|
+ var dat map[string]interface{}
|
|
960
|
+ if err := json.Unmarshal([]byte(resp_result), &dat); err == nil {
|
|
961
|
+ fmt.Println(dat)
|
|
962
|
+ } else {
|
|
963
|
+ fmt.Println(err)
|
|
964
|
+ }
|
|
965
|
+
|
|
966
|
+ userJSONBytes, _ := json.Marshal(dat)
|
|
967
|
+
|
|
968
|
+ var res ResultOne
|
|
969
|
+ if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
|
970
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
971
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
972
|
+ return
|
|
973
|
+ }
|
|
974
|
+ if res.Transreturncode == "00000000" {
|
|
975
|
+ his := models.VMHisPatient{
|
|
976
|
+ Name: name,
|
|
977
|
+ Gender: gender,
|
|
978
|
+ Birthday: birthUnix,
|
|
979
|
+ MedicalTreatmentType: medical_care,
|
|
980
|
+ IdType: certificates,
|
|
981
|
+ IdCardNo: id_card,
|
|
982
|
+ BalanceAccountsType: settlementValue,
|
|
983
|
+ SocialType: social_type,
|
|
984
|
+ MedicalInsuranceNumber: medical_insurance_card,
|
|
985
|
+ RegisterType: register_type,
|
|
986
|
+ RegisterCost: registration_fee,
|
|
987
|
+ TreatmentCost: medical_expenses,
|
|
988
|
+ Status: 1,
|
|
989
|
+ Ctime: time.Now().Unix(),
|
|
990
|
+ Mtime: time.Now().Unix(),
|
|
991
|
+ Iinfo: resp_result,
|
|
992
|
+ PatientId: patient.ID,
|
|
993
|
+ RecordDate: theTime.Unix(),
|
|
994
|
+ UserOrgId: adminInfo.CurrentOrgId,
|
|
995
|
+ AdminUserId: admin_user_id,
|
|
996
|
+ IsReturn: 1,
|
|
997
|
+ IdCardType: id_card_type,
|
|
998
|
+ Doctor: doctor,
|
|
999
|
+ Departments: department,
|
|
1000
|
+ YiliaoNumber: yiliao_number,
|
|
1001
|
+ MzNumber: number,
|
|
1002
|
+ Number: mz_number,
|
|
1003
|
+ }
|
|
1004
|
+ service.CreateHisPatientTwo(&his)
|
|
1005
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
1006
|
+ "msg": "挂号成功",
|
|
1007
|
+ })
|
|
1008
|
+ } else {
|
|
1009
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
1010
|
+ "failed_code": -10,
|
|
1011
|
+ "msg": res.Transreturnmessage,
|
|
1012
|
+ })
|
|
1013
|
+ return
|
|
1014
|
+ }
|
|
1015
|
+
|
|
1016
|
+ }
|
|
1017
|
+
|
|
1018
|
+ } else {
|
|
1019
|
+
|
|
1020
|
+
|
|
1021
|
+
|
|
1022
|
+ if is_yidi == 1 {
|
|
1023
|
+ resp_result := service.SzybMZ002(doctor_name, doctor_code, miConfig.Code, "0305", yiliao_number, verifyCode, number, mz_number, version_code, custom_code, custom_project_name, allPrice, medical_care)
|
|
1024
|
+ var dat map[string]interface{}
|
|
1025
|
+ if err := json.Unmarshal([]byte(resp_result), &dat); err == nil {
|
|
1026
|
+ fmt.Println(dat)
|
|
1027
|
+ } else {
|
|
1028
|
+ fmt.Println(err)
|
|
1029
|
+ }
|
|
1030
|
+
|
|
1031
|
+ userJSONBytes, _ := json.Marshal(dat)
|
|
1032
|
+
|
|
1033
|
+ var res ResultOne
|
|
1034
|
+ if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
|
1035
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
1036
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
1037
|
+ return
|
|
1038
|
+ }
|
|
1039
|
+ if res.Transreturncode == "00000000" {
|
|
1040
|
+ his := models.VMHisPatient{
|
|
1041
|
+ Name: name,
|
|
1042
|
+ Gender: gender,
|
|
1043
|
+ Birthday: birthUnix,
|
|
1044
|
+ MedicalTreatmentType: medical_care,
|
|
1045
|
+ IdType: certificates,
|
|
1046
|
+ IdCardNo: id_card,
|
|
1047
|
+ BalanceAccountsType: settlementValue,
|
|
1048
|
+ SocialType: social_type,
|
|
1049
|
+ MedicalInsuranceNumber: medical_insurance_card,
|
|
1050
|
+ RegisterType: register_type,
|
|
1051
|
+ RegisterCost: registration_fee,
|
|
1052
|
+ TreatmentCost: medical_expenses,
|
|
1053
|
+ Status: 1,
|
|
1054
|
+ Ctime: time.Now().Unix(),
|
|
1055
|
+ Mtime: time.Now().Unix(),
|
|
1056
|
+ Iinfo: resp_result,
|
|
1057
|
+ PatientId: patient.ID,
|
|
1058
|
+ RecordDate: theTime.Unix(),
|
|
1059
|
+ UserOrgId: adminInfo.CurrentOrgId,
|
|
1060
|
+ AdminUserId: admin_user_id,
|
|
1061
|
+ IsReturn: 1,
|
|
1062
|
+ IdCardType: id_card_type,
|
|
1063
|
+ Doctor: doctor,
|
|
1064
|
+ Departments: department,
|
|
1065
|
+ YiliaoNumber: yiliao_number,
|
|
1066
|
+ MzNumber: number,
|
|
1067
|
+ Number: mz_number,
|
|
1068
|
+ }
|
|
1069
|
+ service.CreateHisPatientTwo(&his)
|
|
1070
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
1071
|
+ "msg": "挂号成功",
|
|
1072
|
+ })
|
|
1073
|
+ } else {
|
|
1074
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
1075
|
+ "failed_code": -10,
|
|
1076
|
+ "msg": res.Transreturnmessage,
|
|
1077
|
+ })
|
|
1078
|
+ return
|
|
1079
|
+ }
|
|
1080
|
+
|
|
1081
|
+ } else {
|
|
1082
|
+
|
|
1083
|
+
|
|
1084
|
+ resp_result := service.SzybMZ002(doctor_name, doctor_code, miConfig.Code, "0305", yiliao_number, verifyCode, number, mz_number, version_code, custom_code, custom_project_name, allPrice, medical_care)
|
|
1085
|
+ var dat map[string]interface{}
|
|
1086
|
+ if err := json.Unmarshal([]byte(resp_result), &dat); err == nil {
|
|
1087
|
+ fmt.Println(dat)
|
|
1088
|
+ } else {
|
|
1089
|
+ fmt.Println(err)
|
|
1090
|
+ }
|
|
1091
|
+
|
|
1092
|
+ userJSONBytes, _ := json.Marshal(dat)
|
|
1093
|
+
|
|
1094
|
+ var res ResultOne
|
|
1095
|
+ if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
|
1096
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
1097
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
1098
|
+ return
|
|
1099
|
+ }
|
|
1100
|
+ if res.Transreturncode == "00000000" {
|
|
1101
|
+ his := models.VMHisPatient{
|
|
1102
|
+ Name: name,
|
|
1103
|
+ Gender: gender,
|
|
1104
|
+ Birthday: birthUnix,
|
|
1105
|
+ MedicalTreatmentType: medical_care,
|
|
1106
|
+ IdType: certificates,
|
|
1107
|
+ IdCardNo: id_card,
|
|
1108
|
+ BalanceAccountsType: settlementValue,
|
|
1109
|
+ SocialType: social_type,
|
|
1110
|
+ MedicalInsuranceNumber: medical_insurance_card,
|
|
1111
|
+ RegisterType: register_type,
|
|
1112
|
+ RegisterCost: registration_fee,
|
|
1113
|
+ TreatmentCost: medical_expenses,
|
|
1114
|
+ Status: 1,
|
|
1115
|
+ Ctime: time.Now().Unix(),
|
|
1116
|
+ Mtime: time.Now().Unix(),
|
|
1117
|
+ Iinfo: resp_result,
|
|
1118
|
+ PatientId: patient.ID,
|
|
1119
|
+ RecordDate: theTime.Unix(),
|
|
1120
|
+ UserOrgId: adminInfo.CurrentOrgId,
|
|
1121
|
+ AdminUserId: admin_user_id,
|
|
1122
|
+ IsReturn: 1,
|
|
1123
|
+ IdCardType: id_card_type,
|
|
1124
|
+ Doctor: doctor,
|
|
1125
|
+ Departments: department,
|
|
1126
|
+ YiliaoNumber: yiliao_number,
|
|
1127
|
+ MzNumber: number,
|
|
1128
|
+ Number: mz_number,
|
|
1129
|
+ }
|
|
1130
|
+ service.CreateHisPatientTwo(&his)
|
|
1131
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
1132
|
+ "msg": "挂号成功",
|
|
1133
|
+ })
|
|
1134
|
+ } else {
|
|
1135
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
1136
|
+ "failed_code": -10,
|
|
1137
|
+ "msg": res.Transreturnmessage,
|
|
1138
|
+ })
|
|
1139
|
+ return
|
|
1140
|
+ }
|
|
1141
|
+
|
|
1142
|
+ }
|
|
1143
|
+ }
|
|
1144
|
+ } else {
|
|
1145
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
|
|
1146
|
+ return
|
|
1147
|
+ }
|
|
1148
|
+ } else {
|
|
1149
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterRepeatException)
|
|
1150
|
+ return
|
|
1151
|
+ }
|
|
1152
|
+}
|
|
1153
|
+
|
|
1154
|
+func (c *SZHisApiController) RefundNumber() {
|
|
1155
|
+ order_id, _ := c.GetInt64("order_id")
|
|
1156
|
+ record_time := c.GetString("record_time")
|
|
1157
|
+ patient_id, _ := c.GetInt64("patient_id")
|
|
1158
|
+ admin_user_id, _ := c.GetInt64("admin_user_id")
|
|
1159
|
+ timeLayout := "2006-01-02"
|
|
1160
|
+ loc, _ := time.LoadLocation("Local")
|
|
1161
|
+ adminUser := c.GetAdminUserInfo()
|
|
1162
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
|
|
1163
|
+ fmt.Println(err)
|
|
1164
|
+ if err != nil {
|
|
1165
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
1166
|
+ return
|
|
1167
|
+ }
|
|
1168
|
+ recordDateTime := theTime.Unix()
|
|
1169
|
+ fmt.Println(recordDateTime)
|
|
1170
|
+ var order models.HisOrder
|
|
1171
|
+ order, _ = service.GetHisOrderByID(order_id)
|
|
1172
|
+ if order.ID == 0 {
|
|
1173
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisOrderNoExistParamWrong)
|
|
1174
|
+ return
|
|
1175
|
+ }
|
|
1176
|
+ his, _ := service.GetHisPatientInfo(adminUser.CurrentOrgId, patient_id, theTime.Unix())
|
|
1177
|
+ roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
|
|
1178
|
+ miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
|
|
1179
|
+
|
|
1180
|
+ var doctor_name string
|
|
1181
|
+ var doctor_code string
|
|
1182
|
+ if roles.ID == 0 {
|
|
1183
|
+ doctor_name = "管理员"
|
|
1184
|
+ doctor_code = "01"
|
|
1185
|
+ } else {
|
|
1186
|
+ doctor_name = roles.UserName
|
|
1187
|
+ doctor_code = strconv.FormatInt(admin_user_id, 10)
|
|
1188
|
+
|
|
1189
|
+ }
|
|
1190
|
+ month := time.Unix(1557042972, 0).Format("1")
|
|
1191
|
+ year := time.Now().Format("2006")
|
|
1192
|
+ month = time.Now().Format("01")
|
|
1193
|
+ day := time.Now().Format("02")
|
|
1194
|
+
|
|
1195
|
+ number := miConfig.Code + year + month + day +
|
|
1196
|
+ fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000))
|
|
1197
|
+
|
|
1198
|
+
|
|
1199
|
+
|
|
1200
|
+
|
|
1201
|
+ verifyCode, version_code := ReadCardGetCode("JY002" + "|" + number + "|" + miConfig.Code)
|
|
1202
|
+ config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
|
|
1203
|
+ if config.IsOpen == 1 {
|
|
1204
|
+ result := service.SzybJY002(doctor_name, doctor_code, miConfig.Code, his.MzNumber, order.Number, verifyCode, number, version_code)
|
|
1205
|
+ var dat map[string]interface{}
|
|
1206
|
+ if err := json.Unmarshal([]byte(result), &dat); err == nil {
|
|
1207
|
+ fmt.Println(dat)
|
|
1208
|
+ } else {
|
|
1209
|
+ fmt.Println(err)
|
|
1210
|
+ }
|
|
1211
|
+ userJSONBytes, _ := json.Marshal(dat)
|
|
1212
|
+ var res ResultThree
|
|
1213
|
+ if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
|
1214
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
1215
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
1216
|
+ return
|
|
1217
|
+ }
|
|
1218
|
+ if res.Transreturncode == "00000000" {
|
|
1219
|
+ service.UpdataHisStatusSZ(adminUser.CurrentOrgId, his.MzNumber, his.Number, result)
|
|
1220
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
1221
|
+ "msg": "退号成功",
|
|
1222
|
+ })
|
|
1223
|
+ } else {
|
|
1224
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
1225
|
+ "failed_code": -10,
|
|
1226
|
+ "msg": res.Transreturnmessage,
|
|
1227
|
+ })
|
|
1228
|
+
|
|
1229
|
+ }
|
|
1230
|
+ }
|
|
1231
|
+
|
|
1232
|
+}
|
720
|
1233
|
|
721
|
1234
|
|
722
|
1235
|
|
|
@@ -2571,7 +3084,7 @@ func ReadCardGetCode(request string) (string, string) {
|
2571
|
3084
|
return "", ""
|
2572
|
3085
|
}
|
2573
|
3086
|
|
2574
|
|
-
|
|
3087
|
+
|
2575
|
3088
|
func ReadBasCardGetNumber(request string) (string, string, string, string, error, int64) {
|
2576
|
3089
|
DllDef2 := syscall.MustLoadDLL("SSCardDriver_SZ.dll")
|
2577
|
3090
|
readCards := DllDef2.MustFindProc("iReadCardBas")
|
|
@@ -2598,6 +3111,27 @@ func ReadBasCardGetNumber(request string) (string, string, string, string, error
|
2598
|
3111
|
return "", "", "", "", err, -10
|
2599
|
3112
|
}
|
2600
|
3113
|
|
|
3114
|
+
|
|
3115
|
+func ReadBasCard(request string) (string, string, error, int64) {
|
|
3116
|
+ DllDef2 := syscall.MustLoadDLL("SSCardDriver_SZ.dll")
|
|
3117
|
+ readCards := DllDef2.MustFindProc("iReadCardBas")
|
|
3118
|
+ str := request
|
|
3119
|
+ str3 := make([]byte, 1024)
|
|
3120
|
+ ret4, _, err := readCards.Call(IntPtr(1), StrPtr(str), (uintptr)(unsafe.Pointer(&str3[0])))
|
|
3121
|
+ fmt.Println(":", string(str3))
|
|
3122
|
+ fmt.Println(":", ConvertToString(string(str3), "gbk", "utf-8"))
|
|
3123
|
+ if ret4 == 0 {
|
|
3124
|
+ result := string(str3)
|
|
3125
|
+ result_arr := strings.Split(result, "|")
|
|
3126
|
+
|
|
3127
|
+ id_card_number := result_arr[1]
|
|
3128
|
+ health_card_no := result_arr[2]
|
|
3129
|
+
|
|
3130
|
+ return id_card_number, health_card_no, err, 0
|
|
3131
|
+ }
|
|
3132
|
+ return "", "", err, -10
|
|
3133
|
+}
|
|
3134
|
+
|
2601
|
3135
|
|
2602
|
3136
|
|
2603
|
3137
|
|
|
@@ -3488,6 +4022,43 @@ func (c *SZHisApiController) GetMedicalList() {
|
3488
|
4022
|
StartTime: 20201010,
|
3489
|
4023
|
StaffCode: "",
|
3490
|
4024
|
EndTime: 0,
|
|
4025
|
+ UserName: item.UserName,
|
|
4026
|
+ RoleId: item.Name,
|
|
4027
|
+ Sex: sex,
|
|
4028
|
+ CardType: card_type,
|
|
4029
|
+ IdCard: item.IdCard,
|
|
4030
|
+ Phone: item.Mobile,
|
|
4031
|
+ WorkMajorName: item.WorkMajorName,
|
|
4032
|
+ Nation: item.Nation,
|
|
4033
|
+ BirthDay: 20201022,
|
|
4034
|
+ WorkTime: 12,
|
|
4035
|
+ Education: strconv.FormatInt(item.Education, 10),
|
|
4036
|
+ StudyMajorName: item.StudyMajorName,
|
|
4037
|
+ CertificateCode: "",
|
|
4038
|
+ MedicalCode: item.MedicalCode,
|
|
4039
|
+ MedicalRangeCode: strconv.FormatInt(item.MedicalRangeCode, 10),
|
|
4040
|
+ MedicalLevel: strconv.FormatInt(item.MedicalLevel, 10),
|
|
4041
|
+ TypeJob: strconv.FormatInt(item.DoctorTypeJob, 10),
|
|
4042
|
+ DoctorNumber: item.DoctorNumber,
|
|
4043
|
+ Licensing: strconv.FormatInt(item.Licensing, 10),
|
|
4044
|
+ DoctorServiceStatus: "",
|
|
4045
|
+ MonitoringLevel: "",
|
|
4046
|
+ DrugPsychotropicSubstances: "",
|
|
4047
|
+ HealthCareCode: "",
|
|
4048
|
+ PlanningTechnicalServiceCode: "",
|
|
4049
|
+ PharmacistType: "",
|
|
4050
|
+ PharmacistPracticeCategory: "",
|
|
4051
|
+ PharmacistsLicensing: "",
|
|
4052
|
+ PharmacistRegistrationNumber: item.PharmacistRegistrationNumber,
|
|
4053
|
+ OfficeCode: "",
|
|
4054
|
+ JobNumber: item.JobNumber,
|
|
4055
|
+ PostName: "",
|
|
4056
|
+ TechnicalJobLevelCode: "",
|
|
4057
|
+ IsActive: is_active,
|
|
4058
|
+ PrescriptionQualificationIdentification: item.PharmacistRegistrationNumber,
|
|
4059
|
+ IdentificationOutpatients: "",
|
|
4060
|
+ OutpatientIllnessCategory: item.OutpatientIllnessCategory,
|
|
4061
|
+ StartTime: 20201012,
|
3491
|
4062
|
}
|
3492
|
4063
|
result := service.SzybYS001(doctor_name, doctor_code, miConfig.Code, detail)
|
3493
|
4064
|
fmt.Println("reuslt9999999999999999", result)
|
|
@@ -3588,45 +4159,8 @@ func (c *SZHisApiController) GetMedicalList() {
|
3588
|
4159
|
StartTime: 20201010,
|
3589
|
4160
|
StaffCode: "",
|
3590
|
4161
|
EndTime: 0,
|
3591
|
|
- StaffCode: "H27224269",
|
3592
|
|
- UserName: item.UserName,
|
3593
|
|
- RoleId: item.Name,
|
3594
|
|
- Sex: "1",
|
3595
|
|
- CardType: "01",
|
3596
|
|
- IdCard: "430526199408156511",
|
3597
|
|
- Phone: "13318464642",
|
3598
|
|
- WorkMajorName: "医生",
|
3599
|
|
- Nation: "01",
|
3600
|
|
- BirthDay: 20201022,
|
3601
|
|
- WorkTime: 20201022,
|
3602
|
|
- Education: "21",
|
3603
|
|
- StudyMajorName: "医生",
|
3604
|
|
- CertificateCode: "y2222222",
|
3605
|
|
- MedicalCode: "y2222222",
|
3606
|
|
- MedicalRangeCode: "101",
|
3607
|
|
- MedicalLevel: "1",
|
3608
|
|
- TypeJob: "1",
|
3609
|
|
- DoctorNumber: "22222",
|
3610
|
|
- Licensing: "1",
|
3611
|
|
- DoctorServiceStatus: "1",
|
3612
|
|
- MonitoringLevel: "1",
|
3613
|
|
- DrugPsychotropicSubstances: "1",
|
3614
|
|
- HealthCareCode: "1001",
|
3615
|
|
- PlanningTechnicalServiceCode: "1002",
|
3616
|
|
- PharmacistType: "1",
|
3617
|
|
- PharmacistPracticeCategory: "1",
|
3618
|
|
- PharmacistsLicensing: "1",
|
3619
|
|
- PharmacistRegistrationNumber: "000200",
|
3620
|
|
- OfficeCode: "9933",
|
3621
|
|
- JobNumber: "82021344",
|
3622
|
|
- PostName: "主任",
|
3623
|
|
- TechnicalJobLevelCode: "231",
|
3624
|
|
- IsActive: "1",
|
3625
|
|
- PrescriptionQualificationIdentification: "1",
|
3626
|
|
- IdentificationOutpatients: "1",
|
3627
|
|
- OutpatientIllnessCategory: "血友病",
|
3628
|
|
- StartTime: 20210311,
|
3629
|
|
-
|
|
4162
|
+ StaffCode: "H27224269",
|
|
4163
|
+ 20210311,
|
3630
|
4164
|
}
|
3631
|
4165
|
result := service.SzybYS002(doctor_name, doctor_code, miConfig.Code, detail)
|
3632
|
4166
|
fmt.Println("reuslt9999999999999999", result)
|