|
@@ -133,6 +133,8 @@ func PatientApiRegistRouters() {
|
133
|
133
|
|
134
|
134
|
beego.Router("api/patient/gettherapyinformed", &PatientApiController{}, "Get:GetTherapyInformed")
|
135
|
135
|
|
|
136
|
+ beego.Router("/api/patient/savemedicalhistory", &PatientApiController{}, "Post:SaveMedicalHistory")
|
|
137
|
+
|
136
|
138
|
}
|
137
|
139
|
func (c *PatientApiController) GetExportList() {
|
138
|
140
|
startTime := c.GetString("start_time")
|
|
@@ -6653,3 +6655,35 @@ func (c *PatientApiController) GetTherapyInformed() {
|
6653
|
6655
|
"list": theapyInformed,
|
6654
|
6656
|
})
|
6655
|
6657
|
}
|
|
6658
|
+
|
|
6659
|
+func (c *PatientApiController) SaveMedicalHistory() {
|
|
6660
|
+
|
|
6661
|
+ orgId := c.GetAdminUserInfo().CurrentOrgId
|
|
6662
|
+ dataBody := make(map[string]interface{}, 0)
|
|
6663
|
+ err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
|
|
6664
|
+ fmt.Println("err", err)
|
|
6665
|
+ content := dataBody["content"].(string)
|
|
6666
|
+ patient_id := int64(dataBody["patient_id"].(float64))
|
|
6667
|
+ medicalHistory := models.XtMedicalHistory{
|
|
6668
|
+ UserOrgId: orgId,
|
|
6669
|
+ PatientId: patient_id,
|
|
6670
|
+ Ctime: time.Now().Unix(),
|
|
6671
|
+ Mtime: 0,
|
|
6672
|
+ Status: 1,
|
|
6673
|
+ Content: content,
|
|
6674
|
+ }
|
|
6675
|
+
|
|
6676
|
+ //
|
|
6677
|
+ history, _ := service.GetPatientMedicalHistory(patient_id, orgId)
|
|
6678
|
+
|
|
6679
|
+ if history.ID > 0 {
|
|
6680
|
+ service.UpdatePatientMedicalHistory(history.ID, content)
|
|
6681
|
+ }
|
|
6682
|
+ if history.ID == 0 {
|
|
6683
|
+ service.CreatePatientMedicalHistory(medicalHistory)
|
|
6684
|
+ }
|
|
6685
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
6686
|
+ "medicalHistory": medicalHistory,
|
|
6687
|
+ })
|
|
6688
|
+
|
|
6689
|
+}
|