csx 3 years ago
parent
commit
766e740075

+ 1 - 1
conf/app.conf View File

44
 
44
 
45
 
45
 
46
 [prod]
46
 [prod]
47
-org_id = 9919
47
+org_id = 3877
48
 mobile_token_expiration_second = 86400
48
 mobile_token_expiration_second = 86400
49
 httpdomain = https://api.xt.kuyicloud.com
49
 httpdomain = https://api.xt.kuyicloud.com
50
 sso_domain = https://sso.kuyicloud.com
50
 sso_domain = https://sso.kuyicloud.com

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

55
 
55
 
56
 }
56
 }
57
 
57
 
58
-func (c *HisApiController) TestPay() {
59
-	DllDef2 := syscall.MustLoadDLL("SSSE32.dll")
60
-	readCards := DllDef2.MustFindProc("BankTrans")
61
-	inputData := make(map[string]interface{})
62
-	inputData["transId"] = "05"
63
-	inputData["amount"] = "0.01"
64
-	inputData["traceNo"] = "20210227093601325405377"
65
-	inputData["cardNo"] = "F36084348"
66
-	inputData["id"] = "44022919620927046X"
67
-	//jsonStr := `
68
-	//    {
69
-	//            "transId": "05",
70
-	//            "amount":"1.00",
71
-	//            "traceNo":"20210227093601325405377",
72
-	//            "cardNo":"F36084348",
73
-	//            "id":"44022919620927046X"
74
-	//
75
-	//    }
76
-	//`
77
-
78
-	bytes_arr, _ := json.Marshal(inputData)
79
-	str3 := make([]byte, 256)
80
-	ret4, _, err4 := readCards.Call(StrPtr(string(bytes_arr)), (uintptr)(unsafe.Pointer(&str3[0])))
81
-	fmt.Println(":", string(str3))
82
-
83
-	if err4 != nil {
84
-		fmt.Println("SSCard的运算结果为:", ret4)
85
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
86
-		return
87
-	}
88
-
89
-}
58
+//func (c *HisApiController) TestPay() {
59
+//	DllDef2 := syscall.MustLoadDLL("SSSE32.dll")
60
+//	readCards := DllDef2.MustFindProc("BankTrans")
61
+//	inputData := make(map[string]interface{})
62
+//	inputData["transId"] = "05"
63
+//	inputData["amount"] = "0.01"
64
+//	inputData["traceNo"] = "20210227093601325405377"
65
+//	inputData["cardNo"] = "F36084348"
66
+//	inputData["id"] = "44022919620927046X"
67
+//	//jsonStr := `
68
+//	//    {
69
+//	//            "transId": "05",
70
+//	//            "amount":"1.00",
71
+//	//            "traceNo":"20210227093601325405377",
72
+//	//            "cardNo":"F36084348",
73
+//	//            "id":"44022919620927046X"
74
+//	//
75
+//	//    }
76
+//	//`
77
+//
78
+//	bytes_arr, _ := json.Marshal(inputData)
79
+//	str3 := make([]byte, 256)
80
+//	ret4, _, err4 := readCards.Call(StrPtr(string(bytes_arr)), (uintptr)(unsafe.Pointer(&str3[0])))
81
+//	fmt.Println(":", string(str3))
82
+//
83
+//	if err4 != nil {
84
+//		fmt.Println("SSCard的运算结果为:", ret4)
85
+//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
86
+//		return
87
+//	}
88
+//
89
+//}
90
 
90
 
91
 func (c *HisApiController) TestGetBasBaseInfo() {
91
 func (c *HisApiController) TestGetBasBaseInfo() {
92
 
92
 

+ 65 - 57
controllers/sz/sz_his_api_controller.go View File

371
 
371
 
372
 		//流水号
372
 		//流水号
373
 		//
373
 		//
374
-		number := miConfig.Code + year + month + day +
375
-			fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000)) // 定点协议机构编码(5位)+日期(8位)+流水号(7位)
374
+		//number := miConfig.Code + year + month + day +
375
+		//	fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000)) // 定点协议机构编码(5位)+日期(8位)+流水号(7位)
376
 		mz_number := year + month + day + strconv.FormatInt(patient_id, 10)
376
 		mz_number := year + month + day + strconv.FormatInt(patient_id, 10)
377
-		//number := miConfig.Code + year + month + day + "2233445"
378
-		verifyCode, version_code := ReadCardGetCode("MZ002" + "|" + number + "|" + miConfig.Code)
379
-
377
+		number := miConfig.Code + year + month + day + "2233445"
378
+		//verifyCode, version_code := ReadCardGetCode("MZ002" + "|" + number + "|" + miConfig.Code)
379
+		verifyCode := "000000|4d221ed0d796a493ada20244272962d4"
380
+		version_code := "0.03"
380
 		//1.判断读卡类型
381
 		//1.判断读卡类型
381
 		//2.读卡 获取交易验证码,医疗证号,发卡地区行政区划代码
382
 		//2.读卡 获取交易验证码,医疗证号,发卡地区行政区划代码
382
 		//yiliao_number, id_card_number,verifyCode, err, ret4 := ReadBasCardGetNumber(number)
383
 		//yiliao_number, id_card_number,verifyCode, err, ret4 := ReadBasCardGetNumber(number)
653
 	chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) + strconv.FormatInt(1, 10)
654
 	chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) + strconv.FormatInt(1, 10)
654
 	adminUser := c.GetAdminUserInfo()
655
 	adminUser := c.GetAdminUserInfo()
655
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
656
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
656
-
657
 	month := time.Unix(1557042972, 0).Format("1")
657
 	month := time.Unix(1557042972, 0).Format("1")
658
 	year := time.Now().Format("2006")
658
 	year := time.Now().Format("2006")
659
 	month = time.Now().Format("01")
659
 	month = time.Now().Format("01")
725
 		doctor_code = strconv.FormatInt(admin_user_id, 10)
725
 		doctor_code = strconv.FormatInt(admin_user_id, 10)
726
 	}
726
 	}
727
 
727
 
728
-	verifyCode, version_code := ReadCardGetCode("FY001" + "|" + number + "|" + miConfig.Code)
728
+	//verifyCode, version_code := ReadCardGetCode("FY001" + "|" + number + "|" + miConfig.Code)
729
+	verifyCode := ""
730
+	version_code := ""
729
 	var customs []*models.CustomDetail
731
 	var customs []*models.CustomDetail
730
 	for _, item := range prescriptions {
732
 	for _, item := range prescriptions {
731
 		if item.Type == 1 { //药品
733
 		if item.Type == 1 { //药品
732
 			for _, subItem := range item.HisDoctorAdviceInfo {
734
 			for _, subItem := range item.HisDoctorAdviceInfo {
733
 				if len(subItem.BaseDrugLib.MedicalInsuranceNumber) > 0 {
735
 				if len(subItem.BaseDrugLib.MedicalInsuranceNumber) > 0 {
736
+					_, dose_code := service.GetDoseCode(subItem.BaseDrugLib.DrugDosageForm, adminUser.CurrentOrgId)
734
 					detItemFeeSumamt, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", subItem.Price*subItem.PrescribingNumber), 64)
737
 					detItemFeeSumamt, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", subItem.Price*subItem.PrescribingNumber), 64)
735
 					price, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", subItem.Price), 64)
738
 					price, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", subItem.Price), 64)
736
 					cus := &models.CustomDetail{
739
 					cus := &models.CustomDetail{
745
 						ChargeOrderDate:    year + month + day,
748
 						ChargeOrderDate:    year + month + day,
746
 						DoctorCode:         doctor_code,
749
 						DoctorCode:         doctor_code,
747
 						Total:              detItemFeeSumamt,
750
 						Total:              detItemFeeSumamt,
748
-						DoseCode:           "",
751
+						DoseCode:           dose_code,
749
 						Spec:               strconv.FormatFloat(subItem.DrugSpec, 'E', -1, 64) + subItem.DrugSpecUnit,
752
 						Spec:               strconv.FormatFloat(subItem.DrugSpec, 'E', -1, 64) + subItem.DrugSpecUnit,
750
 					}
753
 					}
751
 					customs = append(customs, cus)
754
 					customs = append(customs, cus)
976
 				total = total + (subItem.Price * float64(subItem.Count))
979
 				total = total + (subItem.Price * float64(subItem.Count))
977
 			}
980
 			}
978
 		}
981
 		}
979
-		verifyCode, version_code := ReadCardGetCode("FY004" + "|" + number + "|" + miConfig.Code)
982
+		//verifyCode, version_code := ReadCardGetCode("FY004" + "|" + number + "|" + miConfig.Code)
983
+		verifyCode := ""
984
+		version_code := ""
980
 		result_two := service.SzybFY004(doctor_name, doctor_code, miConfig.Code, total, verifyCode, number, mz_number, version_code)
985
 		result_two := service.SzybFY004(doctor_name, doctor_code, miConfig.Code, total, verifyCode, number, mz_number, version_code)
981
 		var dat map[string]interface{}
986
 		var dat map[string]interface{}
982
 		if err := json.Unmarshal([]byte(result_two), &dat); err == nil {
987
 		if err := json.Unmarshal([]byte(result_two), &dat); err == nil {
1103
 			}
1108
 			}
1104
 			number := his.MzNumber
1109
 			number := his.MzNumber
1105
 			mz_number := his.Number
1110
 			mz_number := his.Number
1106
-			verifyCode, version_code := ReadCardGetCode("FY005" + "|" + number + "|" + miConfig.Code)
1111
+			//verifyCode, version_code := ReadCardGetCode("FY005" + "|" + number + "|" + miConfig.Code)
1112
+
1113
+			verifyCode := ""
1114
+			version_code := ""
1107
 			//verifyCode := "000000|eb7acc3ec61eb5e3fd12a3586ad3a9c5"
1115
 			//verifyCode := "000000|eb7acc3ec61eb5e3fd12a3586ad3a9c5"
1108
 			//version_code := "0.03"
1116
 			//version_code := "0.03"
1109
 			//yiliao_number, id_card_number,verifyCode,versionCode, err, ret4 := ReadBasCardGetNumber("FY005" + "|" + number + "|" + miConfig.Code)
1117
 			//yiliao_number, id_card_number,verifyCode,versionCode, err, ret4 := ReadBasCardGetNumber("FY005" + "|" + number + "|" + miConfig.Code)
1397
 }
1405
 }
1398
 
1406
 
1399
 //获取verifyCode
1407
 //获取verifyCode
1400
-func ReadCardGetCode(request string) (string, string) {
1401
-	DllDef2 := syscall.MustLoadDLL("SSSE32.dll")
1402
-	readCards := DllDef2.MustFindProc("iVerifyCode")
1403
-	str := request
1404
-	str3 := make([]byte, 256)
1405
-	ret4, _, _ := readCards.Call(StrPtr(str), (uintptr)(unsafe.Pointer(&str3[0])))
1406
-	fmt.Println(":", string(str3))
1407
-
1408
-	if ret4 == 0 {
1409
-		result := string(str3)
1410
-		fmt.Println(result)
1411
-		result_arr := strings.Split(result, "|")
1412
-		verifyCode := result_arr[0] + "|" + result_arr[1]
1413
-		versionCode := result_arr[2]
1414
-
1415
-		return verifyCode, versionCode
1416
-
1417
-	}
1418
-	return "", ""
1419
-}
1408
+//func ReadCardGetCode(request string) (string, string) {
1409
+//	DllDef2 := syscall.MustLoadDLL("SSSE32.dll")
1410
+//	readCards := DllDef2.MustFindProc("iVerifyCode")
1411
+//	str := request
1412
+//	str3 := make([]byte, 256)
1413
+//	ret4, _, _ := readCards.Call(StrPtr(str), (uintptr)(unsafe.Pointer(&str3[0])))
1414
+//	fmt.Println(":", string(str3))
1415
+//
1416
+//	if ret4 == 0 {
1417
+//		result := string(str3)
1418
+//		fmt.Println(result)
1419
+//		result_arr := strings.Split(result, "|")
1420
+//		verifyCode := result_arr[0] + "|" + result_arr[1]
1421
+//		versionCode := result_arr[2]
1422
+//
1423
+//		return verifyCode, versionCode
1424
+//
1425
+//	}
1426
+//	return "", ""
1427
+//}
1420
 
1428
 
1421
 //
1429
 //
1422
 ////读卡
1430
 ////读卡
1423
-func ReadBasCardGetNumber(request string) (string, string, string, string, error, int64) {
1424
-	DllDef2 := syscall.MustLoadDLL("SSSE32.dll")
1425
-	readCards := DllDef2.MustFindProc("iReadCardBas")
1426
-	str := request
1427
-
1428
-	str3 := make([]byte, 256)
1429
-	ret4, _, err := readCards.Call(IntPtr(3), StrPtr(str), (uintptr)(unsafe.Pointer(&str3[0])))
1430
-	fmt.Println(":", string(str3))
1431
-
1432
-	if ret4 == 0 {
1433
-		result := string(str3)
1434
-		fmt.Println(result)
1435
-		result_arr := strings.Split(result, "|")
1436
-		//医疗证号
1437
-		yiliao_number := result_arr[12]
1438
-
1439
-		//根据业务的人员信息跟设备读社保卡获取的信息进行匹配,判断是否为同一个人,相同则进行挂号操作,不同则报错
1440
-		id_card_number := result_arr[1]
1441
-
1442
-		verifyCode := result_arr[11] + result_arr[13]
1443
-
1444
-		versionCode := result_arr[14]
1445
-		return yiliao_number, id_card_number, verifyCode, versionCode, err, 1
1446
-
1447
-	}
1448
-	return "", "", "", "", err, 0
1449
-}
1431
+//func ReadBasCardGetNumber(request string) (string, string, string, string, error, int64) {
1432
+//	DllDef2 := syscall.MustLoadDLL("SSSE32.dll")
1433
+//	readCards := DllDef2.MustFindProc("iReadCardBas")
1434
+//	str := request
1435
+//
1436
+//	str3 := make([]byte, 256)
1437
+//	ret4, _, err := readCards.Call(IntPtr(3), StrPtr(str), (uintptr)(unsafe.Pointer(&str3[0])))
1438
+//	fmt.Println(":", string(str3))
1439
+//
1440
+//	if ret4 == 0 {
1441
+//		result := string(str3)
1442
+//		fmt.Println(result)
1443
+//		result_arr := strings.Split(result, "|")
1444
+//		//医疗证号
1445
+//		yiliao_number := result_arr[12]
1446
+//
1447
+//		//根据业务的人员信息跟设备读社保卡获取的信息进行匹配,判断是否为同一个人,相同则进行挂号操作,不同则报错
1448
+//		id_card_number := result_arr[1]
1449
+//
1450
+//		verifyCode := result_arr[11] + result_arr[13]
1451
+//
1452
+//		versionCode := result_arr[14]
1453
+//		return yiliao_number, id_card_number, verifyCode, versionCode, err, 1
1454
+//
1455
+//	}
1456
+//	return "", "", "", "", err, 0
1457
+//}
1450
 
1458
 
1451
 //
1459
 //
1452
 ////iReadCardBas_HSM_Step1 ---- 1903 iCardInnerAuthentication ---  	iReadCardBas_HSM_Step2
1460
 ////iReadCardBas_HSM_Step1 ---- 1903 iCardInnerAuthentication ---  	iReadCardBas_HSM_Step2

+ 25 - 0
models/data_models.go View File

17
 	Title          string `gorm:"column:title" json:"title" form:"title"`
17
 	Title          string `gorm:"column:title" json:"title" form:"title"`
18
 	Content        string `gorm:"column:content" json:"content" form:"content"`
18
 	Content        string `gorm:"column:content" json:"content" form:"content"`
19
 	Order          int64  `gorm:"column:orders" json:"orders" form:"orders"`
19
 	Order          int64  `gorm:"column:orders" json:"orders" form:"orders"`
20
+	Code           string `gorm:"column:code" json:"code" form:"code"`
20
 }
21
 }
21
 
22
 
22
 func (Dataconfig) TableName() string {
23
 func (Dataconfig) TableName() string {
141
 func (XtHisAddtionConfig) TableName() string {
142
 func (XtHisAddtionConfig) TableName() string {
142
 	return "xt_his_addtion_config"
143
 	return "xt_his_addtion_config"
143
 }
144
 }
145
+
146
+type DictDataconfig struct {
147
+	ID             int64  `gorm:"column:id" json:"id" form:"id"`
148
+	ParentId       int64  `gorm:"column:parent_id" json:"parent_id" form:"parent_id"`
149
+	Module         string `gorm:"column:module" json:"module" form:"module"`
150
+	OrgId          int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
151
+	Name           string `gorm:"column:name" json:"name" form:"name"`
152
+	FieldName      string `gorm:"column:field_name" json:"field_name" form:"field_name"`
153
+	Value          int    `gorm:"column:value" json:"value" form:"value"`
154
+	CreatedTime    string `gorm:"column:create_time" json:"create_time" form:"create_time"`
155
+	UpdatedTime    string `gorm:"column:update_time" json:"update_time" form:"update_time"`
156
+	CreateUserId   int64  `gorm:"column:create_user_id" json:"create_user_id" form:"create_user_id"`
157
+	Status         int64  `gorm:"column:status" json:"status" form:"status"`
158
+	Remark         string `gorm:"column:remark" json:"remark" form:"remark"`
159
+	DeleteIdSystem int64  `gorm:"column:delete_id_system" json:"delete_id_system" form:"delete_id_system"`
160
+	Title          string `gorm:"column:title" json:"title" form:"title"`
161
+	Content        string `gorm:"column:content" json:"content" form:"content"`
162
+	Order          int64  `gorm:"column:orders" json:"orders" form:"orders"`
163
+	Code           string `gorm:"column:code" json:"code" form:"code"`
164
+}
165
+
166
+func (DictDataconfig) TableName() string {
167
+	return "xt_drug_data_config"
168
+}

+ 0 - 5
models/sz_his_models.go View File

73
 	StaffCode                               string //医护人员编码
73
 	StaffCode                               string //医护人员编码
74
 	EndTime                                 int64  // 结束日期
74
 	EndTime                                 int64  // 结束日期
75
 }
75
 }
76
-
77
-type RegisterDetail struct {
78
-	PrescriptionNumber string
79
-	PrescriptionNumber string
80
-}

+ 4 - 4
routers/router.go View File

1
 package routers
1
 package routers
2
 
2
 
3
 import (
3
 import (
4
-	"gdyb/controllers/sg"
4
+	"gdyb/controllers/sz"
5
 	//"gdyb/controllers/sz"
5
 	//"gdyb/controllers/sz"
6
 	//admin_api "XT_New/controllers/admin_api_controllers"
6
 	//admin_api "XT_New/controllers/admin_api_controllers"
7
 	"github.com/astaxie/beego"
7
 	"github.com/astaxie/beego"
19
 		AllowCredentials: true,
19
 		AllowCredentials: true,
20
 	}))
20
 	}))
21
 
21
 
22
-	sg.HisManagerApiRegistRouters()
23
-	sg.GdybRegistRouters()
24
-	//sz.SZHisManagerApiRegistRouters()
22
+	//sg.HisManagerApiRegistRouters()
23
+	//sg.GdybRegistRouters()
24
+	sz.SZHisManagerApiRegistRouters()
25
 
25
 
26
 }
26
 }

+ 6 - 0
service/sz_his_service.go View File

991
 	str := string(respBytes)
991
 	str := string(respBytes)
992
 	return str
992
 	return str
993
 }
993
 }
994
+
995
+func GetDoseCode(dose_id int64, user_org_id int64) (error, string) {
996
+	var data models.DictDataconfig
997
+	err := readDb.Model(&models.DictDataconfig{}).Where(" (user_org_id = ? Or user_org_id = 0) AND parent_id = 4 AND module = 'system' AND status = 1 AND value = ?", user_org_id, dose_id).First(&data).Error
998
+	return err, data.Code
999
+}