|
@@ -54,6 +54,7 @@ func HisProjectRouters() {
|
54
|
54
|
beego.Router("/api/hist/getallprojecteam", &HisProjectApiController{}, "Get:GetAllProjectTeam")
|
55
|
55
|
beego.Router("/api/his/getprojectlistbyid", &HisProjectApiController{}, "Get:GetProjectListById")
|
56
|
56
|
beego.Router("/api/his/gethispatienthistory", &HisProjectApiController{}, "Get:GetHisPatientHistory")
|
|
57
|
+ beego.Router("/api/patient/changepatient", &HisProjectApiController{}, "Get:ChangePatient")
|
57
|
58
|
}
|
58
|
59
|
|
59
|
60
|
func (this *HisProjectApiController) SaveProject() {
|
|
@@ -769,7 +770,8 @@ func (this *HisProjectApiController) SaveHisPatient() {
|
769
|
770
|
IdType: certificates,
|
770
|
771
|
CostOfProduction: cost_float,
|
771
|
772
|
Departments: department,
|
772
|
|
- AdminUserId: doctor,
|
|
773
|
+ Doctor: doctor,
|
|
774
|
+ AdminUserId: adminUserInfo.AdminUser.Id,
|
773
|
775
|
MedicalTreatmentType: medicalcare,
|
774
|
776
|
IdCardNo: idcard,
|
775
|
777
|
IsNeedCostOfProduction: cost_checked,
|
|
@@ -784,6 +786,7 @@ func (this *HisProjectApiController) SaveHisPatient() {
|
784
|
786
|
UserOrgId: orgId,
|
785
|
787
|
Status: 1,
|
786
|
788
|
RecordDate: nowtime,
|
|
789
|
+ IsReturn: 1,
|
787
|
790
|
}
|
788
|
791
|
err := service.CreateHisPatient(&patient)
|
789
|
792
|
if err != nil {
|
|
@@ -872,7 +875,10 @@ func (this *HisProjectApiController) GetHisPatientHistory() {
|
872
|
875
|
adminUserInfo := this.GetAdminUserInfo()
|
873
|
876
|
orgId := adminUserInfo.CurrentOrgId
|
874
|
877
|
history, total, err := service.GetHisPatientHistory(keyword, startTime.Unix(), endTime.Unix(), register_type, limit, page, orgId)
|
|
878
|
+
|
875
|
879
|
department, err := service.GetAllDepartMent(orgId)
|
|
880
|
+ appId := adminUserInfo.CurrentAppId
|
|
881
|
+ doctor, err := service.GetAllDoctor(orgId, appId)
|
876
|
882
|
if err != nil {
|
877
|
883
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
878
|
884
|
return
|
|
@@ -881,5 +887,34 @@ func (this *HisProjectApiController) GetHisPatientHistory() {
|
881
|
887
|
"history": history,
|
882
|
888
|
"total": total,
|
883
|
889
|
"department": department,
|
|
890
|
+ "doctor": doctor,
|
884
|
891
|
})
|
885
|
892
|
}
|
|
893
|
+
|
|
894
|
+func (this *HisProjectApiController) ChangePatient() {
|
|
895
|
+
|
|
896
|
+ id, _ := this.GetInt64("id")
|
|
897
|
+ //查询该患者今日是否已经就诊
|
|
898
|
+ recordDateStr := time.Now().Format("2006-01-02")
|
|
899
|
+ recordDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
|
|
900
|
+ fmt.Println("parseDateErr", parseDateErr)
|
|
901
|
+ nowtime := recordDate.Unix()
|
|
902
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
903
|
+ orgId := adminUserInfo.CurrentOrgId
|
|
904
|
+ _, errcode := service.GetHisPrescriptionTwo(id, orgId, nowtime)
|
|
905
|
+ if errcode == gorm.ErrRecordNotFound {
|
|
906
|
+ err := service.ChangePatient(id)
|
|
907
|
+ if err != nil {
|
|
908
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
909
|
+ return
|
|
910
|
+ }
|
|
911
|
+ returnData := make(map[string]interface{}, 0)
|
|
912
|
+ returnData["msg"] = "ok"
|
|
913
|
+ this.ServeSuccessJSON(returnData)
|
|
914
|
+ return
|
|
915
|
+ } else if errcode == nil {
|
|
916
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
917
|
+ return
|
|
918
|
+ }
|
|
919
|
+
|
|
920
|
+}
|