28169 před 1 měsícem
rodič
revize
80e88b44db

+ 48 - 0
controllers/patient_api_controller.go Zobrazit soubor

@@ -135,6 +135,12 @@ func PatientApiRegistRouters() {
135 135
 
136 136
 	beego.Router("/api/patient/savemedicalhistory", &PatientApiController{}, "Post:SaveMedicalHistory")
137 137
 
138
+	beego.Router("/api/patient/savepatientcritaicalinformed", &PatientApiController{}, "Post:SavePatientCritaicalInformed")
139
+
140
+	beego.Router("/api/patient/getPatientCriticalList", &PatientApiController{}, "Get:GetPatientCriticalList")
141
+
142
+	beego.Router("/api/patient/savepatientcriticalcalinformedone", &PatientApiController{}, "Post:SavePatientCriticalInformedOne")
143
+
138 144
 }
139 145
 func (c *PatientApiController) GetExportList() {
140 146
 	startTime := c.GetString("start_time")
@@ -6687,3 +6693,45 @@ func (c *PatientApiController) SaveMedicalHistory() {
6687 6693
 	})
6688 6694
 
6689 6695
 }
6696
+
6697
+func (c *PatientApiController) SavePatientCritaicalInformed() {
6698
+
6699
+	orgId := c.GetAdminUserInfo().CurrentOrgId
6700
+	dataBody := make(map[string]interface{}, 0)
6701
+	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
6702
+	fmt.Println("err", err)
6703
+	content := dataBody["content"].(string)
6704
+
6705
+	patientCritical := models.XtPatientCritical{
6706
+		UserOrgId: orgId,
6707
+		Content:   content,
6708
+		Status:    1,
6709
+		Ctime:     time.Now().Unix(),
6710
+		Mtime:     time.Now().Unix(),
6711
+	}
6712
+
6713
+	patientCritaicalInformed, _ := service.GetPatientCritaicalInformed(orgId)
6714
+
6715
+	if patientCritaicalInformed.ID == 0 {
6716
+		service.CreatePatientCritaicalinformed(patientCritical)
6717
+	}
6718
+	if patientCritaicalInformed.ID > 0 {
6719
+		service.UpdatePatientCritaicalInformed(patientCritaicalInformed.ID, content)
6720
+	}
6721
+	c.ServeSuccessJSON(map[string]interface{}{
6722
+		"patientCritical": patientCritical,
6723
+	})
6724
+}
6725
+
6726
+func (c *PatientApiController) GetPatientCriticalList() {
6727
+
6728
+	orgId := c.GetAdminUserInfo().CurrentOrgId
6729
+	patientCritaicalInformed, _ := service.GetPatientCritaicalInformed(orgId)
6730
+	c.ServeSuccessJSON(map[string]interface{}{
6731
+		"patientCritaicalInformed": patientCritaicalInformed,
6732
+	})
6733
+}
6734
+
6735
+func (c *PatientApiController) SavePatientCriticalInformedOne() {
6736
+
6737
+}

+ 146 - 53
controllers/patient_dataconfig_api_controller.go Zobrazit soubor

@@ -71,6 +71,8 @@ func PatientDataConfigAPIControllerRegistRouters() {
71 71
 
72 72
 	beego.Router("/api/patient/getpedpatientfallassessmentbyid", &PatientDataConfigAPIController{}, "Get:GetPedPatientFallassessmentById")
73 73
 
74
+	beego.Router("/api/patient/updatepatientfallassessmentbyid", &PatientDataConfigAPIController{}, "Post:UpdatePatientFallassessmentById")
75
+
74 76
 	beego.Router("/api/patient/deletepedpatientfallassment", &PatientDataConfigAPIController{}, "Get:DeletePadPatientFallassment")
75 77
 
76 78
 	beego.Router("/api/patient/savepatientpressuresore", &PatientDataConfigAPIController{}, "Post:SavePatientPressuresore")
@@ -2721,65 +2723,77 @@ func (this *PatientDataConfigAPIController) SavePediatrcFallassment() {
2721 2723
 		recordDate = theTime.Unix()
2722 2724
 	}
2723 2725
 
2724
-	if dataBody["age"] != nil && reflect.TypeOf(dataBody["age"]).String() == "[]interface {}" {
2725
-		ageList, _ := dataBody["age"].([]interface{})
2726
-
2727
-		for _, item := range ageList {
2728
-			//记录日志
2729
-			byterequest, _ := json.Marshal(item)
2730
-			str += string(byterequest) + ","
2731
-		}
2732
-	}
2733
-
2734
-	if dataBody["cognize"] != nil && reflect.TypeOf(dataBody["cognize"]).String() == "[]interface {}" {
2735
-		cognizeList, _ := dataBody["cognize"].([]interface{})
2736
-
2737
-		for _, item := range cognizeList {
2738
-			//记录日志
2739
-			byterequest, _ := json.Marshal(item)
2740
-			str += string(byterequest) + ","
2741
-		}
2742
-	}
2743
-
2744
-	if dataBody["diagnosis"] != nil && reflect.TypeOf(dataBody["diagnosis"]).String() == "[]interface {}" {
2745
-		diagnosisList, _ := dataBody["diagnosis"].([]interface{})
2726
+	//if dataBody["age"] != nil && reflect.TypeOf(dataBody["age"]).String() == "[]interface {}" {
2727
+	//	ageList, _ := dataBody["age"].([]interface{})
2728
+	//
2729
+	//	for _, item := range ageList {
2730
+	//		//记录日志
2731
+	//		byterequest, _ := json.Marshal(item)
2732
+	//		str += string(byterequest) + ","
2733
+	//	}
2734
+	//}
2735
+	//
2736
+	//if dataBody["cognize"] != nil && reflect.TypeOf(dataBody["cognize"]).String() == "[]interface {}" {
2737
+	//	cognizeList, _ := dataBody["cognize"].([]interface{})
2738
+	//
2739
+	//	for _, item := range cognizeList {
2740
+	//		//记录日志
2741
+	//		byterequest, _ := json.Marshal(item)
2742
+	//		str += string(byterequest) + ","
2743
+	//	}
2744
+	//}
2745
+	//
2746
+	//if dataBody["diagnosis"] != nil && reflect.TypeOf(dataBody["diagnosis"]).String() == "[]interface {}" {
2747
+	//	diagnosisList, _ := dataBody["diagnosis"].([]interface{})
2748
+	//
2749
+	//	for _, item := range diagnosisList {
2750
+	//		//记录日志
2751
+	//		byterequest, _ := json.Marshal(item)
2752
+	//		str += string(byterequest) + ","
2753
+	//	}
2754
+	//}
2755
+	//
2756
+	//if dataBody["environment"] != nil && reflect.TypeOf(dataBody["environment"]).String() == "[]interface {}" {
2757
+	//	environmentList, _ := dataBody["environment"].([]interface{})
2758
+	//
2759
+	//	for _, item := range environmentList {
2760
+	//		//记录日志
2761
+	//		byterequest, _ := json.Marshal(item)
2762
+	//		str += string(byterequest) + ","
2763
+	//	}
2764
+	//}
2765
+	//
2766
+	//if dataBody["medicine"] != nil && reflect.TypeOf(dataBody["medicine"]).String() == "[]interface {}" {
2767
+	//	medicineList, _ := dataBody["medicine"].([]interface{})
2768
+	//
2769
+	//	for _, item := range medicineList {
2770
+	//		//记录日志
2771
+	//		byterequest, _ := json.Marshal(item)
2772
+	//		str += string(byterequest) + ","
2773
+	//	}
2774
+	//}
2775
+	//
2776
+	//if dataBody["sex"] != nil && reflect.TypeOf(dataBody["sex"]).String() == "[]interface {}" {
2777
+	//	sexList, _ := dataBody["medicine"].([]interface{})
2778
+	//
2779
+	//	for _, item := range sexList {
2780
+	//		//记录日志
2781
+	//		byterequest, _ := json.Marshal(item)
2782
+	//		str += string(byterequest) + ","
2783
+	//	}
2784
+	//}
2746 2785
 
2747
-		for _, item := range diagnosisList {
2748
-			//记录日志
2749
-			byterequest, _ := json.Marshal(item)
2750
-			str += string(byterequest) + ","
2751
-		}
2752
-	}
2786
+	age := int64(dataBody["age"].(float64))
2753 2787
 
2754
-	if dataBody["environment"] != nil && reflect.TypeOf(dataBody["environment"]).String() == "[]interface {}" {
2755
-		environmentList, _ := dataBody["environment"].([]interface{})
2788
+	sex := int64(dataBody["sex"].(float64))
2756 2789
 
2757
-		for _, item := range environmentList {
2758
-			//记录日志
2759
-			byterequest, _ := json.Marshal(item)
2760
-			str += string(byterequest) + ","
2761
-		}
2762
-	}
2790
+	diagnosis := int64(dataBody["diagnosis"].(float64))
2763 2791
 
2764
-	if dataBody["medicine"] != nil && reflect.TypeOf(dataBody["medicine"]).String() == "[]interface {}" {
2765
-		medicineList, _ := dataBody["medicine"].([]interface{})
2792
+	environment := int64(dataBody["environment"].(float64))
2766 2793
 
2767
-		for _, item := range medicineList {
2768
-			//记录日志
2769
-			byterequest, _ := json.Marshal(item)
2770
-			str += string(byterequest) + ","
2771
-		}
2772
-	}
2794
+	medicine := int64(dataBody["medicine"].(float64))
2773 2795
 
2774
-	if dataBody["sex"] != nil && reflect.TypeOf(dataBody["sex"]).String() == "[]interface {}" {
2775
-		sexList, _ := dataBody["medicine"].([]interface{})
2776
-
2777
-		for _, item := range sexList {
2778
-			//记录日志
2779
-			byterequest, _ := json.Marshal(item)
2780
-			str += string(byterequest) + ","
2781
-		}
2782
-	}
2796
+	tumble := int64(dataBody["tumble"].(float64))
2783 2797
 
2784 2798
 	pedFallssessment := models.XtPatientPedFallssessment{
2785 2799
 		PatientId:   patient_id,
@@ -2792,6 +2806,12 @@ func (this *PatientDataConfigAPIController) SavePediatrcFallassment() {
2792 2806
 		Total:       total,
2793 2807
 		AdminUserId: admin_user_id,
2794 2808
 		Type:        1,
2809
+		Age:         age,
2810
+		Sex:         sex,
2811
+		Diagnosis:   diagnosis,
2812
+		Environment: environment,
2813
+		Medicine:    medicine,
2814
+		Tumble:      tumble,
2795 2815
 	}
2796 2816
 
2797 2817
 	service.CreatePadFallssessment(pedFallssessment)
@@ -2828,6 +2848,10 @@ func (this *PatientDataConfigAPIController) GetPedPatientFallassessmentById() {
2828 2848
 	})
2829 2849
 }
2830 2850
 
2851
+func (this *PatientDataConfigAPIController) UpdatePatientFallassessmentById() {
2852
+
2853
+}
2854
+
2831 2855
 func (this *PatientDataConfigAPIController) DeletePadPatientFallassment() {
2832 2856
 
2833 2857
 	id, _ := this.GetInt64("id")
@@ -2845,4 +2869,73 @@ func (this *PatientDataConfigAPIController) SavePatientPressuresore() {
2845 2869
 
2846 2870
 func (this *PatientDataConfigAPIController) SavePatientHpPressuresore() {
2847 2871
 
2872
+	dataBody := make(map[string]interface{}, 0)
2873
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
2874
+	if err != nil {
2875
+		utils.ErrorLog(err.Error())
2876
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2877
+		return
2878
+	}
2879
+	user_org_id := this.GetAdminUserInfo().CurrentOrgId
2880
+
2881
+	id := int64(dataBody["id"].(float64))
2882
+
2883
+	admin_user_id := int64(dataBody["tumble"].(float64))
2884
+
2885
+	patient_id := int64(dataBody["patient_id"].(float64))
2886
+
2887
+	record_date := dataBody["date"].(string)
2888
+
2889
+	total := int64(dataBody["pedia_Totalpoints"].(float64))
2890
+
2891
+	timeLayout := "2006-01-02"
2892
+	loc, _ := time.LoadLocation("Local")
2893
+	var recordDate int64
2894
+	var str string
2895
+	if len(record_date) > 0 {
2896
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
2897
+		if err != nil {
2898
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2899
+			return
2900
+		}
2901
+		recordDate = theTime.Unix()
2902
+	}
2903
+
2904
+	age := int64(dataBody["age"].(float64))
2905
+
2906
+	sex := int64(dataBody["sex"].(float64))
2907
+
2908
+	diagnosis := int64(dataBody["diagnosis"].(float64))
2909
+
2910
+	environment := int64(dataBody["environment"].(float64))
2911
+
2912
+	medicine := int64(dataBody["medicine"].(float64))
2913
+
2914
+	tumble := int64(dataBody["tumble"].(float64))
2915
+
2916
+	pedFallssessment := models.XtPatientPedFallssessment{
2917
+		ID:          id,
2918
+		PatientId:   patient_id,
2919
+		UserOrgId:   user_org_id,
2920
+		Status:      1,
2921
+		Ctime:       time.Now().Unix(),
2922
+		Mtime:       0,
2923
+		Text:        str,
2924
+		RecordDate:  recordDate,
2925
+		Total:       total,
2926
+		AdminUserId: admin_user_id,
2927
+		Type:        1,
2928
+		Age:         age,
2929
+		Sex:         sex,
2930
+		Diagnosis:   diagnosis,
2931
+		Environment: environment,
2932
+		Medicine:    medicine,
2933
+		Tumble:      tumble,
2934
+	}
2935
+
2936
+	service.UpdatePedFallssessment(pedFallssessment)
2937
+
2938
+	this.ServeSuccessJSON(map[string]interface{}{
2939
+		"pedFallssessment": pedFallssessment,
2940
+	})
2848 2941
 }

+ 20 - 0
models/patient_models.go Zobrazit soubor

@@ -2838,8 +2838,28 @@ type XtPatientPedFallssessment struct {
2838 2838
 	Total       int64  `gorm:"column:total" json:"total" form:"total"`
2839 2839
 	AdminUserId int64  `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
2840 2840
 	Type        int64  `gorm:"column:type" json:"type" form:"type"`
2841
+	Age         int64  `gorm:"column:age" json:"age" form:"age"`
2842
+	Cognize     int64  `gorm:"column:cognize" json:"cognize" form:"cognize"`
2843
+	Diagnosis   int64  `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
2844
+	Environment int64  `gorm:"column:environment" json:"environment" form:"environment"`
2845
+	Medicine    int64  `gorm:"column:medicine" json:"medicine" form:"medicine"`
2846
+	Sex         int64  `gorm:"column:sex" json:"sex" form:"sex"`
2847
+	Tumble      int64  `gorm:"column:tumble" json:"tumble" form:"tumble"`
2841 2848
 }
2842 2849
 
2843 2850
 func (XtPatientPedFallssessment) TableName() string {
2844 2851
 	return "xt_patient_ped_fallssessment"
2845 2852
 }
2853
+
2854
+type XtPatientCritical struct {
2855
+	ID        int64  `gorm:"column:id" json:"id" form:"id"`
2856
+	UserOrgId int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2857
+	Content   string `gorm:"column:content" json:"content" form:"content"`
2858
+	Status    int64  `gorm:"column:status" json:"status" form:"status"`
2859
+	Ctime     int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
2860
+	Mtime     int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
2861
+}
2862
+
2863
+func (XtPatientCritical) TableName() string {
2864
+	return "xt_patient_critical"
2865
+}

+ 29 - 0
service/patient_service.go Zobrazit soubor

@@ -4078,6 +4078,13 @@ func CreatePadFallssessment(fallssessment models.XtPatientPedFallssessment) erro
4078 4078
 	return err
4079 4079
 }
4080 4080
 
4081
+func UpdatePedFallssessment(fallssessment models.XtPatientPedFallssessment) error {
4082
+
4083
+	err := XTWriteDB().Save(&fallssessment).Error
4084
+
4085
+	return err
4086
+}
4087
+
4081 4088
 func GetBedDiatricFallassessmentList(patient_id int64, is_type int64, user_org_id int64, limit int64, page int64) (list []*models.XtPatientPedFallssessment, total int64, err error) {
4082 4089
 
4083 4090
 	offset := (page - 1) * limit
@@ -4112,3 +4119,25 @@ func DeletePadPatientFallassment(id int64) (err error) {
4112 4119
 	return err
4113 4120
 
4114 4121
 }
4122
+
4123
+func GetPatientCritaicalInformed(user_org_id int64) (models.XtPatientCritical, error) {
4124
+
4125
+	patientCritical := models.XtPatientCritical{}
4126
+
4127
+	err := XTReadDB().Where("user_org_id = ? and status=1", user_org_id).Find(&patientCritical).Error
4128
+
4129
+	return patientCritical, err
4130
+}
4131
+
4132
+func CreatePatientCritaicalinformed(critical models.XtPatientCritical) error {
4133
+
4134
+	err = XTWriteDB().Create(&critical).Error
4135
+
4136
+	return err
4137
+}
4138
+
4139
+func UpdatePatientCritaicalInformed(id int64, content string) error {
4140
+
4141
+	err := XTWriteDB().Model(&models.XtPatientCritical{}).Where("id = ? and status=1", id).Updates(map[string]interface{}{"content": content}).Error
4142
+	return err
4143
+}