test_user 1 month ago
parent
commit
4245a734d9
4 changed files with 255 additions and 14 deletions
  1. 6 5
      controllers/sg/his_api_controller.go
  2. 233 5
      main.go
  3. 13 3
      service/his_service.go
  4. 3 1
      service/hn_service.go

+ 6 - 5
controllers/sg/his_api_controller.go View File

34
 	"syscall"
34
 	"syscall"
35
 	"time"
35
 	"time"
36
 	"unsafe"
36
 	"unsafe"
37
+	"github.com/go-ole/go-ole"
37
 )
38
 )
38
 
39
 
39
 type HisApiController struct {
40
 type HisApiController struct {
5895
 
5896
 
5896
 	}
5897
 	}
5897
 
5898
 
5898
-	if org_id == 10610 || org_id == 10278 || org_id == 10138 || org_id == 10537 || org_id == 10028 {
5899
+	if org_id == 10610 || org_id == 10278 || org_id == 10138 || org_id == 10537 || org_id == 10028 || org_id == 10191 {
5899
 
5900
 
5900
 		if drug.HisDoctorAdviceInfo.BaseDrugLib.IsZeroFlag == 1 {
5901
 		if drug.HisDoctorAdviceInfo.BaseDrugLib.IsZeroFlag == 1 {
5901
 			struct3505.TrdnFlag = "1"
5902
 			struct3505.TrdnFlag = "1"
28559
 					}
28560
 					}
28560
 					var result string
28561
 					var result string
28561
 					var requestLog string
28562
 					var requestLog string
28562
-					if miConfig.Code == "H44030501364" || miConfig.Code == "H44030903432" || miConfig.Code == "H44030500255" || miConfig.Code == "H44082500483" || miConfig.Code == "H44030702287" || miConfig.Code == "H44030304882" {
28563
+					if miConfig.Code == "H44030501364" || miConfig.Code == "H44030903432" || miConfig.Code == "H44030500255" || miConfig.Code == "H44082500483" || miConfig.Code == "H44030702287" || miConfig.Code == "H44030304882"  || miConfig.Code == "H44090200998"{
28563
 						var hisPrescription []*models.HisPrescription
28564
 						var hisPrescription []*models.HisPrescription
28564
 						res3101 := Checkgd3101ForOne(c, patient.ID, his, admin_user_id, "1", record_time, hisPrescription, department)
28565
 						res3101 := Checkgd3101ForOne(c, patient.ID, his, admin_user_id, "1", record_time, hisPrescription, department)
28565
 						if res3101.Infcode == 0 {
28566
 						if res3101.Infcode == 0 {
32220
 					}
32221
 					}
32221
 					result2, src_resquest = service.Gdyb2207(his.PsnNo, his.Number, chrg_bchno, cert_no, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, med_type, his.IdCardType, tempOrder.FulamtOwnpayAmt, tempOrder.OverlmtSelfPay, tempOrder.PreselfpayAmt, tempOrder.InscpScpAmt, his.IdType, acct_used_flag, "", admin_user_id)
32222
 					result2, src_resquest = service.Gdyb2207(his.PsnNo, his.Number, chrg_bchno, cert_no, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, med_type, his.IdCardType, tempOrder.FulamtOwnpayAmt, tempOrder.OverlmtSelfPay, tempOrder.PreselfpayAmt, tempOrder.InscpScpAmt, his.IdType, acct_used_flag, "", admin_user_id)
32222
 				} else {
32223
 				} else {
32223
-					if miConfig.Code == "H44030501364" || miConfig.Code == "H44030903432" || miConfig.Code == "H44030500255" || miConfig.Code == "H44082500483" || miConfig.Code == "H44030702287" || miConfig.Code == "H44030304882" {
32224
+					if miConfig.Code == "H44030501364" || miConfig.Code == "H44030903432" || miConfig.Code == "H44030500255" || miConfig.Code == "H44082500483" || miConfig.Code == "H44030702287" || miConfig.Code == "H44030304882" ||  miConfig.Code == "H44090200998"{
32224
 						result3101 := Checkgd3102(c, id, his_patient_id, admin_user_id, "7", tempOrder.ID)
32225
 						result3101 := Checkgd3102(c, id, his_patient_id, admin_user_id, "7", tempOrder.ID)
32225
 						if result3101.Infcode == 0 {
32226
 						if result3101.Infcode == 0 {
32226
 							if len(result3101.Output.Result) > 0 {
32227
 							if len(result3101.Output.Result) > 0 {
34245
 						res.Infcode = infocode
34246
 						res.Infcode = infocode
34246
 
34247
 
34247
 					} else {
34248
 					} else {
34248
-						if miConfig.Code == "H44030903432" || miConfig.Code == "H44030501364" || miConfig.Code == "H44030500255" || miConfig.Code == "H44082500483" || miConfig.Code == "H44030702287" || miConfig.Code == "H44030304882" {
34249
+						if miConfig.Code == "H44030903432" || miConfig.Code == "H44030501364" || miConfig.Code == "H44030500255" || miConfig.Code == "H44082500483" || miConfig.Code == "H44030702287" || miConfig.Code == "H44030304882" || miConfig.Code == "H44090200998" {
34249
 							result3101 := Checkgd3101(c, id, his_patient_id, admin_user_id, "2", record_time, prescriptions)
34250
 							result3101 := Checkgd3101(c, id, his_patient_id, admin_user_id, "2", record_time, prescriptions)
34250
 							if result3101.Infcode == 0 {
34251
 							if result3101.Infcode == 0 {
34251
 								if len(result3101.Output.Result) > 0 {
34252
 								if len(result3101.Output.Result) > 0 {
35947
 
35948
 
35948
 							psn_info, _ := service.GetPsnByPatientId(his.PatientId)
35949
 							psn_info, _ := service.GetPsnByPatientId(his.PatientId)
35949
 							allTotal = fmt.Sprintf("%.2f", total_two)
35950
 							allTotal = fmt.Sprintf("%.2f", total_two)
35950
-							if miConfig.Code == "H44030501364" || miConfig.Code == "H44030903432" || miConfig.Code == "H44030500255" || miConfig.Code == "H44082500483" || miConfig.Code == "H44030702287" || miConfig.Code == "H44030304882" {
35951
+							if miConfig.Code == "H44030501364" || miConfig.Code == "H44030903432" || miConfig.Code == "H44030500255" || miConfig.Code == "H44082500483" || miConfig.Code == "H44030702287" || miConfig.Code == "H44030304882" || miConfig.Code == "H44090200998" {
35951
 
35952
 
35952
 								result3101 := Checkgd3102(c, id, his_patient_id, admin_user_id, "6", order.ID)
35953
 								result3101 := Checkgd3102(c, id, his_patient_id, admin_user_id, "6", order.ID)
35953
 								if result3101.Infcode == 0 {
35954
 								if result3101.Infcode == 0 {

+ 233 - 5
main.go View File

77
 
77
 
78
 	//深圳百霖
78
 	//深圳百霖
79
 	//GetblBatchSettleList()
79
 	//GetblBatchSettleList()
80
+	//GetblpgBatchSettleList()
81
+
80
 	//GetblbrBatchSettleList()
82
 	//GetblbrBatchSettleList()
81
 	//深圳百霖贝尔
83
 	//深圳百霖贝尔
82
 	//GetblbrBatchSettleList()
84
 	//GetblbrBatchSettleList()
707
 //
709
 //
708
 func GetblBatchSettleList() {
710
 func GetblBatchSettleList() {
709
 	org_id, _ := beego.AppConfig.Int64("org_id")
711
 	org_id, _ := beego.AppConfig.Int64("org_id")
710
-	org_id = 10610
712
+	org_id = 9504
711
 	var orders []*models.HisOrder
713
 	var orders []*models.HisOrder
712
 	//var orders []*models.HisOrderError
714
 	//var orders []*models.HisOrderError
713
 	orders, _ = service.GetAllHisOrder10138()
715
 	orders, _ = service.GetAllHisOrder10138()
716
+	for _, item := range orders {
717
+		order_id := item.ID
718
+		order, _ := service.GetHisOrderByIDTwo(order_id)
719
+		if order.MedType == "14" {
720
+			his, _ := service.GetHisPatientByNumber(order.MdtrtId)
721
+			var patientPrescription models.HisPrescriptionInfo
722
+			patientPrescription, _ = service.FindLastPatientPrescriptionInfo(order.UserOrgId, order.PatientId, order.SettleAccountsDate)
723
+			doctor_info, _ := service.GetAdminUserInfoByID(order.UserOrgId, patientPrescription.DoctorId)
724
+			department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
725
+			miConfig, _ := service.FindMedicalInsuranceInfo(order.UserOrgId)
726
+			var configTwo []*models.HisXtDiagnoseConfig
727
+			diagnosis_idstwo := strings.Split(his.Diagnosis, ",")
728
+			curRoles, _ := service.GetAdminUserInfoByID(org_id, 5488)
729
+			for _, item := range diagnosis_idstwo {
730
+				id, _ := strconv.ParseInt(item, 10, 64)
731
+				diagnosisConfig, _ := service.FindDiagnoseById(id)
732
+				configTwo = append(configTwo, &diagnosisConfig)
733
+			}
734
+			patient, _ := service.GetPatientByIDTwo(9504, order.PatientId)
735
+
736
+			sickConfig, _ := service.FindSickById(his.SickType)
737
+			//if order.MedType == "1111" || order.MedType == "1112" {
738
+			//	order.MedType = "11"
739
+			//}
740
+			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"))
741
+
742
+			depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
743
+			pre, _ := service.GetNewHisPrescriptionByNumber(order.Number)
744
+			doctor, _ := service.GetAdminUserInfoByID(org_id, pre.Creator)
745
+			if order.ID == 0 {
746
+				return
747
+			}
748
+			if his.BalanceAccountsType == 2 {
749
+				continue
750
+			}
751
+
752
+			ID := strconv.FormatInt(int64(order.ID), 10)
753
+
754
+			struct4101 := service.Struct4101{
755
+				PsnNo:          order.PsnNo,
756
+				MdtrtId:        order.MdtrtId,
757
+				SetlId:         order.SetlId,
758
+				PsnName:        order.PsnName,
759
+				Gend:           order.Gend,
760
+				Brdy:           his.Brdy,
761
+				Age:            his.Age,
762
+				Naty:           order.Naty,
763
+				PatnCertType:   order.PsnCertType,
764
+				Certno:         order.Certno,
765
+				Prfs:           "90",
766
+				ConerName:      "",
767
+				PatnRlts:       "",
768
+				ConerAddr:      "",
769
+				ConerTel:       "",
770
+				HiType:         order.Insutype,
771
+				Insuplc:        his.InsuplcAdmdvs,
772
+				MaindiagFlag:   "1",
773
+				BillCode:       "000"+ID,
774
+				BillNo:         "000"+ID,
775
+				BizSn:          order.Number,
776
+				PsnSelfPay:     order.PsnPartAmt,
777
+				PsnOwnPay:      order.PsnPartAmt,
778
+				AcctPay:        order.AcctPay,
779
+				PsnCashpay:     order.PsnCashPay,
780
+				HiPaymtd:       "1",
781
+				Hsorg:          his.InsuplcAdmdvs,
782
+				HsorgOpter:     his.InsuplcAdmdvs,
783
+				MedinsFillPsn:  curRoles.UserName,
784
+				MedinsFillDept: depart.Name,
785
+				IptMedType:     "2",
786
+				CurAddr:        patient.HomeAddress,
787
+			}
788
+
789
+			struct4101.SetlBegnDate = order.SetlTime
790
+			struct4101.SetlEndDate = order.SetlTime
791
+
792
+			var rf []CustomFundPay
793
+			json.Unmarshal([]byte(order.SetlDetail), &rf)
794
+
795
+			//var tempFunPays []service.CustomStruct
796
+			//var tempFunPay610100 service.CustomStruct
797
+
798
+			//for _, item := range rf {
799
+			//	if item.FundPayType == "610100" {
800
+			//		tempFunPay610100.FundPayamt, _ = decimal.NewFromFloat(tempFunPay610100.FundPayamt).Add(decimal.NewFromFloat(item.FundPayamt)).Float64()
801
+			//		tempFunPay610100.FundPayType = item.FundPayType
802
+			//	} else {
803
+			//		var tempFunPay service.CustomStruct
804
+			//		tempFunPay.FundPayamt = item.FundPayamt
805
+			//		tempFunPay.FundPayType = item.FundPayType
806
+			//		tempFunPays = append(tempFunPays, tempFunPay)
807
+			//	}
808
+			//}
809
+			//tempFunPays = append(tempFunPays, tempFunPay610100)
810
+			//struct4101.CustomStruct = tempFunPays
811
+
812
+			var tempDiaginfos []service.DiaginfoStructTwo
813
+			var tempOpspdiseinfo2 service.OpspdiseinfoStruct
814
+			var tempOpspdiseinfos []service.OpspdiseinfoStruct
815
+
816
+			diagnosis_ids := strings.Split(his.Diagnosis, ",")
817
+			var config []*models.HisXtDiagnoseConfig
818
+			for _, item := range diagnosis_ids {
819
+				id, _ := strconv.ParseInt(item, 10, 64)
820
+				if id == 24 {
821
+
822
+					diagnosisConfig, _ := service.FindDiagnoseById(id)
823
+					config = append(config, &diagnosisConfig)
824
+				}
825
+
826
+			}
827
+
828
+			for _, item := range diagnosis_ids {
829
+
830
+				id, _ := strconv.ParseInt(item, 10, 64)
831
+				if id != 24 {
832
+					diagnosisConfig, _ := service.FindDiagnoseById(id)
833
+					config = append(config, &diagnosisConfig)
834
+				}
835
+
836
+			}
837
+
838
+			for index, item := range config {
839
+				if index == 0 {
840
+					var tempDiaginfo service.DiaginfoStructTwo
841
+					tempDiaginfo.DiagCode = item.CountryCode
842
+					tempDiaginfo.DiagName = item.CountryContentName
843
+					tempDiaginfo.DiagType = "1"
844
+					tempDiaginfo.MaindiagFlag = "1"
845
+					tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
846
+				} else {
847
+
848
+					var tempDiaginfo service.DiaginfoStructTwo
849
+					tempDiaginfo.DiagCode = item.CountryCode
850
+					tempDiaginfo.DiagName = item.CountryContentName
851
+					tempDiaginfo.DiagType = "1"
852
+					tempDiaginfo.MaindiagFlag = "0"
853
+					tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
854
+				}
855
+			}
856
+			struct4101.Diseinfo = tempDiaginfos
857
+			sickConfigTwo, _ := service.FindSickById(his.SickType)
858
+			tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
859
+			tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
860
+			tempOpspdiseinfo2.OprnOprtCode = ""
861
+			tempOpspdiseinfo2.OprnOprtName = ""
862
+			tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
863
+			struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
864
+			time_arr := strings.Split(order.SetlTime, " ")
865
+			struct4101.AdmTime = time_arr[0]
866
+			struct4101.AdmEndTime = time_arr[0]
867
+			struct4101.DoctorName = doctor.UserName
868
+			struct4101.DoctorCode = doctor.DoctorNumber
869
+
870
+			struct4101.Ntly = "CHN"
871
+			struct4101.AdmCaty = "A03.06"
872
+			var res ResultSeventeen
873
+
874
+			result, request := service.Gdyb4101For10138(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, org_id)
875
+			fmt.Println(result)
876
+			saveLog(result, request, "4101A", "清单上传")
877
+			var dat map[string]interface{}
878
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
879
+				fmt.Println(dat)
880
+			} else {
881
+				fmt.Println(err)
882
+			}
883
+			userJSONBytes, _ := json.Marshal(dat)
884
+			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
885
+				//utils.ErrorLog("解析失败:%v", err)
886
+				//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
887
+				//adminUser := c.GetAdminUserInfo()
888
+				errlog := &models.HisOrderError{
889
+					UserOrgId: org_id,
890
+					Ctime:     time.Now().Unix(),
891
+					Mtime:     time.Now().Unix(),
892
+					ErrMsg:    res.ErrMsg + "解析失败",
893
+					Status:    1,
894
+					PatientId: order_id,
895
+					Stage:     10138600,
896
+				}
897
+				service.CreateErrMsgLog(errlog)
898
+				continue
899
+			}
900
+
901
+			if res.Infcode != 0 {
902
+				//adminUser := c.GetAdminUserInfo()
903
+				errlog := &models.HisOrderError{
904
+					UserOrgId: org_id,
905
+					Ctime:     time.Now().Unix(),
906
+					Mtime:     time.Now().Unix(),
907
+					ErrMsg:    res.ErrMsg,
908
+					Status:    1,
909
+					PatientId: order_id,
910
+					Stage:     10138600,
911
+				}
912
+				service.CreateErrMsgLog(errlog)
913
+				continue
914
+			} else {
915
+				hisFundSettleListResult := &models.HisFundSettleListResult{
916
+					Number:    res.Output.SetlListId,
917
+					Status:    1,
918
+					Ctime:     time.Now().Unix(),
919
+					Mtime:     time.Now().Unix(),
920
+					UserOrgId: org_id,
921
+					IsUpload:  1,
922
+					OrderId:   order_id,
923
+				}
924
+				service.CreateUploadRecord(hisFundSettleListResult)
925
+				continue
926
+			}
927
+		}
928
+	}
929
+}
930
+
931
+func GetblpgBatchSettleList() {
932
+	org_id, _ := beego.AppConfig.Int64("org_id")
933
+	org_id = 10610
934
+	var orders []*models.HisOrder
935
+	//var orders []*models.HisOrderError
936
+	orders, _ = service.GetAllHisOrder10610()
714
 	for _, item := range orders {
937
 	for _, item := range orders {
715
 		order_id := item.ID
938
 		order_id := item.ID
716
 		order, _ := service.GetHisOrderByIDTwo(order_id)
939
 		order, _ := service.GetHisOrderByIDTwo(order_id)
746
 			if his.BalanceAccountsType == 2 {
969
 			if his.BalanceAccountsType == 2 {
747
 				continue
970
 				continue
748
 			}
971
 			}
972
+			ID := strconv.FormatInt(int64(order.ID), 10)
973
+
749
 			struct4101 := service.Struct4101{
974
 			struct4101 := service.Struct4101{
750
 				PsnNo:          order.PsnNo,
975
 				PsnNo:          order.PsnNo,
751
 				MdtrtId:        order.MdtrtId,
976
 				MdtrtId:        order.MdtrtId,
765
 				HiType:         order.Insutype,
990
 				HiType:         order.Insutype,
766
 				Insuplc:        his.InsuplcAdmdvs,
991
 				Insuplc:        his.InsuplcAdmdvs,
767
 				MaindiagFlag:   "1",
992
 				MaindiagFlag:   "1",
768
-				BillCode:       order.SetlId,
769
-				BillNo:         order.SetlId,
993
+				BillCode:      "000" +ID,
994
+				BillNo:        "000" +ID,
770
 				BizSn:          order.Number,
995
 				BizSn:          order.Number,
771
 				PsnSelfPay:     order.PsnPartAmt,
996
 				PsnSelfPay:     order.PsnPartAmt,
772
 				PsnOwnPay:      order.PsnPartAmt,
997
 				PsnOwnPay:      order.PsnPartAmt,
963
 			}
1188
 			}
964
 			if his.BalanceAccountsType == 2 {
1189
 			if his.BalanceAccountsType == 2 {
965
 				continue
1190
 				continue
1191
+
966
 			}
1192
 			}
1193
+			ID := strconv.FormatInt(int64(order.ID), 10)
1194
+
967
 			struct4101 := service.Struct4101{
1195
 			struct4101 := service.Struct4101{
968
 				PsnNo:          order.PsnNo,
1196
 				PsnNo:          order.PsnNo,
969
 				MdtrtId:        order.MdtrtId,
1197
 				MdtrtId:        order.MdtrtId,
983
 				HiType:         order.Insutype,
1211
 				HiType:         order.Insutype,
984
 				Insuplc:        his.InsuplcAdmdvs,
1212
 				Insuplc:        his.InsuplcAdmdvs,
985
 				MaindiagFlag:   "1",
1213
 				MaindiagFlag:   "1",
986
-				BillCode:       order.SetlId,
987
-				BillNo:         order.SetlId,
1214
+				BillCode:      "000" +ID,
1215
+				BillNo:        "000" +ID,
988
 				BizSn:          order.Number,
1216
 				BizSn:          order.Number,
989
 				PsnSelfPay:     order.PsnPartAmt,
1217
 				PsnSelfPay:     order.PsnPartAmt,
990
 				PsnOwnPay:      order.PsnPartAmt,
1218
 				PsnOwnPay:      order.PsnPartAmt,

+ 13 - 3
service/his_service.go View File

1570
 	return
1570
 	return
1571
 }
1571
 }
1572
 func GetAllHisOrder10138() (his []*models.HisOrder, err error) {
1572
 func GetAllHisOrder10138() (his []*models.HisOrder, err error) {
1573
-	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10610  AND status = 1  AND  order_status = 2 AND  setl_id <> '' AND setl_time >= '2024-12-01 00:00:00'  and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).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
1574
+	fmt.Println(err)
1575
+	return
1576
+}
1577
+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
1574
 	fmt.Println(err)
1579
 	fmt.Println(err)
1575
 	return
1580
 	return
1576
 }
1581
 }
1581
 
1586
 
1582
 func GetAllHisOrder10278() (his []*models.HisOrder, err error) {
1587
 func GetAllHisOrder10278() (his []*models.HisOrder, err error) {
1583
 
1588
 
1584
-	err = readDb.Model(&models.HisOrder{}).Where(" user_org_id = 10278  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND setl_time >= '2024-12-01 00:00:00'  and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
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
1585
 	fmt.Println(err)
1590
 	fmt.Println(err)
1586
 	return
1591
 	return
1587
 }
1592
 }
1806
 	}).Preload("NewDrugWarehouseInfo", "status = 1").Find(&flows).Error
1811
 	}).Preload("NewDrugWarehouseInfo", "status = 1").Find(&flows).Error
1807
 	return
1812
 	return
1808
 }
1813
 }
1809
-
1814
+func GetNewDrugFlowInforTentwo(start_system_time int64, end_system_time int64, org_id int64) (flows []*models.DrugFlow, err error) {
1815
+	err = readDb.Model(&models.DrugFlow{}).Joins("join his_doctor_advice_info info on info.patient_id = xt_drug_flow.patient_id and info.drug_id = xt_drug_flow.drug_id and info.record_date = xt_drug_flow.system_time").Where("xt_drug_flow.user_org_id = ? and xt_drug_flow.status = 1 and xt_drug_flow.sale_date = ?", org_id,"2025-03-02").Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1816
+		return db.Where("status = 1 and drug_code <> ''").Preload("BaseDrugLib", "status=1")
1817
+	}).Preload("NewDrugWarehouseInfo", "status = 1").Find(&flows).Error
1818
+	return
1819
+}
1810
 func GetHisPrescriptionByID(id int64) (pre models.HisPrescription) {
1820
 func GetHisPrescriptionByID(id int64) (pre models.HisPrescription) {
1811
 	err = readDb.Model(&models.HisPrescription{}).Where("id = ? and status = 1", id).Find(&pre).Error
1821
 	err = readDb.Model(&models.HisPrescription{}).Where("id = ? and status = 1", id).Find(&pre).Error
1812
 	return
1822
 	return

+ 3 - 1
service/hn_service.go View File

1984
 		fmt.Println(err.Error())
1984
 		fmt.Println(err.Error())
1985
 		return err.Error(), ""
1985
 		return err.Error(), ""
1986
 	}
1986
 	}
1987
+	timestamp2 := time.Now().UnixNano() / int64(time.Millisecond)
1988
+
1987
 	struct3505.RequestUrl = struct3505.RequestUrl + "3505"
1989
 	struct3505.RequestUrl = struct3505.RequestUrl + "3505"
1988
-	return HNHttpRequest(struct3505.RequestUrl, struct3505.AccessKey, struct3505.SecretKey, timestamp, string(bytesData), "3505"), string(bytesData)
1990
+	return HNHttpRequest(struct3505.RequestUrl, struct3505.AccessKey, struct3505.SecretKey, timestamp2, string(bytesData), "3505"), string(bytesData)
1989
 
1991
 
1990
 }
1992
 }
1991
 
1993