Browse Source

耗材参数

XMLWAN 3 years ago
parent
commit
4611f48013

+ 1 - 0
controllers/dialysis_api_controller.go View File

@@ -1214,6 +1214,7 @@ func (c *DialysisApiController) PostAssessmentAfterDislysis() {
1214 1214
 	assessment.Lapse = data.Lapse
1215 1215
 	assessment.Consciousness = data.Consciousness
1216 1216
 	assessment.Fallrisk = data.Fallrisk
1217
+	assessment.MachineRun = data.MachineRun
1217 1218
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
1218 1219
 
1219 1220
 	if assessment.ID > 0 {

+ 138 - 102
controllers/doctors_api_controller.go View File

@@ -725,13 +725,20 @@ func (this *DoctorsApiController) GetInspectionItemlist() {
725 725
 
726 726
 func (this *DoctorsApiController) GetInitDateList() {
727 727
 	patient_id, _ := this.GetInt64("patient_id")
728
+	start_time := this.GetString("start_time")
729
+	timeLayout := "2006-01-02"
730
+	loc, _ := time.LoadLocation("Local")
731
+	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
732
+	end_time := this.GetString("end_time")
733
+	endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
728 734
 
729
-	prescription_list, _ := service.GetDialysisPrescriptionDataList(patient_id)
730
-	befor_list, err := service.GetDialysisBeforInitDateList(patient_id)
731
-	after_list, err := service.GetDialysisAssementAfter(patient_id)
732
-	//统计透析次数
733
-	modelist, err := service.GetDialysisDialysisMode(patient_id)
735
+	prescription_list, _ := service.GetDialysisPrescriptionDataList(patient_id, startTime.Unix(), endTime.Unix())
736
+	befor_list, err := service.GetDialysisBeforInitDateList(patient_id, startTime.Unix(), endTime.Unix())
737
+	after_list, err := service.GetDialysisAssementAfter(patient_id, startTime.Unix(), endTime.Unix())
734 738
 	orgId := this.GetAdminUserInfo().CurrentOrgId
739
+	//统计透析次数
740
+	modelist, err := service.GetDialysisDialysisMode(patient_id, startTime.Unix(), endTime.Unix(), orgId)
741
+
735 742
 	docList, _ := service.GetAllDoctorThree(orgId)
736 743
 	stockType, err := service.GetStockType(orgId)
737 744
 
@@ -755,8 +762,9 @@ func (this *DoctorsApiController) GetInitDateList() {
755 762
 func (this *DoctorsApiController) SaveCreationInspection() {
756 763
 
757 764
 	title := this.GetString("title")
758
-	dry_weight, _ := this.GetFloat("dry_weight")
759
-	fmt.Println("hhhhhhhhhhhhh", dry_weight)
765
+
766
+	dryWeight := this.GetString("dry_weight")
767
+	dry_weight, _ := strconv.ParseFloat(dryWeight, 64)
760 768
 	dialysis_count, _ := this.GetInt64("dialysis_count")
761 769
 	hd_count, _ := this.GetInt64("hd_count")
762 770
 	hdf_count, _ := this.GetInt64("hdf_count")
@@ -765,19 +773,22 @@ func (this *DoctorsApiController) SaveCreationInspection() {
765 773
 	dialzer_apparatus := this.GetString("dialzer_apparatus")
766 774
 	perfusion_apparatus := this.GetString("perfusion_apparatus")
767 775
 	anticoagulant, _ := this.GetInt64("anticoagulant")
768
-	fmt.Println(anticoagulant)
769
-	kalium, _ := this.GetFloat("kalium")
770
-	autunite, _ := this.GetFloat("autunite")
771
-	natrium, _ := this.GetFloat("natrium")
776
+	kaliumstr := this.GetString("kalium")
777
+	kalium, _ := strconv.ParseFloat(kaliumstr, 64)
778
+
779
+	autunitestr := this.GetString("autunite")
780
+	autunite, _ := strconv.ParseFloat(autunitestr, 64)
781
+	natriumstr := this.GetString("natrium")
782
+	natrium, _ := strconv.ParseFloat(natriumstr, 64)
772 783
 	hour, _ := this.GetInt64("hour")
773 784
 	minute, _ := this.GetInt64("minute")
774
-	befor_weight, _ := this.GetFloat("befor_weight")
775
-	after_weight, _ := this.GetFloat("after_weight")
785
+	beforWeight := this.GetString("befor_weight")
786
+	befor_weight, _ := strconv.ParseFloat(beforWeight, 64)
787
+	afterWeight := this.GetString("after_weight")
788
+	after_weight, _ := strconv.ParseFloat(afterWeight, 64)
776 789
 	befor_pressure := this.GetString("befor_pressure")
777 790
 	template_summary_content := this.GetString("template_summary_content")
778 791
 	template_plan_content := this.GetString("template_plan_content")
779
-	template_inspection_content := this.GetString("template_inspection_content")
780
-	fmt.Println("hhhh232233232232332232323", template_inspection_content)
781 792
 	admin_user_id, _ := this.GetInt64("admin_user_id")
782 793
 	record_time := this.GetString("record_time")
783 794
 	timeLayout := "2006-01-02"
@@ -790,43 +801,46 @@ func (this *DoctorsApiController) SaveCreationInspection() {
790 801
 	patient_id, _ := this.GetInt64("patient_id")
791 802
 	fmt.Println("patient_id", patient_id)
792 803
 	orgId := this.GetAdminUserInfo().CurrentOrgId
804
+	inspect_date := this.GetString("inspect_date")
805
+	project_id := this.GetString("project_id")
793 806
 	summary := models.XtTemplateSummary{
794
-		StartYear:                 0,
795
-		StartMonth:                0,
796
-		Radio:                     0,
797
-		Quarter:                   0,
798
-		DryWeight:                 dry_weight,
799
-		DialysisCount:             dialysis_count,
800
-		HdCount:                   hd_count,
801
-		HdfCount:                  hdf_count,
802
-		HpCount:                   hp_count,
803
-		OtherCount:                other_count,
804
-		DialzerApparatus:          dialzer_apparatus,
805
-		PerfusionApparatus:        perfusion_apparatus,
806
-		Anticoagulant:             anticoagulant,
807
-		Kalium:                    kalium,
808
-		Autunite:                  autunite,
809
-		Natrium:                   natrium,
810
-		Hour:                      hour,
811
-		Minute:                    minute,
812
-		BeforWeight:               befor_weight,
813
-		AfterWeight:               after_weight,
814
-		BeforPressure:             befor_pressure,
815
-		AfterPressure:             after_pressure,
816
-		TemplateSummaryId:         template_summary_id,
817
-		TemplateSummaryContent:    template_summary_content,
818
-		TemplatePlanId:            template_plan_id,
819
-		TemplatePlanContent:       template_plan_content,
820
-		TemplateInspectionId:      template_inspection_id,
821
-		TemplateInspectionContent: template_inspection_content,
822
-		AdminUserId:               admin_user_id,
823
-		RecordTime:                recordTime.Unix(),
824
-		PatientId:                 patient_id,
825
-		UserOrgId:                 orgId,
826
-		Status:                    1,
827
-		Ctime:                     time.Now().Unix(),
828
-		Mtime:                     0,
829
-		Title:                     title,
807
+		StartYear:              0,
808
+		StartMonth:             0,
809
+		Radio:                  0,
810
+		Quarter:                0,
811
+		DryWeight:              dry_weight,
812
+		DialysisCount:          dialysis_count,
813
+		HdCount:                hd_count,
814
+		HdfCount:               hdf_count,
815
+		HpCount:                hp_count,
816
+		OtherCount:             other_count,
817
+		DialzerApparatus:       dialzer_apparatus,
818
+		PerfusionApparatus:     perfusion_apparatus,
819
+		Anticoagulant:          anticoagulant,
820
+		Kalium:                 kalium,
821
+		Autunite:               autunite,
822
+		Natrium:                natrium,
823
+		Hour:                   hour,
824
+		Minute:                 minute,
825
+		BeforWeight:            befor_weight,
826
+		AfterWeight:            after_weight,
827
+		BeforPressure:          befor_pressure,
828
+		AfterPressure:          after_pressure,
829
+		TemplateSummaryId:      template_summary_id,
830
+		TemplateSummaryContent: template_summary_content,
831
+		TemplatePlanId:         template_plan_id,
832
+		TemplatePlanContent:    template_plan_content,
833
+		TemplateInspectionId:   template_inspection_id,
834
+		AdminUserId:            admin_user_id,
835
+		RecordTime:             recordTime.Unix(),
836
+		PatientId:              patient_id,
837
+		UserOrgId:              orgId,
838
+		Status:                 1,
839
+		Ctime:                  time.Now().Unix(),
840
+		Mtime:                  0,
841
+		Title:                  title,
842
+		InspectDate:            inspect_date,
843
+		ProjectId:              project_id,
830 844
 	}
831 845
 
832 846
 	err := service.CreateSummary(&summary)
@@ -841,8 +855,14 @@ func (this *DoctorsApiController) SaveCreationInspection() {
841 855
 
842 856
 func (this *DoctorsApiController) GetTemplateSummaryList() {
843 857
 	patient_id, _ := this.GetInt64("patient_id")
858
+	start_time := this.GetString("start_time")
859
+	timeLayout := "2006-01-02"
860
+	loc, _ := time.LoadLocation("Local")
861
+	end_time := this.GetString("end_time")
844 862
 	orgId := this.GetAdminUserInfo().CurrentOrgId
845
-	list, err := service.GetTemplateSummaryList(patient_id, orgId)
863
+	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
864
+	endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
865
+	list, err := service.GetTemplateSummaryList(patient_id, orgId, startTime.Unix(), endTime.Unix())
846 866
 	if err == nil {
847 867
 		this.ServeSuccessJSON(map[string]interface{}{
848 868
 			"list": list,
@@ -855,9 +875,14 @@ func (this *DoctorsApiController) GetTemplateSummaryDetail() {
855 875
 
856 876
 	id, _ := this.GetInt64("id")
857 877
 	list, err := service.GetTemplateSummaryDetail(id)
878
+
879
+	ids := strings.Split(list.ProjectId, ",")
880
+	datelist := strings.Split(list.InspectDate, ",")
881
+	inspectlist, err := service.GetInspectionItemlist(list.PatientId, datelist, ids)
858 882
 	if err == nil {
859 883
 		this.ServeSuccessJSON(map[string]interface{}{
860
-			"list": list,
884
+			"list":        list,
885
+			"inspectlist": inspectlist,
861 886
 		})
862 887
 		return
863 888
 	}
@@ -867,12 +892,16 @@ func (this *DoctorsApiController) GetTemplateSummaryPrintDetail() {
867 892
 
868 893
 	id, _ := this.GetInt64("id")
869 894
 	list, err := service.GetTemplateSummaryPrintDetail(id)
895
+	ids := strings.Split(list.ProjectId, ",")
896
+	datelist := strings.Split(list.InspectDate, ",")
897
+	inspectlist, err := service.GetInspectionItemlist(list.PatientId, datelist, ids)
870 898
 	orgId := this.GetAdminUserInfo().CurrentOrgId
871 899
 	doctorList, _ := service.GetAllDoctorThree(orgId)
872 900
 	if err == nil {
873 901
 		this.ServeSuccessJSON(map[string]interface{}{
874
-			"list":       list,
875
-			"doctorList": doctorList,
902
+			"list":        list,
903
+			"doctorList":  doctorList,
904
+			"inspectlist": inspectlist,
876 905
 		})
877 906
 		return
878 907
 	}
@@ -882,8 +911,9 @@ func (this *DoctorsApiController) UpdateTempalteSummary() {
882 911
 
883 912
 	id, _ := this.GetInt64("id")
884 913
 	title := this.GetString("title")
885
-	dry_weight, _ := this.GetFloat("dry_weight")
886
-	fmt.Println("hhhhhhhhhhhhh", dry_weight)
914
+
915
+	dryWeight := this.GetString("dry_weight")
916
+	dry_weight, _ := strconv.ParseFloat(dryWeight, 64)
887 917
 	dialysis_count, _ := this.GetInt64("dialysis_count")
888 918
 	hd_count, _ := this.GetInt64("hd_count")
889 919
 	hdf_count, _ := this.GetInt64("hdf_count")
@@ -892,19 +922,22 @@ func (this *DoctorsApiController) UpdateTempalteSummary() {
892 922
 	dialzer_apparatus := this.GetString("dialzer_apparatus")
893 923
 	perfusion_apparatus := this.GetString("perfusion_apparatus")
894 924
 	anticoagulant, _ := this.GetInt64("anticoagulant")
895
-	fmt.Println(anticoagulant)
896
-	kalium, _ := this.GetFloat("kalium")
897
-	autunite, _ := this.GetFloat("autunite")
898
-	natrium, _ := this.GetFloat("natrium")
925
+	kaliumstr := this.GetString("kalium")
926
+	kalium, _ := strconv.ParseFloat(kaliumstr, 64)
927
+
928
+	autunitestr := this.GetString("autunite")
929
+	autunite, _ := strconv.ParseFloat(autunitestr, 64)
930
+	natriumstr := this.GetString("natrium")
931
+	natrium, _ := strconv.ParseFloat(natriumstr, 64)
899 932
 	hour, _ := this.GetInt64("hour")
900 933
 	minute, _ := this.GetInt64("minute")
901
-	befor_weight, _ := this.GetFloat("befor_weight")
902
-	after_weight, _ := this.GetFloat("after_weight")
934
+	beforWeight := this.GetString("befor_weight")
935
+	befor_weight, _ := strconv.ParseFloat(beforWeight, 64)
936
+	afterWeight := this.GetString("after_weight")
937
+	after_weight, _ := strconv.ParseFloat(afterWeight, 64)
903 938
 	befor_pressure := this.GetString("befor_pressure")
904 939
 	template_summary_content := this.GetString("template_summary_content")
905 940
 	template_plan_content := this.GetString("template_plan_content")
906
-	template_inspection_content := this.GetString("template_inspection_content")
907
-	fmt.Println("hhhh232233232232332232323", template_inspection_content)
908 941
 	admin_user_id, _ := this.GetInt64("admin_user_id")
909 942
 	record_time := this.GetString("record_time")
910 943
 	timeLayout := "2006-01-02"
@@ -917,44 +950,47 @@ func (this *DoctorsApiController) UpdateTempalteSummary() {
917 950
 	patient_id, _ := this.GetInt64("patient_id")
918 951
 	fmt.Println("patient_id", patient_id)
919 952
 	orgId := this.GetAdminUserInfo().CurrentOrgId
953
+	inspect_date := this.GetString("inspect_date")
954
+	project_id := this.GetString("project_id")
920 955
 	summary := models.XtTemplateSummary{
921
-		ID:                        id,
922
-		StartYear:                 0,
923
-		StartMonth:                0,
924
-		Radio:                     0,
925
-		Quarter:                   0,
926
-		DryWeight:                 dry_weight,
927
-		DialysisCount:             dialysis_count,
928
-		HdCount:                   hd_count,
929
-		HdfCount:                  hdf_count,
930
-		HpCount:                   hp_count,
931
-		OtherCount:                other_count,
932
-		DialzerApparatus:          dialzer_apparatus,
933
-		PerfusionApparatus:        perfusion_apparatus,
934
-		Anticoagulant:             anticoagulant,
935
-		Kalium:                    kalium,
936
-		Autunite:                  autunite,
937
-		Natrium:                   natrium,
938
-		Hour:                      hour,
939
-		Minute:                    minute,
940
-		BeforWeight:               befor_weight,
941
-		AfterWeight:               after_weight,
942
-		BeforPressure:             befor_pressure,
943
-		AfterPressure:             after_pressure,
944
-		TemplateSummaryId:         template_summary_id,
945
-		TemplateSummaryContent:    template_summary_content,
946
-		TemplatePlanId:            template_plan_id,
947
-		TemplatePlanContent:       template_plan_content,
948
-		TemplateInspectionId:      template_inspection_id,
949
-		TemplateInspectionContent: template_inspection_content,
950
-		AdminUserId:               admin_user_id,
951
-		RecordTime:                recordTime.Unix(),
952
-		PatientId:                 patient_id,
953
-		UserOrgId:                 orgId,
954
-		Status:                    1,
955
-		Ctime:                     time.Now().Unix(),
956
-		Mtime:                     0,
957
-		Title:                     title,
956
+		ID:                     id,
957
+		StartYear:              0,
958
+		StartMonth:             0,
959
+		Radio:                  0,
960
+		Quarter:                0,
961
+		DryWeight:              dry_weight,
962
+		DialysisCount:          dialysis_count,
963
+		HdCount:                hd_count,
964
+		HdfCount:               hdf_count,
965
+		HpCount:                hp_count,
966
+		OtherCount:             other_count,
967
+		DialzerApparatus:       dialzer_apparatus,
968
+		PerfusionApparatus:     perfusion_apparatus,
969
+		Anticoagulant:          anticoagulant,
970
+		Kalium:                 kalium,
971
+		Autunite:               autunite,
972
+		Natrium:                natrium,
973
+		Hour:                   hour,
974
+		Minute:                 minute,
975
+		BeforWeight:            befor_weight,
976
+		AfterWeight:            after_weight,
977
+		BeforPressure:          befor_pressure,
978
+		AfterPressure:          after_pressure,
979
+		TemplateSummaryId:      template_summary_id,
980
+		TemplateSummaryContent: template_summary_content,
981
+		TemplatePlanId:         template_plan_id,
982
+		TemplatePlanContent:    template_plan_content,
983
+		TemplateInspectionId:   template_inspection_id,
984
+		AdminUserId:            admin_user_id,
985
+		RecordTime:             recordTime.Unix(),
986
+		PatientId:              patient_id,
987
+		UserOrgId:              orgId,
988
+		Status:                 1,
989
+		Ctime:                  time.Now().Unix(),
990
+		Mtime:                  0,
991
+		Title:                  title,
992
+		ProjectId:              project_id,
993
+		InspectDate:            inspect_date,
958 994
 	}
959 995
 	err := service.UpdateTempalteSummary(&summary)
960 996
 	if err == nil {

+ 2 - 0
controllers/mobile_api_controllers/dialysis_api_controller.go View File

@@ -863,6 +863,7 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
863 863
 	lapse, _ := c.GetInt64("lapse")
864 864
 	consciousness, _ := c.GetInt64("consciousness")
865 865
 	fallrisk, _ := c.GetInt64("fallrisk")
866
+	machine_run := c.GetString("machine_run")
866 867
 	if id <= 0 {
867 868
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
868 869
 		return
@@ -963,6 +964,7 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
963 964
 		LeaveOfficeMethod:            leave_office_method,
964 965
 		Consciousness:                consciousness,
965 966
 		Fallrisk:                     fallrisk,
967
+		MachineRun:                   machine_run,
966 968
 	}
967 969
 
968 970
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)

+ 12 - 1
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go View File

@@ -2825,7 +2825,18 @@ func (this *NewDialysisApiController) GetTreateSummary() {
2825 2825
 	limit, _ := this.GetInt64("limit")
2826 2826
 	page, _ := this.GetInt64("page")
2827 2827
 	creater, _ := this.GetInt64("creater")
2828
-	list, total, err := service.GetTreateSummary(startTimeUnix.Unix(), endTimeUnix.Unix(), limit, page, creater)
2828
+	patient_id, _ := this.GetInt64("patient_id")
2829
+	list, total, err := service.GetTreateSummary(startTimeUnix.Unix(), endTimeUnix.Unix(), limit, page, creater, patient_id)
2830
+	//var inspectionTemplate []*models.VmInspection
2831
+	for _, item := range list {
2832
+		ids := strings.Split(item.ProjectId, ",")
2833
+		datelist := strings.Split(item.InspectDate, ",")
2834
+		itemlist, _ := service.GetInspectionItemlist(item.PatientId, datelist, ids)
2835
+		for _, it := range itemlist {
2836
+			item.Children = append(item.Children, it)
2837
+		}
2838
+	}
2839
+	fmt.Println("hhhhhhhhhhhhh99999999999999", list)
2829 2840
 	if err == nil {
2830 2841
 		this.ServeSuccessJSON(map[string]interface{}{
2831 2842
 			"list":  list,

+ 1 - 0
models/dialysis.go View File

@@ -631,6 +631,7 @@ type AssessmentAfterDislysis struct {
631 631
 	Lapse                           int64   `gorm:"column:lapse" json:"lapse" form:"lapse"`
632 632
 	Consciousness                   int64   `gorm:"column:consciousness" json:"consciousness" form:"consciousness"`
633 633
 	Fallrisk                        int64   `gorm:"column:fallrisk" json:"fallrisk" form:"fallrisk"`
634
+	MachineRun                      string  `gorm:"column:machine_run" json:"machine_run" form:"machine_run"`
634 635
 }
635 636
 
636 637
 func (AssessmentAfterDislysis) TableName() string {

+ 41 - 38
models/patient_models.go View File

@@ -1038,44 +1038,47 @@ func (ExportLog) TableName() string {
1038 1038
 }
1039 1039
 
1040 1040
 type XtTemplateSummary struct {
1041
-	ID                        int64      `gorm:"column:id" json:"id" form:"id"`
1042
-	StartYear                 int64      `gorm:"column:start_year" json:"start_year" form:"start_year"`
1043
-	StartMonth                int64      `gorm:"column:start_month" json:"start_month" form:"start_month"`
1044
-	Radio                     int64      `gorm:"column:radio" json:"radio" form:"radio"`
1045
-	Quarter                   int64      `gorm:"column:quarter" json:"quarter" form:"quarter"`
1046
-	DryWeight                 float64    `gorm:"column:dry_weight" json:"dry_weight" form:"dry_weight"`
1047
-	DialysisCount             int64      `gorm:"column:dialysis_count" json:"dialysis_count" form:"dialysis_count"`
1048
-	HdCount                   int64      `gorm:"column:hd_count" json:"hd_count" form:"hd_count"`
1049
-	HdfCount                  int64      `gorm:"column:hdf_count" json:"hdf_count" form:"hdf_count"`
1050
-	HpCount                   int64      `gorm:"column:hp_count" json:"hp_count" form:"hp_count"`
1051
-	OtherCount                int64      `gorm:"column:other_count" json:"other_count" form:"other_count"`
1052
-	DialzerApparatus          string     `gorm:"column:dialzer_apparatus" json:"dialzer_apparatus" form:"dialzer_apparatus"`
1053
-	PerfusionApparatus        string     `gorm:"column:perfusion_apparatus" json:"perfusion_apparatus" form:"perfusion_apparatus"`
1054
-	Anticoagulant             int64      `gorm:"column:anticoagulant" json:"anticoagulant" form:"anticoagulant"`
1055
-	Kalium                    float64    `gorm:"column:kalium" json:"kalium" form:"kalium"`
1056
-	Autunite                  float64    `gorm:"column:autunite" json:"autunite" form:"autunite"`
1057
-	Natrium                   float64    `gorm:"column:natrium" json:"natrium" form:"natrium"`
1058
-	Hour                      int64      `gorm:"column:hour" json:"hour" form:"hour"`
1059
-	Minute                    int64      `gorm:"column:minute" json:"minute" form:"minute"`
1060
-	BeforWeight               float64    `gorm:"column:befor_weight" json:"befor_weight" form:"befor_weight"`
1061
-	AfterWeight               float64    `gorm:"column:after_weight" json:"after_weight" form:"after_weight"`
1062
-	BeforPressure             string     `gorm:"column:befor_pressure" json:"befor_pressure" form:"befor_pressure"`
1063
-	AfterPressure             string     `gorm:"column:after_pressure" json:"after_pressure" form:"after_pressure"`
1064
-	TemplateSummaryId         int64      `gorm:"column:template_summary_id" json:"template_summary_id" form:"template_summary_id"`
1065
-	TemplateSummaryContent    string     `gorm:"column:template_summary_content" json:"template_summary_content" form:"template_summary_content"`
1066
-	TemplatePlanId            int64      `gorm:"column:template_plan_id" json:"template_plan_id" form:"template_plan_id"`
1067
-	TemplatePlanContent       string     `gorm:"column:template_plan_content" json:"template_plan_content" form:"template_plan_content"`
1068
-	TemplateInspectionId      int64      `gorm:"column:template_inspection_id" json:"template_inspection_id" form:"template_inspection_id"`
1069
-	TemplateInspectionContent string     `gorm:"column:template_inspection_content" json:"template_inspection_content" form:"template_inspection_content"`
1070
-	AdminUserId               int64      `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
1071
-	RecordTime                int64      `gorm:"column:record_time" json:"record_time" form:"record_time"`
1072
-	PatientId                 int64      `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1073
-	UserOrgId                 int64      `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1074
-	Status                    int64      `gorm:"column:status" json:"status" form:"status"`
1075
-	Ctime                     int64      `gorm:"column:ctime" json:"ctime" form:"ctime"`
1076
-	Mtime                     int64      `gorm:"column:mtime" json:"mtime" form:"mtime"`
1077
-	Title                     string     `gorm:"column:title" json:"title" form:"title"`
1078
-	Patients                  VmPatients `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
1041
+	ID                        int64           `gorm:"column:id" json:"id" form:"id"`
1042
+	StartYear                 int64           `gorm:"column:start_year" json:"start_year" form:"start_year"`
1043
+	StartMonth                int64           `gorm:"column:start_month" json:"start_month" form:"start_month"`
1044
+	Radio                     int64           `gorm:"column:radio" json:"radio" form:"radio"`
1045
+	Quarter                   int64           `gorm:"column:quarter" json:"quarter" form:"quarter"`
1046
+	DryWeight                 float64         `gorm:"column:dry_weight" json:"dry_weight" form:"dry_weight"`
1047
+	DialysisCount             int64           `gorm:"column:dialysis_count" json:"dialysis_count" form:"dialysis_count"`
1048
+	HdCount                   int64           `gorm:"column:hd_count" json:"hd_count" form:"hd_count"`
1049
+	HdfCount                  int64           `gorm:"column:hdf_count" json:"hdf_count" form:"hdf_count"`
1050
+	HpCount                   int64           `gorm:"column:hp_count" json:"hp_count" form:"hp_count"`
1051
+	OtherCount                int64           `gorm:"column:other_count" json:"other_count" form:"other_count"`
1052
+	DialzerApparatus          string          `gorm:"column:dialzer_apparatus" json:"dialzer_apparatus" form:"dialzer_apparatus"`
1053
+	PerfusionApparatus        string          `gorm:"column:perfusion_apparatus" json:"perfusion_apparatus" form:"perfusion_apparatus"`
1054
+	Anticoagulant             int64           `gorm:"column:anticoagulant" json:"anticoagulant" form:"anticoagulant"`
1055
+	Kalium                    float64         `gorm:"column:kalium" json:"kalium" form:"kalium"`
1056
+	Autunite                  float64         `gorm:"column:autunite" json:"autunite" form:"autunite"`
1057
+	Natrium                   float64         `gorm:"column:natrium" json:"natrium" form:"natrium"`
1058
+	Hour                      int64           `gorm:"column:hour" json:"hour" form:"hour"`
1059
+	Minute                    int64           `gorm:"column:minute" json:"minute" form:"minute"`
1060
+	BeforWeight               float64         `gorm:"column:befor_weight" json:"befor_weight" form:"befor_weight"`
1061
+	AfterWeight               float64         `gorm:"column:after_weight" json:"after_weight" form:"after_weight"`
1062
+	BeforPressure             string          `gorm:"column:befor_pressure" json:"befor_pressure" form:"befor_pressure"`
1063
+	AfterPressure             string          `gorm:"column:after_pressure" json:"after_pressure" form:"after_pressure"`
1064
+	TemplateSummaryId         int64           `gorm:"column:template_summary_id" json:"template_summary_id" form:"template_summary_id"`
1065
+	TemplateSummaryContent    string          `gorm:"column:template_summary_content" json:"template_summary_content" form:"template_summary_content"`
1066
+	TemplatePlanId            int64           `gorm:"column:template_plan_id" json:"template_plan_id" form:"template_plan_id"`
1067
+	TemplatePlanContent       string          `gorm:"column:template_plan_content" json:"template_plan_content" form:"template_plan_content"`
1068
+	TemplateInspectionId      int64           `gorm:"column:template_inspection_id" json:"template_inspection_id" form:"template_inspection_id"`
1069
+	TemplateInspectionContent string          `gorm:"column:template_inspection_content" json:"template_inspection_content" form:"template_inspection_content"`
1070
+	AdminUserId               int64           `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
1071
+	RecordTime                int64           `gorm:"column:record_time" json:"record_time" form:"record_time"`
1072
+	PatientId                 int64           `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1073
+	UserOrgId                 int64           `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1074
+	Status                    int64           `gorm:"column:status" json:"status" form:"status"`
1075
+	Ctime                     int64           `gorm:"column:ctime" json:"ctime" form:"ctime"`
1076
+	Mtime                     int64           `gorm:"column:mtime" json:"mtime" form:"mtime"`
1077
+	Title                     string          `gorm:"column:title" json:"title" form:"title"`
1078
+	ProjectId                 string          `gorm:"column:project_id" json:"project_id" form:"project_id"`
1079
+	InspectDate               string          `gorm:"column:inspect_date" json:"inspect_date" form:"inspect_date"`
1080
+	Patients                  VmPatients      `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
1081
+	Children                  []*VmInspection `gorm:"column:children" json:"children" form:"children"`
1079 1082
 }
1080 1083
 
1081 1084
 func (XtTemplateSummary) TableName() string {

+ 35 - 20
service/patientmanage_service.go View File

@@ -1679,55 +1679,55 @@ func GetInspectionItemlist(patientid int64, inspect_date []string, projectid []s
1679 1679
 	return inspection, err
1680 1680
 }
1681 1681
 
1682
-func GetDialysisBeforInitDateList(patient_id int64) (models.PredialysisEvaluation, error) {
1682
+func GetDialysisBeforInitDateList(patient_id int64, startime int64, endtime int64) (models.PredialysisEvaluation, error) {
1683 1683
 	befor := models.PredialysisEvaluation{}
1684 1684
 	db := XTReadDB().Model(&befor).Where("status = 1")
1685 1685
 	if patient_id > 0 {
1686
-		db = db.Where("patient_id = ? and assessment_date>=1627747200 and assessment_date<=1630339200 ", patient_id)
1686
+		db = db.Where("patient_id = ? and assessment_date>=? and assessment_date<=? ", patient_id, startime, endtime)
1687 1687
 	}
1688 1688
 
1689 1689
 	err = db.Last(&befor).Error
1690 1690
 	return befor, err
1691 1691
 }
1692 1692
 
1693
-func GetDialysisPrescriptionDataList(patient_id int64) (models.DialysisPrescription, error) {
1693
+func GetDialysisPrescriptionDataList(patient_id int64, startime int64, endtime int64) (models.DialysisPrescription, error) {
1694 1694
 
1695 1695
 	prescription := models.DialysisPrescription{}
1696 1696
 	db := XTReadDB().Model(&prescription).Where("status = 1")
1697 1697
 	if patient_id > 0 {
1698
-		db = db.Where("patient_id = ? and record_date>=1627747200 and record_date<=1630339200", patient_id)
1698
+		db = db.Where("patient_id = ? and record_date>=? and record_date<=?", patient_id, startime, endtime)
1699 1699
 	}
1700 1700
 	err = db.Last(&prescription).Error
1701 1701
 	return prescription, err
1702 1702
 }
1703 1703
 
1704
-func GetDialysisAssementAfter(patient_id int64) (models.AssessmentAfterDislysis, error) {
1704
+func GetDialysisAssementAfter(patient_id int64, startime int64, endtime int64) (models.AssessmentAfterDislysis, error) {
1705 1705
 
1706 1706
 	after := models.AssessmentAfterDislysis{}
1707 1707
 	db := XTReadDB().Model(&after).Where("status = 1")
1708 1708
 	if patient_id > 0 {
1709
-		db = db.Where("patient_id = ? and assessment_date>=1627747200 and assessment_date<=1630339200", patient_id)
1709
+		db = db.Where("patient_id = ? and assessment_date>=? and assessment_date<=?", patient_id, startime, endtime)
1710 1710
 	}
1711 1711
 	err = db.Last(&after).Error
1712 1712
 	return after, err
1713 1713
 }
1714 1714
 
1715
-func GetDialysisDialysisMode(patient_id int64) (counts []*models.PatientPrescriptionCountStruct, err error) {
1715
+func GetDialysisDialysisMode(patient_id int64, startime int64, endtime int64, orgid int64) (counts []*models.PatientPrescriptionCountStruct, err error) {
1716 1716
 
1717 1717
 	db := readDb.Table("xt_dialysis_order as o").Where("o.status = 1")
1718 1718
 	table := readDb.Table("xt_schedule as s").Where("s.status = 1")
1719 1719
 	fmt.Println(table)
1720 1720
 	p := readDb.Table("xt_patients as p").Where("p.status = 1")
1721 1721
 	fmt.Println(p)
1722
-	//if starttime > 0 {
1723
-	//  db = db.Where("o.dialysis_date >=?", starttime)
1724
-	//}
1725
-	//if endtime > 0 {
1726
-	//  db = db.Where("o.dialysis_date<=?", endtime)
1727
-	//}
1728
-	//if orgid > 0 {
1729
-	//  db = db.Where("o.user_org_id = ?", orgid)
1730
-	//}
1722
+	if startime > 0 {
1723
+		db = db.Where("o.dialysis_date >=?", startime)
1724
+	}
1725
+	if endtime > 0 {
1726
+		db = db.Where("o.dialysis_date<=?", endtime)
1727
+	}
1728
+	if orgid > 0 {
1729
+		db = db.Where("o.user_org_id = ?", orgid)
1730
+	}
1731 1731
 	if patient_id > 0 {
1732 1732
 		db = db.Where("o.patient_id = ?", patient_id)
1733 1733
 	}
@@ -1747,9 +1747,21 @@ func UpdateTempalteSummary(summary *models.XtTemplateSummary) error {
1747 1747
 	return err
1748 1748
 }
1749 1749
 
1750
-func GetTemplateSummaryList(patientid int64, orgid int64) (summary []*models.XtTemplateSummary, err error) {
1751
-
1752
-	err = XTReadDB().Where("patient_id = ? and user_org_id = ? and status = 1", patientid, orgid).Find(&summary).Error
1750
+func GetTemplateSummaryList(patientid int64, orgid int64, startime int64, endtime int64) (summary []*models.XtTemplateSummary, err error) {
1751
+	db := XTReadDB().Model(&summary).Where("status = 1")
1752
+	if startime > 0 {
1753
+		db = db.Where("ctime >=?", startime)
1754
+	}
1755
+	if endtime > 0 {
1756
+		db = db.Where("ctime<=?", endtime)
1757
+	}
1758
+	if patientid > 0 {
1759
+		db = db.Where("patient_id = ?", patientid)
1760
+	}
1761
+	if orgid > 0 {
1762
+		db = db.Where("user_org_id = ?", orgid)
1763
+	}
1764
+	err = db.Order("ctime desc").Find(&summary).Error
1753 1765
 	return summary, err
1754 1766
 }
1755 1767
 
@@ -1766,7 +1778,7 @@ func GetTemplateSummaryPrintDetail(id int64) (models.XtTemplateSummary, error) {
1766 1778
 	return summary, err
1767 1779
 }
1768 1780
 
1769
-func GetTreateSummary(startime int64, endtime int64, limit int64, page int64, creater int64) (list []*models.XtTemplateSummary, total int64, err error) {
1781
+func GetTreateSummary(startime int64, endtime int64, limit int64, page int64, creater int64, patient_id int64) (list []*models.XtTemplateSummary, total int64, err error) {
1770 1782
 
1771 1783
 	db := XTReadDB().Model(&list).Where("status = 1")
1772 1784
 	offset := (page - 1) * limit
@@ -1779,6 +1791,9 @@ func GetTreateSummary(startime int64, endtime int64, limit int64, page int64, cr
1779 1791
 	if creater > 0 {
1780 1792
 		db = db.Where("admin_user_id = ?", creater)
1781 1793
 	}
1794
+	if patient_id > 0 {
1795
+		db = db.Where("patient_id = ?", patient_id)
1796
+	}
1782 1797
 	err = db.Count(&total).Offset(offset).Limit(limit).Find(&list).Error
1783 1798
 	return list, total, err
1784 1799
 }