test_user 1 kuukausi sitten
vanhempi
commit
888d3b5477

+ 75 - 3
controllers/js/jsyb_controller.go Näytä tiedosto

@@ -2476,7 +2476,7 @@ func (c *JSybController) ReadCard() {
2476 2476
 	case "4": //电子凭证
2477 2477
 		fmt.Println(operator_id)
2478 2478
 		fmt.Println(operator)
2479
-		_, pBusiCardInfo := c.GetELeCertInfoTwo(fixmedins_code, operator_id, operator)
2479
+		_, pBusiCardInfo :=GetELeCertInfoSettle(fixmedins_code, operator_id, operator)
2480 2480
 		fmt.Println(pBusiCardInfo)
2481 2481
 		pBusiCardInfo = Remove0000(pBusiCardInfo)
2482 2482
 		var ele ELeCertData
@@ -2518,13 +2518,17 @@ func (c *JSybController) ReadCard() {
2518 2518
 	case "5": //电子凭证
2519 2519
 		fmt.Println(operator_id)
2520 2520
 		fmt.Println(operator)
2521
-		_, pBusiCardInfo := c.GetELeCertInfoByFace(fixmedins_code, operator_id, operator, "01101")
2521
+		_, pBusiCardInfo := c.GetELeCertInfoByFaceTwoOne(fixmedins_code, operator_id, operator,"01101")
2522
+
2523
+
2524
+		//_, pBusiCardInfo := c.GetELeCertInfoByFace(fixmedins_code, operator_id, operator, "01101")
2522 2525
 		fmt.Println(pBusiCardInfo)
2523 2526
 		pBusiCardInfo = Remove0000(pBusiCardInfo)
2524 2527
 		var eletwo ELeCertDatatwo
2525 2528
 		json.Unmarshal([]byte(pBusiCardInfo), &eletwo)
2529
+		_, pBusiCardInfotwo := c.GetELeCertInfoByFaceTwoTwo(fixmedins_code, operator_id, operator, eletwo.Data.AuthNo, eletwo.Data.OutBizNo, "01301")
2526 2530
 
2527
-		_, pBusiCardInfotwo := GetELeCertInfoByFacetwo(fixmedins_code, operator_id, operator, eletwo.Data.AuthNo, eletwo.Data.OutBizNo, "01301")
2531
+		//_, pBusiCardInfotwo := GetELeCertInfoByFacetwo(fixmedins_code, operator_id, operator, eletwo.Data.AuthNo, eletwo.Data.OutBizNo, "01301")
2528 2532
 
2529 2533
 		var ele ELeCertDatathree
2530 2534
 		err2 := json.Unmarshal([]byte(pBusiCardInfotwo), &ele)
@@ -2832,6 +2836,40 @@ func (c *JSybController) GetELeCertInfoFour2223(code string, operator_id string,
2832 2836
 	return ConvertByte2String([]byte(DeleteExtraSpace(string(bytesData))), GB18030), ConvertByte2String([]byte(DeleteExtraSpace(string(pBusiCardInfo))), GB18030)
2833 2837
 }
2834 2838
 
2839
+
2840
+func (c *JSybController) GetELeCertInfoByFaceTwoOne(code string, operator_id string, operator_name string,businessType string) (string, string) {
2841
+	DllDef := syscall.MustLoadDLL("NationEcCode.dll")
2842
+	readCard := DllDef.MustFindProc("NationEcTrans")
2843
+
2844
+	pCardInfo := make([]byte, 2048)
2845
+	pBusiCardInfo := make([]byte, 2048)
2846
+	data := make(map[string]interface{})
2847
+
2848
+	inputData := make(map[string]interface{})
2849
+	inputData["orgId"] = code
2850
+	inputData["outBizNo"] = time.Now().Unix()
2851
+
2852
+	inputData["businessType"] = businessType
2853
+	inputData["operatorId"] = operator_id
2854
+	inputData["operatorName"] = operator_name
2855
+	inputData["officeId"] = "001"
2856
+	inputData["officeName"] = "血透室"
2857
+	data["data"] = inputData
2858
+	data["transType"] = "cn.nhsa.ec.auth"
2859
+	data["orgId"] = code
2860
+	bytesData, _ := json.Marshal(data)
2861
+	pCardInfo = bytesData
2862
+	pCardInfo = []byte(ConvertByte2String(pCardInfo, GB18030))
2863
+	ret2, _, _ := readCard.Call((uintptr)(unsafe.Pointer(&pCardInfo[0])), (uintptr)(unsafe.Pointer(&pBusiCardInfo[0])))
2864
+	fmt.Println(ret2)
2865
+	fmt.Println(":", ConvertToString(DeleteExtraSpace(string(bytesData)), "gbk", "utf-8"))
2866
+	fmt.Println(":", ConvertToString(DeleteExtraSpace(string(pBusiCardInfo)), "gbk", "utf-8"))
2867
+	if ret2 != 0 {
2868
+		return "", ""
2869
+	}
2870
+	return ConvertByte2String([]byte(DeleteExtraSpace(string(bytesData))), GB18030), ConvertByte2String([]byte(DeleteExtraSpace(string(pBusiCardInfo))), GB18030)
2871
+}
2872
+
2835 2873
 func (c *JSybController) GetELeCertInfoByFace(code string, operator_id string, operator_name string, businessType string) (string, string) {
2836 2874
 	// WebSocket服务器地址
2837 2875
 	serverURL := "ws://127.0.0.1:8899"
@@ -2880,6 +2918,40 @@ func (c *JSybController) GetELeCertInfoByFace(code string, operator_id string, o
2880 2918
 
2881 2919
 	return "", string(receivedMessage)
2882 2920
 }
2921
+func (c *JSybController) GetELeCertInfoByFaceTwoTwo(code string, operator_id string, operator_name string, authNo string, outBizNo string, businessType string)(string, string) {
2922
+	DllDef := syscall.MustLoadDLL("NationEcCode.dll")
2923
+	readCard := DllDef.MustFindProc("NationEcTrans")
2924
+
2925
+	pCardInfo := make([]byte, 2048)
2926
+	pBusiCardInfo := make([]byte, 2048)
2927
+	data := make(map[string]interface{})
2928
+
2929
+	inputData := make(map[string]interface{})
2930
+	inputData["orgId"] = code
2931
+	inputData["outBizNo"] = outBizNo
2932
+	inputData["businessType"] = businessType
2933
+	inputData["operatorId"] = operator_id
2934
+	inputData["operatorName"] = operator_name
2935
+	inputData["officeId"] = "001"
2936
+	inputData["officeName"] = "血透室"
2937
+	data["data"] = inputData
2938
+	data["transType"] = "cn.nhsa.auth.check"
2939
+	data["orgId"] = code
2940
+	bytesData, _ := json.Marshal(data)
2941
+	pCardInfo = bytesData
2942
+	pCardInfo = []byte(ConvertByte2String(pCardInfo, GB18030))
2943
+	ret2, _, _ := readCard.Call((uintptr)(unsafe.Pointer(&pCardInfo[0])), (uintptr)(unsafe.Pointer(&pBusiCardInfo[0])))
2944
+	fmt.Println(ret2)
2945
+	fmt.Println(":", ConvertToString(DeleteExtraSpace(string(bytesData)), "gbk", "utf-8"))
2946
+	fmt.Println(":", ConvertToString(DeleteExtraSpace(string(pBusiCardInfo)), "gbk", "utf-8"))
2947
+	if ret2 != 0 {
2948
+		return "", ""
2949
+	}
2950
+	return ConvertByte2String([]byte(DeleteExtraSpace(string(bytesData))), GB18030), ConvertByte2String([]byte(DeleteExtraSpace(string(pBusiCardInfo))), GB18030)
2951
+}
2952
+
2953
+
2954
+
2883 2955
 func GetELeCertInfoByFacetwo(code string, operator_id string, operator_name string, authNo string, outBizNo string, businessType string) (string, string) {
2884 2956
 	//	// WebSocket服务器地址
2885 2957
 	serverURL := "ws://127.0.0.1:8899"

+ 1 - 1
controllers/sg/gdyb_controller.go Näytä tiedosto

@@ -391,7 +391,7 @@ func (c *GdybController) PostSeven() {
391 391
 	id_card_type, _ := c.GetInt64("id_card_type")
392 392
 
393 393
 	certificates, _ := c.GetInt64("certificates")
394
-	result, log := service.Gdyb2206(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, operator, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, med_type, id_card_type, 0, 0, 0, 0, certificates,0)
394
+	result, log := service.Gdyb2206(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, operator, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, med_type, id_card_type, 0, 0, 0, 0, certificates,0,"0")
395 395
 	saveLogq(result, log, "2206", "预结算")
396 396
 
397 397
 	var dat map[string]interface{}

File diff suppressed because it is too large
+ 3034 - 3037
controllers/sg/his_api_controller.go


+ 3 - 3
controllers/zh/zh_his_api_controller.go Näytä tiedosto

@@ -1041,7 +1041,7 @@ func (c *ZHHisApiController) UploadLingBao() {
1041 1041
 
1042 1042
 			var result string
1043 1043
 			var requestLog string
1044
-			if miConfig.MdtrtareaAdmvs == "150499" {
1044
+			if miConfig.MdtrtareaAdmvs == "150404" {
1045 1045
 				data := make(map[string]interface{})
1046 1046
 				if record.MedType == 14 {
1047 1047
 					if record.InsutypeType == "390" {
@@ -1460,7 +1460,7 @@ func (c *ZHHisApiController) GetZHPatientInfo() {
1460 1460
 		var request_log string
1461 1461
 		var result_log string
1462 1462
 
1463
-		if miConfig.MdtrtareaAdmvs == "150499" {
1463
+		if miConfig.Code == "H15049901371" {
1464 1464
 			var insuplc_admdvs string
1465 1465
 			if len(patient.InsuplcAdmdvs) > 0 {
1466 1466
 				insuplc_admdvs = patient.InsuplcAdmdvs
@@ -1470,7 +1470,7 @@ func (c *ZHHisApiController) GetZHPatientInfo() {
1470 1470
 			//请求内网数据
1471 1471
 			api := "http://172.16.13.254:9532/" + "nmyb/1101?cert_no=" + patient.IdCardNo +
1472 1472
 				"&org_name=" + miConfig.OrgName + "&doctor=" + role.UserName + "&fixmedins_code=" + miConfig.Code +
1473
-				"&insuplc_admdvs=" + insuplc_admdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(2, 10) + "&card_sn=" + "" + "&certificates=" + strconv.FormatInt(1, 10) + "&name=" + patient.Name
1473
+				"&insuplc_admdvs=" + insuplc_admdvs + "&mdtrtarea_admvs=" + "150404" + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(2, 10) + "&card_sn=" + "" + "&certificates=" + strconv.FormatInt(1, 10) + "&name=" + patient.Name
1474 1474
 
1475 1475
 			resp, requestErr := http.Get(api)
1476 1476
 			if requestErr != nil {

+ 452 - 8
main.go Näytä tiedosto

@@ -58,13 +58,13 @@ type ResultEmpty10265 struct {
58 58
 func init() {
59 59
 	//service.ConnectNMMSDB()
60 60
 	service.ConnectDB()
61
-	org_id, _ := beego.AppConfig.Int64("org_id")
62
-	miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
63
-	//CreateLog(miConfig)
64
-	//UploadLog(miConfig)31
65
-	if org_id == 10191 {
66
-		service.GetFjAuthorizationInfo(miConfig.Code)
67
-	}
61
+	//org_id, _ := beego.AppConfig.Int64("org_id")
62
+	//miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
63
+	////CreateLog(miConfig)
64
+	////UploadLog(miConfig)31
65
+	//if org_id == 10191 {
66
+	//	service.GetFjAuthorizationInfo(miConfig.Code)
67
+	//}
68 68
 }
69 69
 func main() {
70 70
 	//service.AutoCreateStock()
@@ -78,6 +78,8 @@ func main() {
78 78
 	//深圳百霖
79 79
 	//GetblBatchSettleList()
80 80
 	//GetblpgBatchSettleList()
81
+	//GetgaBatchSettleList()
82
+	//GetlsBatchSettleList()
81 83
 
82 84
 	//GetblbrBatchSettleList()
83 85
 	//深圳百霖贝尔
@@ -709,10 +711,231 @@ type ResultSeventeen struct {
709 711
 //
710 712
 func GetblBatchSettleList() {
711 713
 	org_id, _ := beego.AppConfig.Int64("org_id")
712
-	org_id = 9504
714
+	org_id = 10138
713 715
 	var orders []*models.HisOrder
714 716
 	//var orders []*models.HisOrderError
715 717
 	orders, _ = service.GetAllHisOrder10138()
718
+	for _, item := range orders {
719
+		order_id := item.ID
720
+		order, _ := service.GetHisOrderByIDTwo(order_id)
721
+		if order.MedType == "14" {
722
+			his, _ := service.GetHisPatientByNumber(order.MdtrtId)
723
+			var patientPrescription models.HisPrescriptionInfo
724
+			patientPrescription, _ = service.FindLastPatientPrescriptionInfo(order.UserOrgId, order.PatientId, order.SettleAccountsDate)
725
+			doctor_info, _ := service.GetAdminUserInfoByID(order.UserOrgId, patientPrescription.DoctorId)
726
+			department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
727
+			miConfig, _ := service.FindMedicalInsuranceInfo(order.UserOrgId)
728
+			var configTwo []*models.HisXtDiagnoseConfig
729
+			diagnosis_idstwo := strings.Split(his.Diagnosis, ",")
730
+			curRoles, _ := service.GetAdminUserInfoByID(org_id, 2185)
731
+			for _, item := range diagnosis_idstwo {
732
+				id, _ := strconv.ParseInt(item, 10, 64)
733
+				diagnosisConfig, _ := service.FindDiagnoseById(id)
734
+				configTwo = append(configTwo, &diagnosisConfig)
735
+			}
736
+			patient, _ := service.GetPatientByIDTwo(10138, order.PatientId)
737
+
738
+			sickConfig, _ := service.FindSickById(his.SickType)
739
+			//if order.MedType == "1111" || order.MedType == "1112" {
740
+			//	order.MedType = "11"
741
+			//}
742
+			service.Gdyb2203d(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, "14", doctor_info.DoctorNumber, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, curRoles.UserName, configTwo, time.Unix(his.RecordDate, 0).Format("2006-01-02 15:04:05"))
743
+
744
+			depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
745
+			pre, _ := service.GetNewHisPrescriptionByNumber(order.Number)
746
+			doctor, _ := service.GetAdminUserInfoByID(org_id, pre.Creator)
747
+			if order.ID == 0 {
748
+				return
749
+			}
750
+			if his.BalanceAccountsType == 2 {
751
+				continue
752
+			}
753
+
754
+			ID := strconv.FormatInt(int64(order.ID), 10)
755
+
756
+			struct4101 := service.Struct4101{
757
+				PsnNo:          order.PsnNo,
758
+				MdtrtId:        order.MdtrtId,
759
+				SetlId:         order.SetlId,
760
+				PsnName:        order.PsnName,
761
+				Gend:           order.Gend,
762
+				Brdy:           his.Brdy,
763
+				Age:            his.Age,
764
+				Naty:           order.Naty,
765
+				PatnCertType:   order.PsnCertType,
766
+				Certno:         order.Certno,
767
+				Prfs:           "90",
768
+				ConerName:      "",
769
+				PatnRlts:       "",
770
+				ConerAddr:      "",
771
+				ConerTel:       "",
772
+				HiType:         order.Insutype,
773
+				Insuplc:        his.InsuplcAdmdvs,
774
+				MaindiagFlag:   "1",
775
+				BillCode:       "000"+ID,
776
+				BillNo:         "000"+ID,
777
+				BizSn:          order.Number,
778
+				PsnSelfPay:     order.PsnPartAmt,
779
+				PsnOwnPay:      order.PsnPartAmt,
780
+				AcctPay:        order.AcctPay,
781
+				PsnCashpay:     order.PsnCashPay,
782
+				HiPaymtd:       "1",
783
+				Hsorg:          his.InsuplcAdmdvs,
784
+				HsorgOpter:     his.InsuplcAdmdvs,
785
+				MedinsFillPsn:  curRoles.UserName,
786
+				MedinsFillDept: depart.Name,
787
+				IptMedType:     "2",
788
+				CurAddr:        patient.HomeAddress,
789
+			}
790
+
791
+			struct4101.SetlBegnDate = order.SetlTime
792
+			struct4101.SetlEndDate = order.SetlTime
793
+
794
+			var rf []CustomFundPay
795
+			json.Unmarshal([]byte(order.SetlDetail), &rf)
796
+
797
+			//var tempFunPays []service.CustomStruct
798
+			//var tempFunPay610100 service.CustomStruct
799
+
800
+			//for _, item := range rf {
801
+			//	if item.FundPayType == "610100" {
802
+			//		tempFunPay610100.FundPayamt, _ = decimal.NewFromFloat(tempFunPay610100.FundPayamt).Add(decimal.NewFromFloat(item.FundPayamt)).Float64()
803
+			//		tempFunPay610100.FundPayType = item.FundPayType
804
+			//	} else {
805
+			//		var tempFunPay service.CustomStruct
806
+			//		tempFunPay.FundPayamt = item.FundPayamt
807
+			//		tempFunPay.FundPayType = item.FundPayType
808
+			//		tempFunPays = append(tempFunPays, tempFunPay)
809
+			//	}
810
+			//}
811
+			//tempFunPays = append(tempFunPays, tempFunPay610100)
812
+			//struct4101.CustomStruct = tempFunPays
813
+
814
+			var tempDiaginfos []service.DiaginfoStructTwo
815
+			var tempOpspdiseinfo2 service.OpspdiseinfoStruct
816
+			var tempOpspdiseinfos []service.OpspdiseinfoStruct
817
+
818
+			diagnosis_ids := strings.Split(his.Diagnosis, ",")
819
+			var config []*models.HisXtDiagnoseConfig
820
+			for _, item := range diagnosis_ids {
821
+				id, _ := strconv.ParseInt(item, 10, 64)
822
+				if id == 24 {
823
+
824
+					diagnosisConfig, _ := service.FindDiagnoseById(id)
825
+					config = append(config, &diagnosisConfig)
826
+				}
827
+
828
+			}
829
+
830
+			for _, item := range diagnosis_ids {
831
+
832
+				id, _ := strconv.ParseInt(item, 10, 64)
833
+				if id != 24 {
834
+					diagnosisConfig, _ := service.FindDiagnoseById(id)
835
+					config = append(config, &diagnosisConfig)
836
+				}
837
+
838
+			}
839
+
840
+			for index, item := range config {
841
+				if index == 0 {
842
+					var tempDiaginfo service.DiaginfoStructTwo
843
+					tempDiaginfo.DiagCode = item.CountryCode
844
+					tempDiaginfo.DiagName = item.CountryContentName
845
+					tempDiaginfo.DiagType = "1"
846
+					tempDiaginfo.MaindiagFlag = "1"
847
+					tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
848
+				} else {
849
+
850
+					var tempDiaginfo service.DiaginfoStructTwo
851
+					tempDiaginfo.DiagCode = item.CountryCode
852
+					tempDiaginfo.DiagName = item.CountryContentName
853
+					tempDiaginfo.DiagType = "1"
854
+					tempDiaginfo.MaindiagFlag = "0"
855
+					tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
856
+				}
857
+			}
858
+			struct4101.Diseinfo = tempDiaginfos
859
+			sickConfigTwo, _ := service.FindSickById(his.SickType)
860
+			tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
861
+			tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
862
+			tempOpspdiseinfo2.OprnOprtCode = ""
863
+			tempOpspdiseinfo2.OprnOprtName = ""
864
+			tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
865
+			struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
866
+			time_arr := strings.Split(order.SetlTime, " ")
867
+			struct4101.AdmTime = time_arr[0]
868
+			struct4101.AdmEndTime = time_arr[0]
869
+			struct4101.DoctorName = doctor.UserName
870
+			struct4101.DoctorCode = doctor.DoctorNumber
871
+
872
+			struct4101.Ntly = "CHN"
873
+			struct4101.AdmCaty = "A03.06"
874
+			var res ResultSeventeen
875
+
876
+			result, request := service.Gdyb4101For10138(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, org_id)
877
+			fmt.Println(result)
878
+			saveLog(result, request, "4101A", "清单上传")
879
+			var dat map[string]interface{}
880
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
881
+				fmt.Println(dat)
882
+			} else {
883
+				fmt.Println(err)
884
+			}
885
+			userJSONBytes, _ := json.Marshal(dat)
886
+			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
887
+				//utils.ErrorLog("解析失败:%v", err)
888
+				//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
889
+				//adminUser := c.GetAdminUserInfo()
890
+				errlog := &models.HisOrderError{
891
+					UserOrgId: org_id,
892
+					Ctime:     time.Now().Unix(),
893
+					Mtime:     time.Now().Unix(),
894
+					ErrMsg:    res.ErrMsg + "解析失败",
895
+					Status:    1,
896
+					PatientId: order_id,
897
+					Stage:     10138600,
898
+				}
899
+				service.CreateErrMsgLog(errlog)
900
+				continue
901
+			}
902
+
903
+			if res.Infcode != 0 {
904
+				//adminUser := c.GetAdminUserInfo()
905
+				errlog := &models.HisOrderError{
906
+					UserOrgId: org_id,
907
+					Ctime:     time.Now().Unix(),
908
+					Mtime:     time.Now().Unix(),
909
+					ErrMsg:    res.ErrMsg,
910
+					Status:    1,
911
+					PatientId: order_id,
912
+					Stage:     10138600,
913
+				}
914
+				service.CreateErrMsgLog(errlog)
915
+				continue
916
+			} else {
917
+				hisFundSettleListResult := &models.HisFundSettleListResult{
918
+					Number:    res.Output.SetlListId,
919
+					Status:    1,
920
+					Ctime:     time.Now().Unix(),
921
+					Mtime:     time.Now().Unix(),
922
+					UserOrgId: org_id,
923
+					IsUpload:  1,
924
+					OrderId:   order_id,
925
+				}
926
+				service.CreateUploadRecord(hisFundSettleListResult)
927
+				continue
928
+			}
929
+		}
930
+	}
931
+}
932
+
933
+func GetgaBatchSettleList() {
934
+	org_id, _ := beego.AppConfig.Int64("org_id")
935
+	org_id = 9504
936
+	var orders []*models.HisOrder
937
+	//var orders []*models.HisOrderError
938
+	orders, _ = service.GetAllHisOrder9504()
716 939
 	for _, item := range orders {
717 940
 		order_id := item.ID
718 941
 		order, _ := service.GetHisOrderByIDTwo(order_id)
@@ -928,6 +1151,227 @@ func GetblBatchSettleList() {
928 1151
 	}
929 1152
 }
930 1153
 
1154
+func GetlsBatchSettleList() {
1155
+	org_id, _ := beego.AppConfig.Int64("org_id")
1156
+	org_id = 10028
1157
+	var orders []*models.HisOrder
1158
+	//var orders []*models.HisOrderError
1159
+	orders, _ = service.GetAllHisOrder10028()
1160
+	for _, item := range orders {
1161
+		order_id := item.ID
1162
+		order, _ := service.GetHisOrderByIDTwo(order_id)
1163
+		if order.MedType == "14" {
1164
+			his, _ := service.GetHisPatientByNumber(order.MdtrtId)
1165
+			var patientPrescription models.HisPrescriptionInfo
1166
+			patientPrescription, _ = service.FindLastPatientPrescriptionInfo(order.UserOrgId, order.PatientId, order.SettleAccountsDate)
1167
+			doctor_info, _ := service.GetAdminUserInfoByID(order.UserOrgId, patientPrescription.DoctorId)
1168
+			department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
1169
+			miConfig, _ := service.FindMedicalInsuranceInfo(order.UserOrgId)
1170
+			var configTwo []*models.HisXtDiagnoseConfig
1171
+			diagnosis_idstwo := strings.Split(his.Diagnosis, ",")
1172
+			curRoles, _ := service.GetAdminUserInfoByID(org_id, 5320)
1173
+			for _, item := range diagnosis_idstwo {
1174
+				id, _ := strconv.ParseInt(item, 10, 64)
1175
+				diagnosisConfig, _ := service.FindDiagnoseById(id)
1176
+				configTwo = append(configTwo, &diagnosisConfig)
1177
+			}
1178
+			patient, _ := service.GetPatientByIDTwo(10028, order.PatientId)
1179
+
1180
+			sickConfig, _ := service.FindSickById(his.SickType)
1181
+			//if order.MedType == "1111" || order.MedType == "1112" {
1182
+			//	order.MedType = "11"
1183
+			//}
1184
+			service.Gdyb2203d(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, "14", doctor_info.DoctorNumber, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, curRoles.UserName, configTwo, time.Unix(his.RecordDate, 0).Format("2006-01-02 15:04:05"))
1185
+
1186
+			depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
1187
+			pre, _ := service.GetNewHisPrescriptionByNumber(order.Number)
1188
+			doctor, _ := service.GetAdminUserInfoByID(org_id, pre.Creator)
1189
+			if order.ID == 0 {
1190
+				return
1191
+			}
1192
+			if his.BalanceAccountsType == 2 {
1193
+				continue
1194
+			}
1195
+
1196
+			ID := strconv.FormatInt(int64(order.ID), 10)
1197
+
1198
+			struct4101 := service.Struct4101{
1199
+				PsnNo:          order.PsnNo,
1200
+				MdtrtId:        order.MdtrtId,
1201
+				SetlId:         order.SetlId,
1202
+				PsnName:        order.PsnName,
1203
+				Gend:           order.Gend,
1204
+				Brdy:           his.Brdy,
1205
+				Age:            his.Age,
1206
+				Naty:           order.Naty,
1207
+				PatnCertType:   order.PsnCertType,
1208
+				Certno:         order.Certno,
1209
+				Prfs:           "90",
1210
+				ConerName:      "",
1211
+				PatnRlts:       "",
1212
+				ConerAddr:      "",
1213
+				ConerTel:       "",
1214
+				HiType:         order.Insutype,
1215
+				Insuplc:        his.InsuplcAdmdvs,
1216
+				MaindiagFlag:   "1",
1217
+				BillCode:       "000"+ID,
1218
+				BillNo:         "000"+ID,
1219
+				BizSn:          order.Number,
1220
+				PsnSelfPay:     order.PsnPartAmt,
1221
+				PsnOwnPay:      order.PsnPartAmt,
1222
+				AcctPay:        order.AcctPay,
1223
+				PsnCashpay:     order.PsnCashPay,
1224
+				HiPaymtd:       "1",
1225
+				Hsorg:          his.InsuplcAdmdvs,
1226
+				HsorgOpter:     his.InsuplcAdmdvs,
1227
+				MedinsFillPsn:  curRoles.UserName,
1228
+				MedinsFillDept: depart.Name,
1229
+				IptMedType:     "2",
1230
+				CurAddr:        patient.HomeAddress,
1231
+			}
1232
+
1233
+			struct4101.SetlBegnDate = order.SetlTime
1234
+			struct4101.SetlEndDate = order.SetlTime
1235
+
1236
+			var rf []CustomFundPay
1237
+			json.Unmarshal([]byte(order.SetlDetail), &rf)
1238
+
1239
+			//var tempFunPays []service.CustomStruct
1240
+			//var tempFunPay610100 service.CustomStruct
1241
+
1242
+			//for _, item := range rf {
1243
+			//	if item.FundPayType == "610100" {
1244
+			//		tempFunPay610100.FundPayamt, _ = decimal.NewFromFloat(tempFunPay610100.FundPayamt).Add(decimal.NewFromFloat(item.FundPayamt)).Float64()
1245
+			//		tempFunPay610100.FundPayType = item.FundPayType
1246
+			//	} else {
1247
+			//		var tempFunPay service.CustomStruct
1248
+			//		tempFunPay.FundPayamt = item.FundPayamt
1249
+			//		tempFunPay.FundPayType = item.FundPayType
1250
+			//		tempFunPays = append(tempFunPays, tempFunPay)
1251
+			//	}
1252
+			//}
1253
+			//tempFunPays = append(tempFunPays, tempFunPay610100)
1254
+			//struct4101.CustomStruct = tempFunPays
1255
+
1256
+			var tempDiaginfos []service.DiaginfoStructTwo
1257
+			var tempOpspdiseinfo2 service.OpspdiseinfoStruct
1258
+			var tempOpspdiseinfos []service.OpspdiseinfoStruct
1259
+
1260
+			diagnosis_ids := strings.Split(his.Diagnosis, ",")
1261
+			var config []*models.HisXtDiagnoseConfig
1262
+			for _, item := range diagnosis_ids {
1263
+				id, _ := strconv.ParseInt(item, 10, 64)
1264
+				if id == 24 {
1265
+
1266
+					diagnosisConfig, _ := service.FindDiagnoseById(id)
1267
+					config = append(config, &diagnosisConfig)
1268
+				}
1269
+
1270
+			}
1271
+
1272
+			for _, item := range diagnosis_ids {
1273
+
1274
+				id, _ := strconv.ParseInt(item, 10, 64)
1275
+				if id != 24 {
1276
+					diagnosisConfig, _ := service.FindDiagnoseById(id)
1277
+					config = append(config, &diagnosisConfig)
1278
+				}
1279
+
1280
+			}
1281
+
1282
+			for index, item := range config {
1283
+				if index == 0 {
1284
+					var tempDiaginfo service.DiaginfoStructTwo
1285
+					tempDiaginfo.DiagCode = item.CountryCode
1286
+					tempDiaginfo.DiagName = item.CountryContentName
1287
+					tempDiaginfo.DiagType = "1"
1288
+					tempDiaginfo.MaindiagFlag = "1"
1289
+					tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
1290
+				} else {
1291
+
1292
+					var tempDiaginfo service.DiaginfoStructTwo
1293
+					tempDiaginfo.DiagCode = item.CountryCode
1294
+					tempDiaginfo.DiagName = item.CountryContentName
1295
+					tempDiaginfo.DiagType = "1"
1296
+					tempDiaginfo.MaindiagFlag = "0"
1297
+					tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
1298
+				}
1299
+			}
1300
+			struct4101.Diseinfo = tempDiaginfos
1301
+			sickConfigTwo, _ := service.FindSickById(his.SickType)
1302
+			tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
1303
+			tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
1304
+			tempOpspdiseinfo2.OprnOprtCode = ""
1305
+			tempOpspdiseinfo2.OprnOprtName = ""
1306
+			tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
1307
+			struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
1308
+			time_arr := strings.Split(order.SetlTime, " ")
1309
+			struct4101.AdmTime = time_arr[0]
1310
+			struct4101.AdmEndTime = time_arr[0]
1311
+			struct4101.DoctorName = doctor.UserName
1312
+			struct4101.DoctorCode = doctor.DoctorNumber
1313
+
1314
+			struct4101.Ntly = "CHN"
1315
+			struct4101.AdmCaty = "A03.06"
1316
+			var res ResultSeventeen
1317
+
1318
+			result, request := service.Gdyb4101For10138(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, org_id)
1319
+			fmt.Println(result)
1320
+			saveLog(result, request, "4101A", "清单上传")
1321
+			var dat map[string]interface{}
1322
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
1323
+				fmt.Println(dat)
1324
+			} else {
1325
+				fmt.Println(err)
1326
+			}
1327
+			userJSONBytes, _ := json.Marshal(dat)
1328
+			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
1329
+				//utils.ErrorLog("解析失败:%v", err)
1330
+				//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1331
+				//adminUser := c.GetAdminUserInfo()
1332
+				errlog := &models.HisOrderError{
1333
+					UserOrgId: org_id,
1334
+					Ctime:     time.Now().Unix(),
1335
+					Mtime:     time.Now().Unix(),
1336
+					ErrMsg:    res.ErrMsg + "解析失败",
1337
+					Status:    1,
1338
+					PatientId: order_id,
1339
+					Stage:     10138600,
1340
+				}
1341
+				service.CreateErrMsgLog(errlog)
1342
+				continue
1343
+			}
1344
+
1345
+			if res.Infcode != 0 {
1346
+				//adminUser := c.GetAdminUserInfo()
1347
+				errlog := &models.HisOrderError{
1348
+					UserOrgId: org_id,
1349
+					Ctime:     time.Now().Unix(),
1350
+					Mtime:     time.Now().Unix(),
1351
+					ErrMsg:    res.ErrMsg,
1352
+					Status:    1,
1353
+					PatientId: order_id,
1354
+					Stage:     10138600,
1355
+				}
1356
+				service.CreateErrMsgLog(errlog)
1357
+				continue
1358
+			} else {
1359
+				hisFundSettleListResult := &models.HisFundSettleListResult{
1360
+					Number:    res.Output.SetlListId,
1361
+					Status:    1,
1362
+					Ctime:     time.Now().Unix(),
1363
+					Mtime:     time.Now().Unix(),
1364
+					UserOrgId: org_id,
1365
+					IsUpload:  1,
1366
+					OrderId:   order_id,
1367
+				}
1368
+				service.CreateUploadRecord(hisFundSettleListResult)
1369
+				continue
1370
+			}
1371
+		}
1372
+	}
1373
+}
1374
+
931 1375
 func GetblpgBatchSettleList() {
932 1376
 	org_id, _ := beego.AppConfig.Int64("org_id")
933 1377
 	org_id = 10610

+ 3 - 1
models/his_models.go Näytä tiedosto

@@ -242,7 +242,7 @@ type HisDoctorAdviceInfo struct {
242 242
 	IsUpload           int64 `gorm:"column:is_upload" json:"is_upload" form:"is_upload"`
243 243
 	ZeroFlag           int64 `gorm:"column:zero_flag" json:"zero_flag" form:"zero_flag"`
244 244
 
245
-
245
+	UploadDate            string   `gorm:"column:upload_date" json:"upload_date" form:"upload_date"`
246 246
 	BaseDrugLib BaseDrugLib `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug"`
247 247
 }
248 248
 
@@ -1477,6 +1477,8 @@ type HisDoctorAdviceInfoTen struct {
1477 1477
 	BaseDrugLib           BaseDrugLib  `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug"`
1478 1478
 	HisOrderInfo          HisOrderInfo `gorm:"ForeignKey:ID;AssociationForeignKey:AdviceId" json:"order_info"`
1479 1479
 	DrugWayCount          string       `gorm:"column:drug_way_count" json:"drug_way_count" form:"drug_way_count"`
1480
+	UploadDate            string   `gorm:"column:upload_date" json:"upload_date" form:"upload_date"`
1481
+
1480 1482
 }
1481 1483
 
1482 1484
 func (HisDoctorAdviceInfoTen) TableName() string {

+ 1 - 0
models/stock_models.go Näytä tiedosto

@@ -1361,6 +1361,7 @@ type BloodHisDoctorAdviceInfo struct {
1361 1361
 	LmtUsedFlag           int64                       `gorm:"column:lmt_used_flag" json:"lmt_used_flag" form:"lmt_used_flag"`
1362 1362
 	ExecutionFrequencyId  int64                       `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
1363 1363
 	DrugWayCount               string  `gorm:"column:drug_way_count" json:"drug_way_count" form:"drug_way_count"`
1364
+	UploadDate            string   `gorm:"column:upload_date" json:"upload_date" form:"upload_date"`
1364 1365
 
1365 1366
 }
1366 1367
 

+ 12 - 7
service/fj_service.go Näytä tiedosto

@@ -1999,7 +1999,7 @@ func Fjyb4101(struct4101 Struct4101, params models.PublicParams) (string, string
1999 1999
 	input["setlinfo"] = inputData
2000 2000
 	input["payinfo"] = payinfo
2001 2001
 	input["opspdiseinfo"] = opspdiseinfo
2002
-	input["diseinfo"] = diseinfo
2002
+	//input["diseinfo"] = diseinfo
2003 2003
 	input["iteminfo"] = iteminfo
2004 2004
 
2005 2005
 	inputMessage["input"] = input //交易输入
@@ -3206,13 +3206,12 @@ func FJyb3506(struct3506 models.Struct3506) (string, string, string) {
3206 3206
 	// 生成输入报文
3207 3207
 	input := make(map[string]interface{})
3208 3208
 	inputData := make(map[string]interface{})
3209
-	druginputData := make(map[string]interface{})
3210 3209
 	//druginputData2 := make(map[string]interface{})
3211 3210
 
3212 3211
 	inputMessage["infno"] = "3506"                                  // 交易编码
3213 3212
 	inputData["med_list_codg"] = struct3506.MedListCodg             // 定点医药机构目录编号
3214 3213
 	inputData["fixmedins_hilist_id"] = struct3506.FixmedinsHilistId // 定点医药机构目录编号
3215
-	inputData["fixmedins_hilist_name"] = struct3506.OrgName         // 定点医药机构目录名称
3214
+	inputData["fixmedins_hilist_name"] = struct3506.FixmedinsHilistName         // 定点医药机构目录名称
3216 3215
 	inputData["fixmedins_bchno"] = struct3506.FixmedinsBchno        // 人员编号 (来自1101接口返回)
3217 3216
 
3218 3217
 	inputData["setl_id"] = struct3506.SetlId                       // 人员编号 (来自1101接口返回)
@@ -3233,10 +3232,16 @@ func FJyb3506(struct3506 models.Struct3506) (string, string, string) {
3233 3232
 	inputData["medins_prod_sel_no"] = ""                           // 人员编号 (来自1101接口返回)
3234 3233
 	inputData["mdtrt_sn"] = struct3506.MdtrtSn                     // 人员编号 (来自1101接口返回)
3235 3234
 
3236
-	druginputData["drug_trac_codg"] = ""
3237
-	//druginputData2["drugtracinfo"] = druginputData
3238
-	inputData["drug_trac_info"] = druginputData
3239
-
3235
+	feedetail := make([]map[string]interface{}, 0)
3236
+	codes := strings.Split(struct3506.DrugTracCodg, ",")
3237
+	for _, item := range codes {
3238
+		if len(item) > 0 {
3239
+			druginputData := make(map[string]interface{})
3240
+			druginputData["drug_trac_codg"] =  removeNonDigits(item)
3241
+			feedetail = append(feedetail, druginputData)
3242
+		}
3243
+	}
3244
+	inputData["drug_trac_info"] = feedetail
3240 3245
 	input["selinfo"] = inputData
3241 3246
 	inputMessage["input"] = input //交易输入
3242 3247
 

+ 3 - 3
service/gdyb_service.go Näytä tiedosto

@@ -1590,7 +1590,7 @@ func Gdyb2205(psnNo string, mdtrtId string, chrgBchno string, org_name string, d
1590 1590
 //	门诊预结算
1591 1591
 //
1592 1592
 // func Gdyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, secret_key string) string {
1593
-func Gdyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, admin_user_id int64) (string, string) {
1593
+func Gdyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, admin_user_id int64,acct_used_flag string) (string, string) {
1594 1594
 
1595 1595
 	// 生成签名
1596 1596
 	nonce := GetRandomString(32)
@@ -1635,7 +1635,7 @@ func Gdyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
1635 1635
 	inputData["psn_setlway"] = "01"     // 个人结算方式 01 按项目结 02 按定额结算
1636 1636
 	inputData["mdtrt_id"] = mdtrtId     // 就诊 ID(来自2201接口返回)
1637 1637
 	inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的)
1638
-	inputData["acct_used_flag"] = "0"   // 个人账户使用标志 0否 1是
1638
+	inputData["acct_used_flag"] = acct_used_flag   // 个人账户使用标志 0否 1是
1639 1639
 	inputData["insutype"] = insutype    // 险种类型
1640 1640
 	inputData["invono"] = ""            // 发票号
1641 1641
 
@@ -2162,7 +2162,7 @@ func Gdyb3201(baseParams models.BaseParams, businessParams models.BusinessParams
2162 2162
 	gdyb_url := beego.AppConfig.String("gdyb_url")
2163 2163
 	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
2164 2164
 	var url string
2165
-	if baseParams.MdtrtareaAdmvs == "150499" || baseParams.MdtrtareaAdmvs == "450721" {
2165
+	if baseParams.MdtrtareaAdmvs == "150404" || baseParams.MdtrtareaAdmvs == "450721" {
2166 2166
 		url = gdyb_url
2167 2167
 	} else {
2168 2168
 		url = gdyb_url + "3201"

+ 2 - 3
service/gdyb_zifei_service.go Näytä tiedosto

@@ -632,7 +632,7 @@ func Gdyb4207(org_name string, doctor string, fixmedins_code string, insuplc_adm
632 632
 	signature := setSignature(timestamp, nonce, secret_key)
633 633
 	//生成输入报文
634 634
 	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
635
-	input := make(map[string]interface{})
635
+	//input := make(map[string]interface{})
636 636
 	inputData := make(map[string]interface{})
637 637
 	inputMessage["infno"] = "4207" // 交易编码
638 638
 
@@ -641,8 +641,7 @@ func Gdyb4207(org_name string, doctor string, fixmedins_code string, insuplc_adm
641 641
 	inputData["page_num"] = struct4207.PageNum                    // 人员姓名
642 642
 	inputData["page_size"] = struct4207.PageSize                  // 人员姓名
643 643
 
644
-	input["input"] = inputData
645
-	inputMessage["input"] = input //交易输入
644
+	inputMessage["input"] = inputData //交易输入
646 645
 
647 646
 	var inputLog string
648 647
 	bytesData, err := json.Marshal(inputMessage)

+ 31 - 10
service/his_service.go Näytä tiedosto

@@ -442,6 +442,13 @@ func GetAllDrugLibList(org_id int64) (list []*BaseDrugLib, err error) {
442 442
 	return
443 443
 }
444 444
 
445
+func GetDrugLibById(id int64) (list BaseDrugLib, err error) {
446
+	err = readDb.Model(&BaseDrugLib{}).
447
+		Where("id = ?  AND status = 1", id).First(&list).Error
448
+	return
449
+}
450
+
451
+
445 452
 func CreateAddtionalCharge(charge *models.HisAdditionalCharge) (err error) {
446 453
 	err = writeDb.Create(&charge).Error
447 454
 	return
@@ -1570,12 +1577,24 @@ func GetAllHisOrder10106(org_id int64) (his []*models.HisOrder, err error) {
1570 1577
 	return
1571 1578
 }
1572 1579
 func GetAllHisOrder10138() (his []*models.HisOrder, err error) {
1573
-	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 9504  AND status = 1  AND  order_status = 2 AND  setl_id <> '' AND setl_time >= '2025-02-01 00:00:00'  and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
1580
+	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10138  AND status = 1  AND  order_status = 2 AND  setl_id <> '' AND setl_time >= '2025-03-01 00:00:00'  and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
1581
+	fmt.Println(err)
1582
+	return
1583
+}
1584
+
1585
+func GetAllHisOrder9504() (his []*models.HisOrder, err error) {
1586
+	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 9504  AND status = 1  AND  order_status = 2 AND  setl_id <> '' AND setl_time >= '2025-03-01 00:00:00'  and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
1587
+	fmt.Println(err)
1588
+	return
1589
+}
1590
+
1591
+func GetAllHisOrder10028() (his []*models.HisOrder, err error) {
1592
+	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10028  AND status = 1  AND  order_status = 2 AND  setl_id <> '' AND setl_time >= '2025-02-01 00:00:00'  and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
1574 1593
 	fmt.Println(err)
1575 1594
 	return
1576 1595
 }
1577 1596
 func GetAllHisOrder10610() (his []*models.HisOrder, err error) {
1578
-	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10610  AND status = 1  AND  order_status = 2 AND  setl_id <> '' AND setl_time >= '2025-01-01 00:00:00'  and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
1597
+	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10610  AND status = 1  AND  order_status = 2 AND  setl_id <> '' AND setl_time >= '2025-03-01 00:00:00'  and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
1579 1598
 	fmt.Println(err)
1580 1599
 	return
1581 1600
 }
@@ -1586,7 +1605,7 @@ func GetOrderError10138() (order []*models.HisOrderError, err error) {
1586 1605
 
1587 1606
 func GetAllHisOrder10278() (his []*models.HisOrder, err error) {
1588 1607
 
1589
-	err = readDb.Model(&models.HisOrder{}).Where(" user_org_id = 10278  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND setl_time >= '2025-01-01 00:00:00'  and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
1608
+	err = readDb.Model(&models.HisOrder{}).Where(" user_org_id = 10278  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND setl_time >= '2025-03-01 00:00:00'  and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
1590 1609
 	fmt.Println(err)
1591 1610
 	return
1592 1611
 }
@@ -1766,10 +1785,10 @@ func GetNewDrugFlowInfo(org_id int64, id_arr []string) (flows []*models.DrugFlow
1766 1785
 	return
1767 1786
 }
1768 1787
 
1769
-func GetNewDrugFlowInfoByPatient(patient_id int64, drug_id int64, time int64, org_id int64) (flows []*models.DrugFlow, err error) {
1770
-	err = readDb.Model(&models.DrugFlow{}).Where("user_org_id = ? and status = 1  and patient_id = ? and drug_id = ? and system_time = ?", org_id, patient_id, drug_id, time).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1788
+func GetNewDrugFlowInfoByPatient( drug_id int64, time int64, org_id int64) (flows models.DrugFlow, err error) {
1789
+	err = readDb.Model(&models.DrugFlow{}).Where("user_org_id = ? and status = 1   and drug_id = ? and system_time = ?", org_id, drug_id, time).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1771 1790
 		return db.Where("status = 1").Preload("BaseDrugLib", "status=1")
1772
-	}).Preload("NewDrugWarehouseInfo", "status = 1").Find(&flows).Error
1791
+	}).Preload("NewDrugWarehouseInfo", "status = 1").Last(&flows).Error
1773 1792
 	return
1774 1793
 }
1775 1794
 
@@ -1860,10 +1879,10 @@ func GetDrugByID(drug_id int64) (drug models.BaseDrugLib, err error) {
1860 1879
 
1861 1880
 func GetDrugByIDTwo(drug_id int64,org_id int64) (drug []models.BaseDrugLib, err error) {
1862 1881
 	if drug_id == 0{
1863
-		err = readDb.Model(&models.BaseDrugLib{}).Where("org_id = ?", org_id).Find(&drug).Error
1882
+		err = readDb.Model(&models.BaseDrugLib{}).Where("org_id = ? and status = 1", org_id).Find(&drug).Error
1864 1883
 
1865 1884
 	}else{
1866
-		err = readDb.Model(&models.BaseDrugLib{}).Where("id = ?", drug_id).Find(&drug).Error
1885
+		err = readDb.Model(&models.BaseDrugLib{}).Where("id = ?  and status = 1", drug_id).Find(&drug).Error
1867 1886
 
1868 1887
 
1869 1888
 	}
@@ -1942,6 +1961,8 @@ type HisDoctorAdviceInfo struct {
1942 1961
 	ExecutionFrequencyId int64 `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
1943 1962
 	IsSelfDrug           int64 `gorm:"column:is_self_drug" json:"is_self_drug" form:"is_self_drug"`
1944 1963
 	IsUpload             int64 `gorm:"column:is_upload" json:"is_upload" form:"is_upload"`
1964
+	UploadDate            string   `gorm:"column:upload_date" json:"upload_date" form:"upload_date"`
1965
+
1945 1966
 }
1946 1967
 
1947 1968
 type Drug struct {
@@ -2204,8 +2225,8 @@ func FindUploadHisAdviceDocAdvice(orgid int64, patient_id int64, stime int64, et
2204 2225
 	return advice, err
2205 2226
 }
2206 2227
 
2207
-func SaveDoctoradviceStatus(id int64) {
2208
-	writeDb.Model(&models.HisDoctorAdviceInfo{}).Where("id = ?", id).Updates(map[string]interface{}{"is_upload": 1})
2228
+func SaveDoctoradviceStatus(id int64,upload_date string) {
2229
+	writeDb.Model(&models.HisDoctorAdviceInfo{}).Where("id = ?", id).Updates(map[string]interface{}{"is_upload": 1,"upload_date":upload_date})
2209 2230
 
2210 2231
 }
2211 2232
 

+ 1 - 1
service/zh_his_service.go Näytä tiedosto

@@ -84,7 +84,7 @@ func ZHGdyb1101(certNo string, org_name string, doctor string, fixmedins_code st
84 84
 	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
85 85
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
86 86
 	url := gdyb_url + "1101"
87
-	if mdtrtarea_admvs == "150499" {
87
+	if mdtrtarea_admvs == "150404" {
88 88
 		url = gdyb_url
89 89
 	}
90 90
 	if mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {