28169 1 mese fa
parent
commit
30ff4ad8e8
2 ha cambiato i file con 162 aggiunte e 0 eliminazioni
  1. 149 0
      controllers/patient_dataconfig_api_controller.go
  2. 13 0
      service/patient_service.go

+ 149 - 0
controllers/patient_dataconfig_api_controller.go Vedi File

@@ -78,6 +78,9 @@ func PatientDataConfigAPIControllerRegistRouters() {
78 78
 	beego.Router("/api/patient/savepatientpressuresore", &PatientDataConfigAPIController{}, "Post:SavePatientPressuresore")
79 79
 
80 80
 	beego.Router("/api/patient/savepatienthpressuresore", &PatientDataConfigAPIController{}, "Post:SavePatientHpPressuresore")
81
+	beego.Router("/api/patient/getpatientbedlist", &PatientDataConfigAPIController{}, "Get:GetPatientBedList")
82
+
83
+	beego.Router("/api/patient/updatebedpatientlist", &PatientDataConfigAPIController{}, "Post:UpdateBedPatientList")
81 84
 
82 85
 }
83 86
 
@@ -2945,3 +2948,149 @@ func (this *PatientDataConfigAPIController) UpdatePedPatientFallassessment() {
2945 2948
 		"pedFallssessment": pedFallssessment,
2946 2949
 	})
2947 2950
 }
2951
+
2952
+func (this *PatientDataConfigAPIController) SavePatientHpPressuresore() {
2953
+
2954
+	dataBody := make(map[string]interface{}, 0)
2955
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
2956
+	if err != nil {
2957
+		utils.ErrorLog(err.Error())
2958
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2959
+		return
2960
+	}
2961
+
2962
+	record_date := dataBody["record_date"].(string)
2963
+	timeLayout := "2006-01-02"
2964
+	loc, _ := time.LoadLocation("Local")
2965
+	var recordDate int64
2966
+	if len(record_date) > 0 {
2967
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
2968
+		if err != nil {
2969
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2970
+			return
2971
+		}
2972
+		recordDate = theTime.Unix()
2973
+	}
2974
+	var str string
2975
+	if dataBody["list"] != nil && reflect.TypeOf(dataBody["list"]).String() == "[]interface {}" {
2976
+		list, _ := dataBody["list"].([]interface{})
2977
+		for _, item := range list {
2978
+			byterequest, _ := json.Marshal(item)
2979
+			str += string(byterequest) + ","
2980
+		}
2981
+	}
2982
+	patient_id := int64(dataBody["patient_id"].(float64))
2983
+
2984
+	is_type := int64(dataBody["is_type"].(float64))
2985
+	var data models.XtPatientPedFallssessment
2986
+
2987
+	json.Unmarshal(this.Ctx.Input.RequestBody, &data)
2988
+	orgId := this.GetAdminUserInfo().CurrentOrgId
2989
+
2990
+	pedFallssessment := models.XtPatientPedFallssessment{
2991
+		PatientId:   patient_id,
2992
+		UserOrgId:   orgId,
2993
+		Status:      1,
2994
+		Ctime:       time.Now().Unix(),
2995
+		Mtime:       time.Now().Unix(),
2996
+		Text:        str,
2997
+		RecordDate:  recordDate,
2998
+		Total:       0,
2999
+		AdminUserId: 0,
3000
+		Type:        is_type,
3001
+		Age:         0,
3002
+		Cognize:     0,
3003
+		Diagnosis:   0,
3004
+		Environment: 0,
3005
+		Medicine:    0,
3006
+		Sex:         0,
3007
+		Tumble:      0,
3008
+	}
3009
+
3010
+	service.CreatePatientPedList(pedFallssessment)
3011
+
3012
+	this.ServeSuccessJSON(map[string]interface{}{
3013
+		"pedFallssessment": pedFallssessment,
3014
+	})
3015
+}
3016
+
3017
+func (this *PatientDataConfigAPIController) GetPatientBedList() {
3018
+
3019
+	patient_id, _ := this.GetInt64("patient_id")
3020
+	page, _ := this.GetInt64("page")
3021
+	limit, _ := this.GetInt64("limit")
3022
+	is_type, _ := this.GetInt64("is_type")
3023
+	orgId := this.GetAdminUserInfo().CurrentOrgId
3024
+	list, total, _ := service.GetBedDiatricFallassessmentList(patient_id, is_type, orgId, limit, page)
3025
+	this.ServeSuccessJSON(map[string]interface{}{
3026
+		"list":  list,
3027
+		"total": total,
3028
+	})
3029
+}
3030
+
3031
+func (this *PatientDataConfigAPIController) UpdateBedPatientList() {
3032
+
3033
+	dataBody := make(map[string]interface{}, 0)
3034
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
3035
+	if err != nil {
3036
+		utils.ErrorLog(err.Error())
3037
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
3038
+		return
3039
+	}
3040
+
3041
+	record_date := dataBody["record_date"].(string)
3042
+	timeLayout := "2006-01-02"
3043
+	loc, _ := time.LoadLocation("Local")
3044
+	var recordDate int64
3045
+	if len(record_date) > 0 {
3046
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
3047
+		if err != nil {
3048
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
3049
+			return
3050
+		}
3051
+		recordDate = theTime.Unix()
3052
+	}
3053
+	var str string
3054
+	if dataBody["list"] != nil && reflect.TypeOf(dataBody["list"]).String() == "[]interface {}" {
3055
+		list, _ := dataBody["list"].([]interface{})
3056
+		for _, item := range list {
3057
+			byterequest, _ := json.Marshal(item)
3058
+			str += string(byterequest) + ","
3059
+		}
3060
+	}
3061
+	patient_id := int64(dataBody["patient_id"].(float64))
3062
+
3063
+	id := int64(dataBody["id"].(float64))
3064
+
3065
+	is_type := int64(dataBody["is_type"].(float64))
3066
+	var data models.XtPatientPedFallssessment
3067
+
3068
+	json.Unmarshal(this.Ctx.Input.RequestBody, &data)
3069
+	orgId := this.GetAdminUserInfo().CurrentOrgId
3070
+
3071
+	pedFallssessment := models.XtPatientPedFallssessment{
3072
+		ID:          id,
3073
+		PatientId:   patient_id,
3074
+		UserOrgId:   orgId,
3075
+		Status:      1,
3076
+		Ctime:       time.Now().Unix(),
3077
+		Mtime:       time.Now().Unix(),
3078
+		Text:        str,
3079
+		RecordDate:  recordDate,
3080
+		Total:       0,
3081
+		AdminUserId: 0,
3082
+		Type:        is_type,
3083
+		Age:         0,
3084
+		Cognize:     0,
3085
+		Diagnosis:   0,
3086
+		Environment: 0,
3087
+		Medicine:    0,
3088
+		Sex:         0,
3089
+		Tumble:      0,
3090
+	}
3091
+	service.UpdatePatientPedList(pedFallssessment)
3092
+
3093
+	this.ServeSuccessJSON(map[string]interface{}{
3094
+		"pedFallssessment": pedFallssessment,
3095
+	})
3096
+}

+ 13 - 0
service/patient_service.go Vedi File

@@ -4172,3 +4172,16 @@ func GetPatientCriticalOneList(user_org_id int64) (models.XtPatientCriticalOne,
4172 4172
 
4173 4173
 	return criticalOne, err
4174 4174
 }
4175
+
4176
+func CreatePatientPedList(fallssessment models.XtPatientPedFallssessment) error {
4177
+
4178
+	err := XTWriteDB().Create(&fallssessment).Error
4179
+	return err
4180
+}
4181
+
4182
+func UpdatePatientPedList(fallssessment models.XtPatientPedFallssessment) error {
4183
+
4184
+	err := XTWriteDB().Save(&fallssessment).Error
4185
+
4186
+	return err
4187
+}