csx il y a 3 ans
Parent
révision
6b94b59c4e

+ 2 - 2
controllers/sg/his_api_controller.go Voir le fichier

@@ -2488,7 +2488,7 @@ func (c *HisApiController) Refund() {
2488 2488
 
2489 2489
 	if config.IsOpen == 1 { //对接了医保,走医保流程
2490 2490
 		api := "http://127.0.0.1:9532/" + "gdyb/nine?psn_no=" + his.PsnNo +
2491
-			"&mdtrt_id=" + his.Number + "&doctor=" + patientPrescription.Doctor + "&setl_id=" + order.SetlId + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
2491
+			"&mdtrt_id=" + his.Number + "&doctor=" + "张俊杰" + "&setl_id=" + order.SetlId + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
2492 2492
 			"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
2493 2493
 		resp, requestErr := http.Get(api)
2494 2494
 		if requestErr != nil {
@@ -2601,7 +2601,7 @@ func (c *HisApiController) RefundNumber() {
2601 2601
 	if config.IsOpen == 1 { //对接了医保,走医保流程
2602 2602
 
2603 2603
 		api3 := "http://127.0.0.1:9532/" + "gdyb/three?psn_no=" + his.PsnNo +
2604
-			"&mdtrt_id=" + his.Number + "&ipt_otp_no=" + his.IptOtpNo + "&doctor=" + patientPrescription.Doctor + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
2604
+			"&mdtrt_id=" + his.Number + "&ipt_otp_no=" + his.IptOtpNo + "&doctor=" + "张俊杰" + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
2605 2605
 			"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
2606 2606
 		resp3, requestErr3 := http.Get(api3)
2607 2607
 		if requestErr3 != nil {

+ 203 - 188
controllers/sz/sz_his_api_controller.go Voir le fichier

@@ -14,10 +14,7 @@ import (
14 14
 	"math/rand"
15 15
 	"net/http"
16 16
 	"strconv"
17
-	"strings"
18
-	"syscall"
19 17
 	"time"
20
-	"unsafe"
21 18
 )
22 19
 
23 20
 type SZHisApiController struct {
@@ -26,11 +23,11 @@ type SZHisApiController struct {
26 23
 
27 24
 func SZHisManagerApiRegistRouters() {
28 25
 
29
-	beego.Router("/sz/api/card/get", &SZHisApiController{}, "get:GetCardInfo")
26
+	//beego.Router("/sz/api/card/get", &SZHisApiController{}, "get:GetCardInfo")
30 27
 	beego.Router("/sz/api/register/get", &SZHisApiController{}, "get:GetRegisterInfo")
31 28
 	beego.Router("/sz/api/upload/get", &SZHisApiController{}, "get:GetUploadInfo")
32 29
 	beego.Router("/sz/api/settle/get", &SZHisApiController{}, "get:GetSettleInfo")
33
-	beego.Router("/sz/api/settle/query", &SZHisApiController{}, "get:GetSettleAccounts")
30
+	//beego.Router("/sz/api/settle/query", &SZHisApiController{}, "get:GetSettleAccounts")
34 31
 
35 32
 }
36 33
 
@@ -618,9 +615,11 @@ type Custom struct {
618 615
 
619 616
 //获取读卡信息 -- 门诊挂号
620 617
 func (c *SZHisApiController) GetRegisterInfo() {
621
-	adminInfo := c.GetAdminUserInfo()
622
-	admin_user_id, _ := c.GetInt64("admin_user_id")
623
-	adminRole, _ := service.GetAdminUserInfoByID(adminInfo.CurrentOrgId, admin_user_id)
618
+	//adminInfo := c.GetAdminUserInfo()
619
+	//admin_user_id, _ := c.GetInt64("admin_user_id")
620
+	//adminRole, _ := service.GetAdminUserInfoByID(adminInfo.CurrentOrgId, admin_user_id)
621
+	resp_result := service.SzybMZ002("黄亦轩", "1001", "G5540", "013", "%GAAFSAKSXSUKKWDKHDAD?;07734724145330238292?", "000000|e14f1d0ad6acdf00ce4d6b9f69d877b6")
622
+	fmt.Println(resp_result)
624 623
 
625 624
 	//month := time.Unix(1557042972, 0).Format("1")
626 625
 	//year := time.Now().Format("2006")
@@ -629,36 +628,36 @@ func (c *SZHisApiController) GetRegisterInfo() {
629 628
 
630 629
 	//1.读卡 获取交易验证码,医疗证号,发卡地区行政区划代码
631 630
 	//miConfig, _ := service.FindMedicalInsuranceInfo(adminInfo.CurrentOrgId)
632
-	DllDef2 := syscall.MustLoadDLL("SSSE32.dll")
633
-	readCards := DllDef2.MustFindProc("iReadCardBas")
634
-	str := "MZ002|H1110201801031000001|G5540"
635
-	str3 := make([]byte, 256)
636
-	ret4, _, err4 := readCards.Call(StrPtr(str), (uintptr)(unsafe.Pointer(&str3[0])))
637
-	fmt.Println(":", string(str3))
638
-
639
-	if err4 != nil {
640
-		fmt.Println("SSCard的运算结果为:", ret4)
641
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
642
-		return
643
-	}
644
-
645
-	if ret4 == 0 {
646
-		result := string(str3)
647
-		fmt.Println(result)
648
-		result_arr := strings.Split(result, "|")
649
-		//医疗证号
650
-		number := result_arr[12]
651
-		//VerifyCode
652
-		verifyCode := result_arr[11] + "|" + result_arr[13]
653
-
654
-		//挂号
655
-		resp_result := service.SzybMZ002(adminRole.UserName, strconv.FormatInt(adminRole.ID, 10), "G5540", "013", number, verifyCode)
656
-		fmt.Println(resp_result)
657
-
658
-	} else {
659
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
660
-		return
661
-	}
631
+	//DllDef2 := syscall.MustLoadDLL("SSSE32.dll")
632
+	//readCards := DllDef2.MustFindProc("iReadCardBas")
633
+	//str := "MZ002|H1110201801031000001|G5540"
634
+	//str3 := make([]byte, 256)
635
+	//ret4, _, err4 := readCards.Call(StrPtr(str), (uintptr)(unsafe.Pointer(&str3[0])))
636
+	//fmt.Println(":", string(str3))
637
+	//
638
+	//if err4 != nil {
639
+	//	fmt.Println("SSCard的运算结果为:", ret4)
640
+	//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
641
+	//	return
642
+	//}
643
+	//
644
+	//if ret4 == 0 {
645
+	//	result := string(str3)
646
+	//	fmt.Println(result)
647
+	//	result_arr := strings.Split(result, "|")
648
+	//	//医疗证号
649
+	//	number := result_arr[12]
650
+	//	//VerifyCode
651
+	//	verifyCode := result_arr[11] + "|" + result_arr[13]
652
+	//
653
+	//	//挂号
654
+	//	resp_result := service.SzybMZ002(adminRole.UserName, strconv.FormatInt(adminRole.ID, 10), "G5540", "013", number, verifyCode)
655
+	//	fmt.Println(resp_result)
656
+	//
657
+	//} else {
658
+	//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
659
+	//	return
660
+	//}
662 661
 
663 662
 	//id, _ := c.GetInt64("id")
664 663
 	//record_time := c.GetString("record_time")
@@ -735,8 +734,8 @@ func (c *SZHisApiController) GetRegisterInfo() {
735 734
 
736 735
 //上传明细----预结算----确认订单
737 736
 func (c *SZHisApiController) GetUploadInfo() {
738
-	id, _ := c.GetInt64("id")
739
-	record_time := c.GetString("record_time")
737
+	//id, _ := c.GetInt64("id")
738
+	//record_time := c.GetString("record_time")
740 739
 	//pay_way, _ := c.GetInt64("pay_way")
741 740
 	//pay_price, _ := c.GetFloat("pay_price")
742 741
 	//pay_card_no := c.GetString("pay_card_no")
@@ -746,61 +745,61 @@ func (c *SZHisApiController) GetUploadInfo() {
746 745
 	//found_price, _ := c.GetFloat("found_price")
747 746
 	//medical_insurance_price, _ := c.GetFloat("medical_insurance_price")
748 747
 	//private_price, _ := c.GetFloat("private_price")
749
-	settle_accounts_type, _ := c.GetInt64("settle_accounts_type")
750
-	admin_user_id, _ := c.GetInt64("admin_user_id")
751
-
752
-	timeLayout := "2006-01-02"
753
-	loc, _ := time.LoadLocation("Local")
754
-	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
755
-	if err != nil {
756
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
757
-		return
758
-	}
759
-	recordDateTime := theTime.Unix()
760
-	adminUser := c.GetAdminUserInfo()
748
+	//settle_accounts_type, _ := c.GetInt64("settle_accounts_type")
749
+	//admin_user_id, _ := c.GetInt64("admin_user_id")
761 750
 
751
+	//timeLayout := "2006-01-02"
752
+	//loc, _ := time.LoadLocation("Local")
753
+	//theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
754
+	//if err != nil {
755
+	//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
756
+	//	return
757
+	//}
758
+	//recordDateTime := theTime.Unix()
759
+	//adminUser := c.GetAdminUserInfo()
762 760
 	//
763
-	var prescriptions []*models.HisPrescription
761
+	////
762
+	//var prescriptions []*models.HisPrescription
763
+	////
764 764
 	//
765
-
766
-	data := make(map[string]interface{})
767
-	if settle_accounts_type == 1 { //日结
768
-		prescriptions, _ = service.GetHisPrescription(adminUser.CurrentOrgId, id, recordDateTime)
769
-		data["pre"] = prescriptions
770
-
771
-	} else { //月结
772
-		start_time_str := c.GetString("start_time")
773
-		end_time_str := c.GetString("end_time")
774
-		timeLayout := "2006-01-02"
775
-		loc, _ := time.LoadLocation("Local")
776
-		theStartTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_str+" 00:00:00", loc)
777
-		if err != nil {
778
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
779
-			return
780
-		}
781
-		recordStartTime := theStartTime.Unix()
782
-		theEndTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_str+" 00:00:00", loc)
783
-		if err != nil {
784
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
785
-			return
786
-		}
787
-		recordEndTime := theEndTime.Unix()
788
-		prescriptions, _ = service.GetMonthHisPrescription(adminUser.CurrentOrgId, id, recordStartTime, recordEndTime)
789
-		data["pre"] = prescriptions
790
-
791
-	}
792
-
793
-	roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
794
-	his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, id, recordDateTime)
765
+	//data := make(map[string]interface{})
766
+	//if settle_accounts_type == 1 { //日结
767
+	//	prescriptions, _ = service.GetHisPrescription(adminUser.CurrentOrgId, id, recordDateTime)
768
+	//	data["pre"] = prescriptions
769
+	//
770
+	//} else { //月结
771
+	//	start_time_str := c.GetString("start_time")
772
+	//	end_time_str := c.GetString("end_time")
773
+	//	timeLayout := "2006-01-02"
774
+	//	loc, _ := time.LoadLocation("Local")
775
+	//	theStartTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_str+" 00:00:00", loc)
776
+	//	if err != nil {
777
+	//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
778
+	//		return
779
+	//	}
780
+	//	recordStartTime := theStartTime.Unix()
781
+	//	theEndTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_str+" 00:00:00", loc)
782
+	//	if err != nil {
783
+	//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
784
+	//		return
785
+	//	}
786
+	//	recordEndTime := theEndTime.Unix()
787
+	//	prescriptions, _ = service.GetMonthHisPrescription(adminUser.CurrentOrgId, id, recordStartTime, recordEndTime)
788
+	//	data["pre"] = prescriptions
789
+	//
790
+	//}
791
+	//
792
+	//roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
793
+	//his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, id, recordDateTime)
795 794
 	timestamp := time.Now().Unix()
796 795
 	tempTime := time.Unix(timestamp, 0)
797 796
 	timeFormat := tempTime.Format("20060102150405")
798
-	chrgBchno := rand.Intn(100000) + 10000
799
-	chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) + strconv.FormatInt(his.PatientId, 10)
797
+	chrgBchno := rand.Intn(10000) + 1000
798
+	chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) + strconv.FormatInt(1, 10)
800 799
 	//miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
801 800
 	//patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, id, recordDateTime)
802 801
 	//department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
803
-	strconv.FormatInt(his.PatientId, 10)
802
+	//strconv.FormatInt(his.PatientId, 10)
804 803
 
805 804
 	month := time.Unix(1557042972, 0).Format("1")
806 805
 	year := time.Now().Format("2006")
@@ -808,84 +807,100 @@ func (c *SZHisApiController) GetUploadInfo() {
808 807
 	day := time.Now().Format("02")
809 808
 
810 809
 	var customs []*models.CustomDetail
811
-
812
-	for _, item := range prescriptions {
813
-		if item.Type == 1 { //药品
814
-			for _, subItem := range item.HisDoctorAdviceInfo {
815
-				if len(subItem.BaseDrugLib.MedicalInsuranceNumber) > 0 {
816
-					//var randNum int
817
-					//randNum = rand.Intn(10000) + 1000
818
-					detItemFeeSumamt, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", subItem.Price*subItem.PrescribingNumber), 64)
819
-					price, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", subItem.Price), 64)
820
-					cus := &models.CustomDetail{
821
-						PrescriptionNumber: chrg_bchno,
822
-						OrderType:          "1",
823
-						ChargeSerialNumber: subItem.FeedetlSn,
824
-						Code:               subItem.BaseDrugLib.MedicalInsuranceNumber,
825
-						CodeName:           subItem.BaseDrugLib.DrugName,
826
-						Flag:               "1",
827
-						Price:              price,
828
-						Count:              subItem.PrescribingNumber,
829
-						ChargeOrderDate:    year + month + day,
830
-						DoctorCode:         "H24962918",
831
-						Total:              detItemFeeSumamt,
832
-					}
833
-					customs = append(customs, cus)
834
-				}
835
-			}
836
-		}
837
-
838
-		if item.Type == 2 { //项目
839
-			for _, subItem := range item.HisPrescriptionProject {
840
-				//var randNum int
841
-				//randNum = rand.Intn(10000) + 1000
842
-				if len(subItem.HisProject.MedicalCode) > 0 {
843
-					detItemFeeSumamt, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)), 64)
844
-
845
-					count, _ := strconv.ParseFloat(fmt.Sprintf("%f", subItem.Count), 64)
846
-
847
-					cus := &models.CustomDetail{
848
-
849
-						PrescriptionNumber: chrg_bchno,
850
-						OrderType:          "1",
851
-						ChargeSerialNumber: subItem.FeedetlSn,
852
-						Code:               subItem.HisProject.MedicalCode,
853
-						CodeName:           subItem.HisProject.ProjectName,
854
-						Flag:               "1",
855
-						Price:              subItem.Price,
856
-						Count:              count,
857
-						ChargeOrderDate:    year + month + day,
858
-						DoctorCode:         "H24962918",
859
-						Total:              detItemFeeSumamt,
860
-					}
861
-					customs = append(customs, cus)
862
-				}
863
-			}
864
-		}
865
-
866
-		for _, subItem := range item.HisAdditionalCharge {
867
-			if len(subItem.XtHisAddtionConfig.Code) > 0 {
868
-				detItemFeeSumamt, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)), 64)
869
-
870
-				count, _ := strconv.ParseFloat(fmt.Sprintf("%f", subItem.Count), 64)
871
-				cus := &models.CustomDetail{
872
-					PrescriptionNumber: chrg_bchno,
873
-					OrderType:          "1",
874
-					ChargeSerialNumber: subItem.FeedetlSn,
875
-					Code:               subItem.XtHisAddtionConfig.Code,
876
-					CodeName:           subItem.XtHisAddtionConfig.Name,
877
-					Flag:               "1",
878
-					Price:              subItem.Price,
879
-					Count:              count,
880
-					ChargeOrderDate:    year + month + day,
881
-					DoctorCode:         "H24962918",
882
-					Total:              detItemFeeSumamt,
883
-				}
884
-				customs = append(customs, cus)
885
-			}
810
+	for i := 0; i < 1; i++ {
811
+		cus := &models.CustomDetail{
812
+			PrescriptionNumber: chrg_bchno,
813
+			OrderType:          "1",
814
+			ChargeSerialNumber: strconv.FormatInt(int64(rand.Intn(100000)+10000), 10),
815
+			Code:               "86901187000367",
816
+			CodeName:           "普瑞巴林胶囊剂",
817
+			Flag:               "1",
818
+			Price:              12.50,
819
+			Count:              1,
820
+			ChargeOrderDate:    year + month + day,
821
+			DoctorCode:         "H24962918",
822
+			Total:              12.50,
886 823
 		}
824
+		customs = append(customs, cus)
887 825
 	}
888 826
 
827
+	//for _, item := range prescriptions {
828
+	//	if item.Type == 1 { //药品
829
+	//		for _, subItem := range item.HisDoctorAdviceInfo {
830
+	//			if len(subItem.BaseDrugLib.MedicalInsuranceNumber) > 0 {
831
+	//				//var randNum int
832
+	//				//randNum = rand.Intn(10000) + 1000
833
+	//				detItemFeeSumamt, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", subItem.Price*subItem.PrescribingNumber), 64)
834
+	//				price, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", subItem.Price), 64)
835
+	//				cus := &models.CustomDetail{
836
+	//					PrescriptionNumber: chrg_bchno,
837
+	//					OrderType:          "1",
838
+	//					ChargeSerialNumber: subItem.FeedetlSn,
839
+	//					Code:               subItem.BaseDrugLib.MedicalInsuranceNumber,
840
+	//					CodeName:           subItem.BaseDrugLib.DrugName,
841
+	//					Flag:               "1",
842
+	//					Price:              price,
843
+	//					Count:              subItem.PrescribingNumber,
844
+	//					ChargeOrderDate:    year + month + day,
845
+	//					DoctorCode:         "H24962918",
846
+	//					Total:              detItemFeeSumamt,
847
+	//				}
848
+	//				customs = append(customs, cus)
849
+	//			}
850
+	//		}
851
+	//	}
852
+	//
853
+	//	if item.Type == 2 { //项目
854
+	//		for _, subItem := range item.HisPrescriptionProject {
855
+	//			//var randNum int
856
+	//			//randNum = rand.Intn(10000) + 1000
857
+	//			if len(subItem.HisProject.MedicalCode) > 0 {
858
+	//				detItemFeeSumamt, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)), 64)
859
+	//
860
+	//				count, _ := strconv.ParseFloat(fmt.Sprintf("%f", subItem.Count), 64)
861
+	//
862
+	//				cus := &models.CustomDetail{
863
+	//
864
+	//					PrescriptionNumber: chrg_bchno,
865
+	//					OrderType:          "1",
866
+	//					ChargeSerialNumber: subItem.FeedetlSn,
867
+	//					Code:               subItem.HisProject.MedicalCode,
868
+	//					CodeName:           subItem.HisProject.ProjectName,
869
+	//					Flag:               "1",
870
+	//					Price:              subItem.Price,
871
+	//					Count:              count,
872
+	//					ChargeOrderDate:    year + month + day,
873
+	//					DoctorCode:         "H24962918",
874
+	//					Total:              detItemFeeSumamt,
875
+	//				}
876
+	//				customs = append(customs, cus)
877
+	//			}
878
+	//		}
879
+	//	}
880
+	//
881
+	//	for _, subItem := range item.HisAdditionalCharge {
882
+	//		if len(subItem.XtHisAddtionConfig.Code) > 0 {
883
+	//			detItemFeeSumamt, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)), 64)
884
+	//
885
+	//			count, _ := strconv.ParseFloat(fmt.Sprintf("%f", subItem.Count), 64)
886
+	//			cus := &models.CustomDetail{
887
+	//				PrescriptionNumber: chrg_bchno,
888
+	//				OrderType:          "1",
889
+	//				ChargeSerialNumber: subItem.FeedetlSn,
890
+	//				Code:               subItem.XtHisAddtionConfig.Code,
891
+	//				CodeName:           subItem.XtHisAddtionConfig.Name,
892
+	//				Flag:               "1",
893
+	//				Price:              subItem.Price,
894
+	//				Count:              count,
895
+	//				ChargeOrderDate:    year + month + day,
896
+	//				DoctorCode:         "H24962918",
897
+	//				Total:              detItemFeeSumamt,
898
+	//			}
899
+	//			customs = append(customs, cus)
900
+	//		}
901
+	//	}
902
+	//}
903
+
889 904
 	//分页处理
890 905
 	//ToLimitOffset(50,1,len())
891 906
 	//pages := 50 / len(customs)
@@ -910,36 +925,36 @@ func (c *SZHisApiController) GetUploadInfo() {
910 925
 		//这里就可以查看开始和结束了
911 926
 		fmt.Println(customs[start-1 : stop])
912 927
 
913
-		result := service.SzybFY001(roles.UserName, strconv.FormatInt(roles.ID, 10), "G5540", customs, "000000|da09d0aac76bcf6552be41356ddbbaec")
914
-		fmt.Println(curpage)
915
-		fmt.Println(":")
916
-		fmt.Println(result)
917
-	}
918
-
919
-	var total float64
920
-	for _, item := range prescriptions {
921
-		if item.Type == 1 { //药品
922
-			for _, subItem := range item.HisDoctorAdviceInfo {
923
-				total = total + (subItem.Price * subItem.PrescribingNumber)
924
-			}
925
-		}
926
-		if item.Type == 2 { //项目
927
-			for _, subItem := range item.HisPrescriptionProject {
928
-				total = total + (subItem.Price * float64(subItem.Count))
929
-			}
930
-		}
928
+		//result := service.SzybFY001("黄亦轩", "1001", "G5540", customs, "000000|c0ccb063d7b0846b0945590520ae1668")
929
+		//fmt.Println("result")
930
+		//fmt.Println(":")
931
+		//fmt.Println(result)
931 932
 	}
932 933
 
933
-	for _, item := range prescriptions {
934
-		for _, subItem := range item.HisAdditionalCharge {
935
-			total = total + (subItem.Price * float64(subItem.Count))
936
-		}
937
-	}
938
-	totals, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", total), 64)
939
-	result := service.SzybFY004(roles.UserName, strconv.FormatInt(roles.ID, 10), "G5540", "", totals, chrg_bchno, "000000|da09d0aac76bcf6552be41356ddbbaec")
934
+	//var total float64
935
+	//for _, item := range prescriptions {
936
+	//	if item.Type == 1 { //药品
937
+	//		for _, subItem := range item.HisDoctorAdviceInfo {
938
+	//			total = total + (subItem.Price * subItem.PrescribingNumber)
939
+	//		}
940
+	//	}
941
+	//	if item.Type == 2 { //项目
942
+	//		for _, subItem := range item.HisPrescriptionProject {
943
+	//			total = total + (subItem.Price * float64(subItem.Count))
944
+	//		}
945
+	//	}
946
+	//}
947
+	//
948
+	//for _, item := range prescriptions {
949
+	//	for _, subItem := range item.HisAdditionalCharge {
950
+	//		total = total + (subItem.Price * float64(subItem.Count))
951
+	//	}
952
+	//}
953
+	//totals, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", total), 64)
954
+	result := service.SzybFY004("黄亦轩", "H24962918", "G5540", "", 12.50, chrg_bchno, "000000|abacf56c397f74c0fb603ee09b4f61fb")
940 955
 	fmt.Println(result)
941
-
942
-	results := service.SzybFY005(roles.UserName, strconv.FormatInt(roles.ID, 10), "G5540", "", totals, chrg_bchno, "000000|da09d0aac76bcf6552be41356ddbbaec")
956
+	//
957
+	results := service.SzybFY005("黄亦轩", "H24962918", "G5540", "", 12.50, chrg_bchno, "000000|abacf56c397f74c0fb603ee09b4f61fb")
943 958
 	fmt.Println(results)
944 959
 
945 960
 	//client := &http.Client{}

+ 69 - 27
service/sz_his_service.go Voir le fichier

@@ -18,13 +18,26 @@ func SzybMZ002(doctor string, doctor_code string, fixmedins_code string, dept_co
18 18
 	inputData := make(map[string]interface{})
19 19
 	inputMessage["transType"] = "MZ002" // 交易编码
20 20
 
21
-	inputData["akc190"] = inputMessage["serialNumber"]
21
+	inputData["akc190"] = "G554020210305"
22 22
 	inputData["aaz500"] = account
23 23
 	inputData["bzz269"] = "000000"
24 24
 	inputData["aka130"] = "11"
25 25
 	inputData["akf001"] = dept_code
26 26
 	inputData["bkc368"] = "2"
27
-	inputData["akc264"] = 0.00
27
+	inputData["akc264"] = 10.00
28
+	inputData["listsize"] = 1
29
+
30
+	feedetail := make([]map[string]interface{}, 0)
31
+	feedetailInfo := make(map[string]interface{})
32
+	feedetailInfo["aae072"] = "202123242526272829"
33
+	feedetailInfo["bkf500"] = "202123242526272829"
34
+	feedetailInfo["ake001"] = "110100002"
35
+	feedetailInfo["ake005"] = "110100002"
36
+	feedetailInfo["ake006"] = "普通门诊诊查费"
37
+	feedetailInfo["aae019"] = "10.00"
38
+	feedetail = append(feedetail, feedetailInfo)
39
+	inputData["inputlist"] = feedetail
40
+
28 41
 	inputData["bke384"] = inputMessage["serialNumber"]
29 42
 	inputMessage["transBody"] = inputData
30 43
 	bytesData, err := json.Marshal(inputMessage)
@@ -34,7 +47,7 @@ func SzybMZ002(doctor string, doctor_code string, fixmedins_code string, dept_co
34 47
 		return err.Error()
35 48
 	}
36 49
 	reader := bytes.NewReader(bytesData)
37
-	url := "http://192.168.1.99:10000"
50
+	url := "http://192.168.1.228:17001/szsi-portal/transData"
38 51
 	request, err := http.NewRequest("POST", url, reader)
39 52
 	if err != nil {
40 53
 		fmt.Println(err.Error())
@@ -62,10 +75,11 @@ func SzybFY001(doctor string, doctor_code string, fixmedins_code string, datas [
62 75
 	// 生成输入报文
63 76
 	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code)
64 77
 	inputData := make(map[string]interface{})
65
-	inputMessage["transType"] = "FY002" // 交易编码
78
+	inputMessage["transType"] = "FY001" // 交易编码
79
+	inputMessage["transChannel"] = "10" // 交易编码
66 80
 
67
-	inputData["akc190"] = inputMessage["serialNumber"]
68
-	inputData["bke384"] = inputMessage["serialNumber"]
81
+	inputData["akc190"] = "G554020210305"
82
+	inputData["bke384"] = "G5540202103316180298"
69 83
 	inputData["listsize"] = len(datas)
70 84
 
71 85
 	feedetail := make([]map[string]interface{}, 0)
@@ -77,6 +91,10 @@ func SzybFY001(doctor string, doctor_code string, fixmedins_code string, datas [
77 91
 		feedetailInfo["bkf500"] = item.ChargeSerialNumber
78 92
 		feedetailInfo["ake001"] = item.Code
79 93
 		feedetailInfo["ake002"] = item.CodeName
94
+		feedetailInfo["bkm017"] = item.Code
95
+		feedetailInfo["aka070"] = "E001"
96
+		feedetailInfo["aka074"] = "75mg"
97
+
80 98
 		feedetailInfo["aka064"] = 0
81 99
 		feedetailInfo["ake005"] = item.Code
82 100
 		feedetailInfo["ake006"] = item.CodeName
@@ -84,13 +102,16 @@ func SzybFY001(doctor string, doctor_code string, fixmedins_code string, datas [
84 102
 		feedetailInfo["akc226"] = item.Count
85 103
 		feedetailInfo["aka067"] = "元"
86 104
 		feedetailInfo["akc271"] = item.ChargeOrderDate
87
-		feedetailInfo["bkc320"] = item.DoctorCode
105
+		feedetailInfo["bkc320"] = "H24962918"
88 106
 		feedetailInfo["akc264"] = item.Total
89 107
 
90 108
 		feedetail = append(feedetail, feedetailInfo)
91 109
 	}
92 110
 	inputData["inputlist"] = feedetail
93 111
 	inputMessage["transBody"] = inputData
112
+
113
+	fmt.Println(inputMessage)
114
+
94 115
 	bytesData, err := json.Marshal(inputMessage)
95 116
 	fmt.Println(string(bytesData))
96 117
 	if err != nil {
@@ -98,7 +119,9 @@ func SzybFY001(doctor string, doctor_code string, fixmedins_code string, datas [
98 119
 		return err.Error()
99 120
 	}
100 121
 	reader := bytes.NewReader(bytesData)
101
-	url := "http://192.168.1.99:10000"
122
+	//url := "http://192.168.1.99:10000"
123
+	url := "http://192.168.1.228:17001/szsi-portal/transData"
124
+
102 125
 	request, err := http.NewRequest("POST", url, reader)
103 126
 	if err != nil {
104 127
 		fmt.Println(err.Error())
@@ -128,8 +151,8 @@ func SzybFY002(doctor string, doctor_code string, fixmedins_code string, datas [
128 151
 	inputData := make(map[string]interface{})
129 152
 	inputMessage["transType"] = "FY002" // 交易编码
130 153
 
131
-	inputData["akc190"] = inputMessage["serialNumber"]
132
-	inputData["bke384"] = inputMessage["serialNumber"]
154
+	inputData["akc190"] = "G554020210305"
155
+	inputData["bke384"] = "G5540202103316180298"
133 156
 	inputData["listsize"] = len(datas)
134 157
 
135 158
 	feedetail := make([]map[string]interface{}, 0)
@@ -150,7 +173,9 @@ func SzybFY002(doctor string, doctor_code string, fixmedins_code string, datas [
150 173
 		return err.Error()
151 174
 	}
152 175
 	reader := bytes.NewReader(bytesData)
153
-	url := "http://192.168.1.99:10000"
176
+	//url := "http://192.168.1.99:10000"
177
+	url := "http://192.168.1.228:17001/szsi-portal/transData"
178
+
154 179
 	request, err := http.NewRequest("POST", url, reader)
155 180
 	if err != nil {
156 181
 		fmt.Println(err.Error())
@@ -178,17 +203,16 @@ func SzybFY004(doctor string, doctor_code string, fixmedins_code string, dept_co
178 203
 	// 生成输入报文
179 204
 	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code)
180 205
 	inputData := make(map[string]interface{})
181
-	inputMessage["transType"] = "FY001" // 交易编码
182
-
183
-	inputData["akc190"] = inputMessage["serialNumber"]
206
+	inputMessage["transType"] = "2021033012131415" // 交易编码
184 207
 
208
+	inputData["akc190"] = "G554020210305"
185 209
 	inputData["aka130"] = "11"
186 210
 	inputData["bkc320"] = doctor_code
187 211
 	inputData["ckc350"] = doctor
188 212
 	inputData["aka030"] = "12"
189 213
 	inputData["akc264"] = total
190 214
 	inputData["ckc601"] = "0"
191
-	inputData["bke384"] = number
215
+	inputData["bke384"] = "G5540202103316180298"
192 216
 	inputMessage["transBody"] = inputData
193 217
 	bytesData, err := json.Marshal(inputMessage)
194 218
 	fmt.Println(string(bytesData))
@@ -197,7 +221,9 @@ func SzybFY004(doctor string, doctor_code string, fixmedins_code string, dept_co
197 221
 		return err.Error()
198 222
 	}
199 223
 	reader := bytes.NewReader(bytesData)
200
-	url := "http://192.168.1.99:10000"
224
+	//url := "http://192.168.1.99:10000"
225
+	url := "http://192.168.1.228:17001/szsi-portal/transData"
226
+
201 227
 	request, err := http.NewRequest("POST", url, reader)
202 228
 	if err != nil {
203 229
 		fmt.Println(err.Error())
@@ -229,7 +255,7 @@ func SzybFY005(doctor string, doctor_code string, fixmedins_code string, dept_co
229 255
 
230 256
 	inputData["aaz500"] = "%GAAFSAKSXSUKKWDKHDAD?;07734724145330238292?"
231 257
 	inputData["bzz269"] = "000000"
232
-	inputData["akc190"] = inputMessage["serialNumber"]
258
+	inputData["akc190"] = "2021033012131415"
233 259
 
234 260
 	inputData["aka130"] = "11"
235 261
 	inputData["bkc320"] = doctor_code
@@ -237,7 +263,7 @@ func SzybFY005(doctor string, doctor_code string, fixmedins_code string, dept_co
237 263
 	inputData["aka030"] = "12"
238 264
 	inputData["akc264"] = total
239 265
 	inputData["ckc601"] = "0"
240
-	inputData["bke384"] = number
266
+	inputData["bke384"] = "G5540202103316180298"
241 267
 
242 268
 	inputMessage["transBody"] = inputData
243 269
 
@@ -248,7 +274,9 @@ func SzybFY005(doctor string, doctor_code string, fixmedins_code string, dept_co
248 274
 		return err.Error()
249 275
 	}
250 276
 	reader := bytes.NewReader(bytesData)
251
-	url := "http://192.168.1.99:10000"
277
+	//url := "http://192.168.1.99:10000"
278
+	url := "http://192.168.1.228:17001/szsi-portal/transData"
279
+
252 280
 	request, err := http.NewRequest("POST", url, reader)
253 281
 	if err != nil {
254 282
 		fmt.Println(err.Error())
@@ -278,7 +306,7 @@ func SzybJY002(doctor string, doctor_code string, fixmedins_code string, dept_co
278 306
 	inputData := make(map[string]interface{})
279 307
 	inputMessage["transType"] = "JY002" // 交易编码
280 308
 
281
-	inputData["akc190"] = inputMessage["serialNumber"]
309
+	inputData["akc190"] = "2021033012131415"
282 310
 	inputData["bke384"] = number
283 311
 
284 312
 	inputMessage["transBody"] = inputData
@@ -289,7 +317,9 @@ func SzybJY002(doctor string, doctor_code string, fixmedins_code string, dept_co
289 317
 		return err.Error()
290 318
 	}
291 319
 	reader := bytes.NewReader(bytesData)
292
-	url := "http://192.168.1.99:10000"
320
+	//url := "http://192.168.1.99:10000"
321
+	url := "http://192.168.1.228:17001/szsi-portal/transData"
322
+
293 323
 	request, err := http.NewRequest("POST", url, reader)
294 324
 	if err != nil {
295 325
 		fmt.Println(err.Error())
@@ -320,8 +350,17 @@ func SetSZInputMessage(doctor string, doctor_code string, fixmedins_code string,
320 350
 	year := time.Now().Format("2006")
321 351
 	month = time.Now().Format("01")
322 352
 	day := time.Now().Format("02")
353
+
354
+	hour := time.Now().Format("15")
355
+	min := time.Now().Format("04")
356
+	sec := time.Now().Format("05")
357
+
358
+	msec := time.Now().Format("000")
359
+
323 360
 	// 生成输入报文
324 361
 	inputMessage := make(map[string]interface{})
362
+	//
363
+
325 364
 	inputMessage["cardArea"] = "440300" // 发卡地行政区划代码
326 365
 	inputMessage["extendDeviceId"] = ""
327 366
 	inputMessage["extendSerialNumber"] = ""
@@ -332,12 +371,15 @@ func SetSZInputMessage(doctor string, doctor_code string, fixmedins_code string,
332 371
 	inputMessage["operatorPass"] = ""             // 定点协议机构操作人员编码
333 372
 	inputMessage["serialNumber"] = fixmedins_code + year + month + day +
334 373
 		fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000)) // 定点协议机构编码(5位)+日期(8位)+流水号(7位)
335
-	inputMessage["transChannel"] = "10"                         //
336
-	inputMessage["transReturnCode"] = ""                        //
337
-	inputMessage["transReturnMessage"] = ""                     //
338
-	inputMessage["transTime"] = msToTime(time.Now().UnixNano()) //
339
-	inputMessage["transVersion"] = "V0.3"                       //
340
-	inputMessage["verifyCode"] = verify_code                    //
374
+	inputMessage["serialNumber"] = "G5540202103316180298"
375
+
376
+	inputMessage["transReturnCode"] = ""                                           //
377
+	inputMessage["transReturnMessage"] = ""                                        //
378
+	inputMessage["transTime"] = year + month + day + hour + min + sec + ":" + msec //
379
+	inputMessage["transVersion"] = "V0.3"                                          //
380
+	inputMessage["verifyCode"] = verify_code                                       //
381
+	inputMessage["transChannel"] = "10"                                            //
382
+
341 383
 	return inputMessage
342 384
 }
343 385
 func msToTime(ms int64) string {